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

Unified 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: rebase Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: snapshot/win/process_reader_win.cc
diff --git a/snapshot/win/process_reader_win.cc b/snapshot/win/process_reader_win.cc
index a7665c293aaae99ec34c03dd41f81e230c34aa06..9d27051d3d6aad77c1254865aa72e830fd39c785 100644
--- a/snapshot/win/process_reader_win.cc
+++ b/snapshot/win/process_reader_win.cc
@@ -228,6 +228,25 @@ bool ProcessReaderWin::ReadMemory(WinVMAddress at,
return true;
}
+WinVMSize ProcessReaderWin::ReadAvailableMemory(WinVMAddress at,
+ WinVMSize num_bytes,
+ void* into) const {
+ auto ranges = process_info_.GetReadableRanges(
+ CheckedRange<WinVMAddress, WinVMSize>(at, num_bytes));
+ // We only read up until the first unavailable block, so we only read from the
Mark Mentovai 2015/10/01 19:05:47 Put some blank lines before these comments that ap
scottmg 2015/10/01 20:17:01 Done.
+ // first range.
+ if (ranges.empty())
+ return 0;
Mark Mentovai 2015/10/01 19:05:47 LOG something on the return-0s that don’t pass thr
scottmg 2015/10/01 20:17:01 I was thinking since we're using this in a trial-a
Mark Mentovai 2015/10/01 22:00:52 scottmg wrote:
+ // If the start address was adjusted, we couldn't read even the first
+ // requested byte.
+ if (ranges.front().base() != at)
+ return 0;
+ // If we fail on a normal read, then something went very wrong.
+ if (!ReadMemory(ranges.front().base(), ranges.front().size(), into))
Mark Mentovai 2015/10/01 19:05:47 It’s not strictly necessary because the tests shou
scottmg 2015/10/01 20:17:01 Done.
+ return 0;
+ return ranges.front().size();
+}
+
bool ProcessReaderWin::StartTime(timeval* start_time) const {
FILETIME creation, exit, kernel, user;
if (!GetProcessTimes(process_, &creation, &exit, &kernel, &user)) {

Powered by Google App Engine
This is Rietveld 408576698