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

Unified Diff: snapshot/win/process_snapshot_win.cc

Issue 1475033005: win: Only capture the loader lock for now (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/win/process_snapshot_win.cc
diff --git a/snapshot/win/process_snapshot_win.cc b/snapshot/win/process_snapshot_win.cc
index b8498d6c6c27fa8e081d1e58cd048f1fd5ad3532..c59cdded82aa87f54cb2f8884c9f44c5282049d2 100644
--- a/snapshot/win/process_snapshot_win.cc
+++ b/snapshot/win/process_snapshot_win.cc
@@ -448,6 +448,10 @@ void ProcessSnapshotWin::ReadLocks(
WinVMAddress current_address = start_address_backward;
WinVMAddress last_good_address;
+ // Cap the list of locks we capture arbitrarily so we don't walk forever.
+ const int kMaxWalkLength = 100;
Mark Mentovai 2015/11/30 18:32:06 …and maybe we should just grab the loader lock her
+ int walk_count = 0;
+
// Typically, this seems to be a circular list, but it's not clear that it
// always is, so follow Blink fields back to the head (or where we started)
// before following Flink to capture memory.
@@ -473,6 +477,9 @@ void ProcessSnapshotWin::ReadLocks(
critical_section_debug.ProcessLocksList.Blink -
offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
ProcessLocksList);
+ walk_count++;
+ if (walk_count == kMaxWalkLength)
+ break;
} while (current_address != start_address_backward &&
current_address != kInvalid);
@@ -481,6 +488,8 @@ void ProcessSnapshotWin::ReadLocks(
current_address = last_good_address;
}
+ walk_count = 0;
+
const WinVMAddress start_address_forward = current_address;
// current_address is now the head of the list, walk Flink to add the whole
@@ -513,6 +522,12 @@ void ProcessSnapshotWin::ReadLocks(
critical_section_debug.ProcessLocksList.Flink -
offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
ProcessLocksList);
+ walk_count++;
+ // Walk twice as far on the forward walk, so that if we started at an
+ // important one (for example the Loader Lock), we get it, and ones that
+ // were presumably allocated temporally near it.
+ if (walk_count == kMaxWalkLength * 2)
+ break;
} while (current_address != start_address_forward &&
current_address != kInvalid);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698