OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 completed_test_event_(completed_test_event), | 81 completed_test_event_(completed_test_event), |
82 break_near_(0) {} | 82 break_near_(0) {} |
83 ~CrashingDelegate() override {} | 83 ~CrashingDelegate() override {} |
84 | 84 |
85 void set_break_near(WinVMAddress break_near) { break_near_ = break_near; } | 85 void set_break_near(WinVMAddress break_near) { break_near_ = break_near; } |
86 | 86 |
87 void ExceptionHandlerServerStarted() override { SetEvent(server_ready_); } | 87 void ExceptionHandlerServerStarted() override { SetEvent(server_ready_); } |
88 | 88 |
89 unsigned int ExceptionHandlerServerException( | 89 unsigned int ExceptionHandlerServerException( |
90 HANDLE process, | 90 HANDLE process, |
91 WinVMAddress exception_information_address) override { | 91 WinVMAddress exception_information_address, |
| 92 WinVMAddress debug_critical_section_address) override { |
92 ScopedProcessSuspend suspend(process); | 93 ScopedProcessSuspend suspend(process); |
93 ProcessSnapshotWin snapshot; | 94 ProcessSnapshotWin snapshot; |
94 snapshot.Initialize(process, ProcessSuspensionState::kSuspended); | 95 snapshot.Initialize(process, |
| 96 ProcessSuspensionState::kSuspended, |
| 97 debug_critical_section_address); |
95 snapshot.InitializeException(exception_information_address); | 98 snapshot.InitializeException(exception_information_address); |
96 | 99 |
97 // Confirm the exception record was read correctly. | 100 // Confirm the exception record was read correctly. |
98 EXPECT_NE(snapshot.Exception()->ThreadID(), 0u); | 101 EXPECT_NE(snapshot.Exception()->ThreadID(), 0u); |
99 EXPECT_EQ(snapshot.Exception()->Exception(), EXCEPTION_BREAKPOINT); | 102 EXPECT_EQ(snapshot.Exception()->Exception(), EXCEPTION_BREAKPOINT); |
100 | 103 |
101 // Verify the exception happened at the expected location with a bit of | 104 // Verify the exception happened at the expected location with a bit of |
102 // slop space to allow for reading the current PC before the exception | 105 // slop space to allow for reading the current PC before the exception |
103 // happens. See TestCrashingChild(). | 106 // happens. See TestCrashingChild(). |
104 const uint64_t kAllowedOffset = 64; | 107 const uint64_t kAllowedOffset = 64; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 completed_test_event_(completed_test_event), | 182 completed_test_event_(completed_test_event), |
180 dump_near_(0) {} | 183 dump_near_(0) {} |
181 ~SimulateDelegate() override {} | 184 ~SimulateDelegate() override {} |
182 | 185 |
183 void set_dump_near(WinVMAddress dump_near) { dump_near_ = dump_near; } | 186 void set_dump_near(WinVMAddress dump_near) { dump_near_ = dump_near; } |
184 | 187 |
185 void ExceptionHandlerServerStarted() override { SetEvent(server_ready_); } | 188 void ExceptionHandlerServerStarted() override { SetEvent(server_ready_); } |
186 | 189 |
187 unsigned int ExceptionHandlerServerException( | 190 unsigned int ExceptionHandlerServerException( |
188 HANDLE process, | 191 HANDLE process, |
189 WinVMAddress exception_information_address) override { | 192 WinVMAddress exception_information_address, |
| 193 WinVMAddress debug_critical_section_address) override { |
190 ScopedProcessSuspend suspend(process); | 194 ScopedProcessSuspend suspend(process); |
191 ProcessSnapshotWin snapshot; | 195 ProcessSnapshotWin snapshot; |
192 snapshot.Initialize(process, ProcessSuspensionState::kSuspended); | 196 snapshot.Initialize(process, |
| 197 ProcessSuspensionState::kSuspended, |
| 198 debug_critical_section_address); |
193 snapshot.InitializeException(exception_information_address); | 199 snapshot.InitializeException(exception_information_address); |
194 EXPECT_TRUE(snapshot.Exception()); | 200 EXPECT_TRUE(snapshot.Exception()); |
195 EXPECT_EQ(0x517a7ed, snapshot.Exception()->Exception()); | 201 EXPECT_EQ(0x517a7ed, snapshot.Exception()->Exception()); |
196 | 202 |
197 // Verify the dump was captured at the expected location with some slop | 203 // Verify the dump was captured at the expected location with some slop |
198 // space. | 204 // space. |
199 const uint64_t kAllowedOffset = 64; | 205 const uint64_t kAllowedOffset = 64; |
200 EXPECT_GT(snapshot.Exception()->Context()->InstructionPointer(), | 206 EXPECT_GT(snapshot.Exception()->Context()->InstructionPointer(), |
201 dump_near_); | 207 dump_near_); |
202 EXPECT_LT(snapshot.Exception()->Context()->InstructionPointer(), | 208 EXPECT_LT(snapshot.Exception()->Context()->InstructionPointer(), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Debug")); | 274 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Debug")); |
269 #else | 275 #else |
270 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Release")); | 276 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Release")); |
271 #endif | 277 #endif |
272 } | 278 } |
273 #endif // ARCH_CPU_64_BITS | 279 #endif // ARCH_CPU_64_BITS |
274 | 280 |
275 } // namespace | 281 } // namespace |
276 } // namespace test | 282 } // namespace test |
277 } // namespace crashpad | 283 } // namespace crashpad |
OLD | NEW |