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

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

Issue 1360863006: win: Add more memory regions to gathering of PEB (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@save-peb
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 base::checked_cast<SIZE_T>(num_bytes), 224 base::checked_cast<SIZE_T>(num_bytes),
225 &bytes_read) || 225 &bytes_read) ||
226 num_bytes != bytes_read) { 226 num_bytes != bytes_read) {
227 PLOG(ERROR) << "ReadMemory at 0x" << std::hex << at << std::dec << " of " 227 PLOG(ERROR) << "ReadMemory at 0x" << std::hex << at << std::dec << " of "
228 << num_bytes << " bytes failed"; 228 << num_bytes << " bytes failed";
229 return false; 229 return false;
230 } 230 }
231 return true; 231 return true;
232 } 232 }
233 233
234 WinVMSize ProcessReaderWin::ReadAvailableMemory(WinVMAddress at,
235 WinVMSize num_bytes,
236 void* into) const {
237 auto ranges = GetAccessibleRangesInMemoryMap(
238 at, num_bytes, process_info_.MemoryInformation());
239 // We only read up until the first unavailable block, so we only read from the
240 // first range.
241 if (ranges.empty())
242 return 0;
243 if (!ReadMemory(ranges.front().base(), ranges.front().size(), into))
244 return 0;
245 return ranges.front().size();
246 }
247
234 bool ProcessReaderWin::StartTime(timeval* start_time) const { 248 bool ProcessReaderWin::StartTime(timeval* start_time) const {
235 FILETIME creation, exit, kernel, user; 249 FILETIME creation, exit, kernel, user;
236 if (!GetProcessTimes(process_, &creation, &exit, &kernel, &user)) { 250 if (!GetProcessTimes(process_, &creation, &exit, &kernel, &user)) {
237 PLOG(ERROR) << "GetProcessTimes"; 251 PLOG(ERROR) << "GetProcessTimes";
238 return false; 252 return false;
239 } 253 }
240 *start_time = FiletimeToTimevalEpoch(creation); 254 *start_time = FiletimeToTimevalEpoch(creation);
241 return true; 255 return true;
242 } 256 }
243 257
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 thread.stack_region_size = 0; 384 thread.stack_region_size = 0;
371 } else { 385 } else {
372 thread.stack_region_size = base - limit; 386 thread.stack_region_size = base - limit;
373 } 387 }
374 } 388 }
375 threads_.push_back(thread); 389 threads_.push_back(thread);
376 } 390 }
377 } 391 }
378 392
379 } // namespace crashpad 393 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698