Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: snapshot/win/exception_snapshot_win_test.cc

Issue 1392093003: win: Capture some CRITICAL_SECTION debugging data (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/end_to_end_test.py ('k') | snapshot/win/process_snapshot_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « snapshot/win/end_to_end_test.py ('k') | snapshot/win/process_snapshot_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698