mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-31 01:43:03 +08:00
win: Cap number of locks gathered
On Win 7 in a debug configuration, this was gathering hundreds of thousands of locks, causing test timeouts to be exceeded. On user machines, UnhandledExceptionHandler() probably would have timed out also. Arbitrarily cap the number of locks captured, as we don't have a pressing need for anything other than the LoaderLock anyway. In the future, we may want to figure out a signalling mechanism so that the client can note other interesting locks to be grabbed, and just avoid walking the list entirely. R=mark@chromium.org BUG=chromium:546288 Review URL: https://codereview.chromium.org/1475033005 .
This commit is contained in:
parent
33414779e1
commit
b3464d96f5
@ -448,6 +448,10 @@ void ProcessSnapshotWin::ReadLocks(
|
|||||||
WinVMAddress current_address = start_address_backward;
|
WinVMAddress current_address = start_address_backward;
|
||||||
WinVMAddress last_good_address;
|
WinVMAddress last_good_address;
|
||||||
|
|
||||||
|
// Cap the list of locks we capture arbitrarily so we don't walk forever.
|
||||||
|
const int kMaxWalkLength = 100;
|
||||||
|
int walk_count = 0;
|
||||||
|
|
||||||
// Typically, this seems to be a circular list, but it's not clear that it
|
// 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)
|
// always is, so follow Blink fields back to the head (or where we started)
|
||||||
// before following Flink to capture memory.
|
// before following Flink to capture memory.
|
||||||
@ -473,6 +477,9 @@ void ProcessSnapshotWin::ReadLocks(
|
|||||||
critical_section_debug.ProcessLocksList.Blink -
|
critical_section_debug.ProcessLocksList.Blink -
|
||||||
offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
|
offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
|
||||||
ProcessLocksList);
|
ProcessLocksList);
|
||||||
|
walk_count++;
|
||||||
|
if (walk_count == kMaxWalkLength)
|
||||||
|
break;
|
||||||
} while (current_address != start_address_backward &&
|
} while (current_address != start_address_backward &&
|
||||||
current_address != kInvalid);
|
current_address != kInvalid);
|
||||||
|
|
||||||
@ -481,6 +488,8 @@ void ProcessSnapshotWin::ReadLocks(
|
|||||||
current_address = last_good_address;
|
current_address = last_good_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
walk_count = 0;
|
||||||
|
|
||||||
const WinVMAddress start_address_forward = current_address;
|
const WinVMAddress start_address_forward = current_address;
|
||||||
|
|
||||||
// current_address is now the head of the list, walk Flink to add the whole
|
// 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 -
|
critical_section_debug.ProcessLocksList.Flink -
|
||||||
offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
|
offsetof(process_types::RTL_CRITICAL_SECTION_DEBUG<Traits>,
|
||||||
ProcessLocksList);
|
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 &&
|
} while (current_address != start_address_forward &&
|
||||||
current_address != kInvalid);
|
current_address != kInvalid);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user