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

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

Issue 1356383002: win: Implement CRASHPAD_SIMULATE_CRASH() (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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const ProcessReaderWin& process_reader, 127 const ProcessReaderWin& process_reader,
128 WinVMAddress exception_pointers_address, 128 WinVMAddress exception_pointers_address,
129 ContextType* context_record) { 129 ContextType* context_record) {
130 ExceptionPointersType exception_pointers; 130 ExceptionPointersType exception_pointers;
131 if (!process_reader.ReadMemory(exception_pointers_address, 131 if (!process_reader.ReadMemory(exception_pointers_address,
132 sizeof(exception_pointers), 132 sizeof(exception_pointers),
133 &exception_pointers)) { 133 &exception_pointers)) {
134 LOG(ERROR) << "EXCEPTION_POINTERS read failed"; 134 LOG(ERROR) << "EXCEPTION_POINTERS read failed";
135 return false; 135 return false;
136 } 136 }
137
138 if (!process_reader.ReadMemory(
139 static_cast<WinVMAddress>(exception_pointers.ContextRecord),
140 sizeof(*context_record),
141 context_record)) {
142 LOG(ERROR) << "ContextRecord";
143 return false;
144 }
145
137 if (!exception_pointers.ExceptionRecord) { 146 if (!exception_pointers.ExceptionRecord) {
138 LOG(ERROR) << "null ExceptionRecord"; 147 LOG(INFO) << "null ExceptionRecord, not capturing any exception";
Mark Mentovai 2015/09/23 20:00:52 This is fully expected now, I don’t think we need
scottmg 2015/09/24 19:16:52 Done.
139 return false; 148 return true;
140 } 149 }
141 150
142 ExceptionRecordType first_record; 151 ExceptionRecordType first_record;
143 if (!process_reader.ReadMemory( 152 if (!process_reader.ReadMemory(
144 static_cast<WinVMAddress>(exception_pointers.ExceptionRecord), 153 static_cast<WinVMAddress>(exception_pointers.ExceptionRecord),
145 sizeof(first_record), 154 sizeof(first_record),
146 &first_record)) { 155 &first_record)) {
147 LOG(ERROR) << "ExceptionRecord"; 156 LOG(ERROR) << "ExceptionRecord";
148 return false; 157 return false;
149 } 158 }
150 exception_code_ = first_record.ExceptionCode; 159 exception_code_ = first_record.ExceptionCode;
151 exception_flags_ = first_record.ExceptionFlags; 160 exception_flags_ = first_record.ExceptionFlags;
152 exception_address_ = first_record.ExceptionAddress; 161 exception_address_ = first_record.ExceptionAddress;
153 for (DWORD i = 0; i < first_record.NumberParameters; ++i) 162 for (DWORD i = 0; i < first_record.NumberParameters; ++i)
154 codes_.push_back(first_record.ExceptionInformation[i]); 163 codes_.push_back(first_record.ExceptionInformation[i]);
155 if (first_record.ExceptionRecord) { 164 if (first_record.ExceptionRecord) {
156 // https://code.google.com/p/crashpad/issues/detail?id=43 165 // https://code.google.com/p/crashpad/issues/detail?id=43
157 LOG(WARNING) << "dropping chained ExceptionRecord"; 166 LOG(WARNING) << "dropping chained ExceptionRecord";
158 } 167 }
159 168
160 if (!process_reader.ReadMemory(
161 static_cast<WinVMAddress>(exception_pointers.ContextRecord),
162 sizeof(*context_record),
163 context_record)) {
164 LOG(ERROR) << "ContextRecord";
165 return false;
166 }
167
168 return true; 169 return true;
169 } 170 }
170 171
171 } // namespace internal 172 } // namespace internal
172 } // namespace crashpad 173 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698