Index: snapshot/win/process_snapshot_win.h |
diff --git a/snapshot/win/process_snapshot_win.h b/snapshot/win/process_snapshot_win.h |
index a38ac5e9382b2cf16e9ba5295df2c2534d7f6e08..c9edfac3e94d598963a4a1fff4dc260b249833be 100644 |
--- a/snapshot/win/process_snapshot_win.h |
+++ b/snapshot/win/process_snapshot_win.h |
@@ -59,12 +59,18 @@ class ProcessSnapshotWin final : public ProcessSnapshot { |
//! \param[in] process The handle to create a snapshot from. |
//! \param[in] suspension_state Whether \a process has been suspended by the |
//! caller. |
+ //! \param[in] debug_critical_section_address The address in the target |
+ //! process's address space of a `CRITICAL_SECTION` allocated with valid |
+ //! `.DebugInfo`. Used as a starting point to walk the process's locks. |
+ //! May be `0`. |
//! |
//! \return `true` if the snapshot could be created, `false` otherwise with |
//! an appropriate message logged. |
//! |
//! \sa ScopedProcessSuspend |
- bool Initialize(HANDLE process, ProcessSuspensionState suspension_state); |
+ bool Initialize(HANDLE process, |
+ ProcessSuspensionState suspension_state, |
+ WinVMAddress debug_critical_section_address); |
//! \brief Initializes the object's exception. |
//! |
@@ -138,9 +144,10 @@ class ProcessSnapshotWin final : public ProcessSnapshot { |
// Initializes modules_ on behalf of Initialize(). |
void InitializeModules(); |
- // Initializes peb_memory_ on behalf of Initialize(). |
+ // Initializes various memory blocks reachable from the PEB on behalf of |
+ // Initialize(). |
template <class Traits> |
- void InitializePebData(); |
+ void InitializePebData(WinVMAddress debug_critical_section_address); |
void AddMemorySnapshot(WinVMAddress address, |
WinVMSize size, |
@@ -160,8 +167,16 @@ class ProcessSnapshotWin final : public ProcessSnapshot { |
WinVMSize DetermineSizeOfEnvironmentBlock( |
WinVMAddress start_of_environment_block); |
+ // Starting from the address of a CRITICAL_SECTION, walks the doubly-linked |
+ // list stored in RTL_CRITICAL_SECTION.DebugInfo.ProcessLocksList adding both |
+ // the RTL_CRITICAL_SECTION and the RTL_CRITICAL_SECTION_DEBUG memory blocks |
+ // to the snapshot. |
+ template <class Traits> |
+ void ReadLocks(WinVMAddress start, |
+ PointerVector<internal::MemorySnapshotWin>* into); |
+ |
internal::SystemSnapshotWin system_; |
- PointerVector<internal::MemorySnapshotWin> peb_memory_; |
+ PointerVector<internal::MemorySnapshotWin> extra_memory_; |
PointerVector<internal::ThreadSnapshotWin> threads_; |
PointerVector<internal::ModuleSnapshotWin> modules_; |
scoped_ptr<internal::ExceptionSnapshotWin> exception_; |