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

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

Issue 1377963002: win: Add and use a custom CaptureContext() implementation (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feeback (2) 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 | « client/simulate_crash_win.h ('k') | snapshot/win/process_reader_win.cc » ('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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void ExceptionHandlerServerStarted() override { SetEvent(server_ready_); } 185 void ExceptionHandlerServerStarted() override { SetEvent(server_ready_); }
186 186
187 unsigned int ExceptionHandlerServerException( 187 unsigned int ExceptionHandlerServerException(
188 HANDLE process, 188 HANDLE process,
189 WinVMAddress exception_information_address) override { 189 WinVMAddress exception_information_address) override {
190 ScopedProcessSuspend suspend(process); 190 ScopedProcessSuspend suspend(process);
191 ProcessSnapshotWin snapshot; 191 ProcessSnapshotWin snapshot;
192 snapshot.Initialize(process, ProcessSuspensionState::kSuspended); 192 snapshot.Initialize(process, ProcessSuspensionState::kSuspended);
193 snapshot.InitializeException(exception_information_address); 193 snapshot.InitializeException(exception_information_address);
194 EXPECT_TRUE(snapshot.Exception()); 194 EXPECT_TRUE(snapshot.Exception());
195 EXPECT_EQ(0, snapshot.Exception()->Exception()); 195 EXPECT_EQ(0x517a7ed, snapshot.Exception()->Exception());
196 EXPECT_EQ(0, snapshot.Exception()->ExceptionAddress());
197 196
198 // Verify the dump was captured at the expected location with some slop 197 // Verify the dump was captured at the expected location with some slop
199 // space. 198 // space.
200 const uint64_t kAllowedOffset = 64; 199 const uint64_t kAllowedOffset = 64;
201 EXPECT_GT(snapshot.Exception()->Context()->InstructionPointer(), 200 EXPECT_GT(snapshot.Exception()->Context()->InstructionPointer(),
202 dump_near_); 201 dump_near_);
203 EXPECT_LT(snapshot.Exception()->Context()->InstructionPointer(), 202 EXPECT_LT(snapshot.Exception()->Context()->InstructionPointer(),
204 dump_near_ + kAllowedOffset); 203 dump_near_ + kAllowedOffset);
205 204
205 EXPECT_EQ(snapshot.Exception()->Context()->InstructionPointer(),
206 snapshot.Exception()->ExceptionAddress());
207
206 SetEvent(completed_test_event_); 208 SetEvent(completed_test_event_);
207 209
208 return 0; 210 return 0;
209 } 211 }
210 212
211 private: 213 private:
212 HANDLE server_ready_; // weak 214 HANDLE server_ready_; // weak
213 HANDLE completed_test_event_; // weak 215 HANDLE completed_test_event_; // weak
214 WinVMAddress dump_near_; 216 WinVMAddress dump_near_;
215 217
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Debug")); 268 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Debug"));
267 #else 269 #else
268 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Release")); 270 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Release"));
269 #endif 271 #endif
270 } 272 }
271 #endif // ARCH_CPU_64_BITS 273 #endif // ARCH_CPU_64_BITS
272 274
273 } // namespace 275 } // namespace
274 } // namespace test 276 } // namespace test
275 } // namespace crashpad 277 } // namespace crashpad
OLDNEW
« no previous file with comments | « client/simulate_crash_win.h ('k') | snapshot/win/process_reader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698