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

Unified Diff: util/mac/process_reader.h

Issue 543193002: Make ProcessReaderModule and ProcessReaderThread nested classes (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 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 | « no previous file | util/mac/process_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mac/process_reader.h
diff --git a/util/mac/process_reader.h b/util/mac/process_reader.h
index 56d9995485a0b54ca5d51de7050523d09ec57d91..0e5a30ef55fcbb6e047bfd64fe329d050eefdc80 100644
--- a/util/mac/process_reader.h
+++ b/util/mac/process_reader.h
@@ -32,62 +32,63 @@
namespace crashpad {
-//! \brief Contains information about a thread that belongs to a task (process).
-struct ProcessReaderThread {
+//! \brief Accesses information about another process, identified by a Mach
+//! task.
+class ProcessReader {
+ public:
+ //! \brief Contains information about a thread that belongs to a task
+ //! (process).
+ struct Thread {
#if defined(ARCH_CPU_X86_FAMILY)
- union ThreadContext {
- x86_thread_state64_t t64;
- x86_thread_state32_t t32;
- };
- union FloatContext {
- x86_float_state64_t f64;
- x86_float_state32_t f32;
- };
- union DebugContext {
- x86_debug_state64_t d64;
- x86_debug_state32_t d32;
- };
+ union ThreadContext {
+ x86_thread_state64_t t64;
+ x86_thread_state32_t t32;
+ };
+ union FloatContext {
+ x86_float_state64_t f64;
+ x86_float_state32_t f32;
+ };
+ union DebugContext {
+ x86_debug_state64_t d64;
+ x86_debug_state32_t d32;
+ };
#endif
- ProcessReaderThread();
- ~ProcessReaderThread() {}
-
- ThreadContext thread_context;
- FloatContext float_context;
- DebugContext debug_context;
- uint64_t id;
- mach_vm_address_t stack_region_address;
- mach_vm_size_t stack_region_size;
- mach_vm_address_t thread_specific_data_address;
- mach_port_t port;
- int suspend_count;
- int priority;
-};
+ Thread();
+ ~Thread() {}
+
+ ThreadContext thread_context;
+ FloatContext float_context;
+ DebugContext debug_context;
+ uint64_t id;
+ mach_vm_address_t stack_region_address;
+ mach_vm_size_t stack_region_size;
+ mach_vm_address_t thread_specific_data_address;
+ mach_port_t port;
+ int suspend_count;
+ int priority;
+ };
-//! \brief Contains information about a module loaded into a process.
-struct ProcessReaderModule {
- ProcessReaderModule();
- ~ProcessReaderModule();
+ //! \brief Contains information about a module loaded into a process.
+ struct Module {
+ Module();
+ ~Module();
- //! \brief The pathname used to load the module from disk.
- std::string name;
+ //! \brief The pathname used to load the module from disk.
+ std::string name;
- //! \brief The address where the base of the module is loaded in the remote
- //! process.
- mach_vm_address_t address;
+ //! \brief The address where the base of the module is loaded in the remote
+ //! process.
+ mach_vm_address_t address;
- //! \brief The module’s timestamp.
- //!
- //! This field will be `0` if its value cannot be determined. It can only be
- //! determined for images that are loaded by dyld, so it will be `0` for the
- //! main executable and for dyld itself.
- time_t timestamp;
-};
+ //! \brief The module’s timestamp.
+ //!
+ //! This field will be `0` if its value cannot be determined. It can only be
+ //! determined for images that are loaded by dyld, so it will be `0` for the
+ //! main executable and for dyld itself.
+ time_t timestamp;
+ };
-//! \brief Accesses information about another process, identified by a Mach
-//! task.
-class ProcessReader {
- public:
ProcessReader();
~ProcessReader();
@@ -129,12 +130,12 @@ class ProcessReader {
//! \return The threads that are in the task (process). The first element (at
//! index `0`) corresponds to the main thread.
- const std::vector<ProcessReaderThread>& Threads();
+ const std::vector<Thread>& Threads();
//! \return The modules loaded in the process. The first element (at index
//! `0`) corresponds to the main executable, and the final element
//! corresponds to the dynamic loader, dyld.
- const std::vector<ProcessReaderModule>& Modules();
+ const std::vector<Module>& Modules();
private:
//! Performs lazy initialization of the \a threads_ vector on behalf of
@@ -201,8 +202,8 @@ class ProcessReader {
unsigned int user_tag);
kinfo_proc kern_proc_info_;
- std::vector<ProcessReaderThread> threads_; // owns send rights
- std::vector<ProcessReaderModule> modules_;
+ std::vector<Thread> threads_; // owns send rights
+ std::vector<Module> modules_;
scoped_ptr<TaskMemory> task_memory_;
mach_port_t task_; // weak
InitializationStateDcheck initialized_;
« no previous file with comments | « no previous file | util/mac/process_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698