PStack  2.0
Stack trace printer for MSVC and GCC binaries
psystem::process_info Class Reference

A container object for a process's information. More...

#include <process_info.hpp>

Inheritance diagram for psystem::process_info:
Collaboration diagram for psystem::process_info:

Type Definitions

using thread_info_map = std::map< thread_id_t, std::unique_ptr< thread_info > >
 Mapping of thread IDs (TIDs) to the psystem::thread_info instance. More...
 

Construction / Destruction

 process_info (process_id_t pid, CREATE_PROCESS_DEBUG_INFO const &info) noexcept
 Construct a process_info instance. More...
 
 ~process_info () noexcept
 Free resources from the process_info instance.
 

Public Accessors

HANDLE get_process_handle () const noexcept
 Access the handle to the process for system debugging API. More...
 
process_id_t get_process_id () const noexcept
 The system process ID (PID) relating to this instance. More...
 

Public Interface

bool add_thread (std::unique_ptr< thread_info > thread) noexcept
 Allow a psystem::thread_info instance to be managed by this process_info instance. More...
 
void remove_thread (thread_id_t tid) noexcept
 Remove a thread from being managed by this process_info instance. More...
 

Member Data

std::map< psystem::address_t, psystem::module_info, std::greater< psystem::address_t > > m_modules
 A map of base address for a module to the module info object itself. More...
 
thread_info_map m_threads
 A mapping of thread ID to the psystem::thread_info instance. More...
 
process_id_t const m_process_id
 The system ID the corresponds to the process encapsulated here.
 
HANDLE m_process_handle
 A system handle for debug API to access this process.
 

Additional Inherited Members

- Private Member Functions inherited from psystem::not_assignable
not_assignableoperator= (not_assignable const &) const =delete
 Delete the basic assignment operator.
 
constexpr not_assignable () noexcept
 A simple CTOR suitable for noexcept and constexpr uses.
 
 ~not_assignable () noexcept
 A simple CTOR suitable for noexcept uses.
 

Detailed Description

A container object for a process's information.

This object encapsulates information about a process, as well as being the top level item in the heirarchy of debugging information objects. Traverse the list of threads from here (get the stack traces from there) and so on.

Author
Matt Bisson
Date
5 August, 2014
Since
PSystem 2.0
Version
PSystem 2.0
Todo:
Should this be movable instead of psystem::not_assignable?

Member Typedef Documentation

using psystem::process_info::thread_info_map = std::map<thread_id_t, std::unique_ptr<thread_info> >

Mapping of thread IDs (TIDs) to the psystem::thread_info instance.

Todo:
Make private...

Constructor & Destructor Documentation

psystem::process_info::process_info ( process_id_t  pid,
CREATE_PROCESS_DEBUG_INFO const &  info 
)
noexcept

Construct a process_info instance.

Parameters
[in]pidThe system process ID (PID) of the process being examined.
[in]infoProcess-specific data to assimilate into this instance.

Member Function Documentation

bool psystem::process_info::add_thread ( std::unique_ptr< thread_info thread)
noexcept

Allow a psystem::thread_info instance to be managed by this process_info instance.

Parameters
[in]threadThe thread parameter is a std::unique_ptr value to "sink" ownership (i.e., transfer) from the caller to this instance. The parameter must not contain nullptr.
Returns
true if the thread was successfully added; false otherwise.
Todo:
This will destroy the thread instance if tid already exists!
HANDLE psystem::process_info::get_process_handle ( ) const
noexcept

Access the handle to the process for system debugging API.

Returns
A native "handle" that will remain valid for the lifetime of this process_info instance.
process_id_t psystem::process_info::get_process_id ( ) const
noexcept

The system process ID (PID) relating to this instance.

Returns
A process ID that maps directly to a running process.
void psystem::process_info::remove_thread ( thread_id_t  tid)
noexcept

Remove a thread from being managed by this process_info instance.

If the thread ID is not present in the current set of managed threads, this method does nothing.

Parameters
[in]tidThe thread's ID will be used to find and remove the psystem::thread_info instance.
Todo:
Perhaps this should return the thread...

Member Data Documentation

std::map< psystem::address_t, psystem::module_info, std::greater<psystem::address_t> > psystem::process_info::m_modules

A map of base address for a module to the module info object itself.

This is sorted by address in order from largest to smallest to facilitate quick lookup of a symbol address to the module that owns it. An address is believed to exist within a module if the module's address is the largest address that is less than the symbol address.

thread_info_map psystem::process_info::m_threads

A mapping of thread ID to the psystem::thread_info instance.

Todo:
Wrap this more sensibly w/o exposing unique_ptr.

The documentation for this class was generated from the following files: