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

Unified Diff: snapshot/win/process_reader_win.h

Issue 1326443007: win: Fix incorrect thread suspend count due to ScopedProcessSuspend (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: assert some threads captured 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
« no previous file with comments | « snapshot/win/pe_image_reader_test.cc ('k') | snapshot/win/process_reader_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/win/process_reader_win.h
diff --git a/snapshot/win/process_reader_win.h b/snapshot/win/process_reader_win.h
index 3ef738adcffaa3d4ad3443d9282a4b11404b385f..3f49f335924ef9f942760a140498ca0942fdd244 100644
--- a/snapshot/win/process_reader_win.h
+++ b/snapshot/win/process_reader_win.h
@@ -26,6 +26,15 @@
namespace crashpad {
+//! \brief State of process being read by ProcessReaderWin.
+enum class ProcessSuspensionState : bool {
+ //! \brief The process has not been suspended.
+ kRunning,
+
+ //! \brief The process is suspended.
+ kSuspended,
+};
+
//! \brief Accesses information about another process, identified by a `HANDLE`.
class ProcessReaderWin {
public:
@@ -52,11 +61,17 @@ class ProcessReaderWin {
//!
//! \param[in] process Process handle, must have `PROCESS_QUERY_INFORMATION`,
//! `PROCESS_VM_READ`, and `PROCESS_DUP_HANDLE` access.
+ //! \param[in] suspension_state Whether \a process has already been suspended
+ //! by the caller. Typically, this will be
+ //! ProcessSuspensionState::kSuspended, except for testing uses and where
+ //! the reader is reading itself.
//!
//! \return `true` on success, indicating that this object will respond
//! validly to further method calls. `false` on failure. On failure, no
//! further method calls should be made.
- bool Initialize(HANDLE process);
+ //!
+ //! \sa ScopedProcessSuspend
+ bool Initialize(HANDLE process, ProcessSuspensionState suspension_state);
//! \return `true` if the target task is a 64-bit process.
bool Is64Bit() const { return process_info_.Is64Bit(); }
@@ -96,6 +111,7 @@ class ProcessReaderWin {
ProcessInfo process_info_;
std::vector<Thread> threads_;
std::vector<ProcessInfo::Module> modules_;
+ ProcessSuspensionState suspension_state_;
bool initialized_threads_;
InitializationStateDcheck initialized_;
« no previous file with comments | « snapshot/win/pe_image_reader_test.cc ('k') | snapshot/win/process_reader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698