PStack  2.0
Stack trace printer for MSVC and GCC binaries
process_info.hpp
Go to the documentation of this file.
1 // ===-- include/psystem/process_info.hpp ----------------- -*- C++ -*- --=== //
2 // Copyright (c) 2014 Matt Bisson. All rights reserved.
3 
18 #pragma once
19 #ifndef PSYSTEM_PROCESS_INFO_HPP
20 #define PSYSTEM_PROCESS_INFO_HPP
21 
22 #include "psystem_ns.hpp"
23 
24 #include <functional>
25 #include <map>
26 
29 
30 #include <psystem/module_info.hpp>
31 
32 namespace psystem {
33 
34 class thread_info;
35 
52 {
56 public:
61  using thread_info_map = std::map<thread_id_t, std::unique_ptr<thread_info> >;
62 
66 public:
74  process_id_t pid,
75  CREATE_PROCESS_DEBUG_INFO const& info) noexcept;
76 
79 
83 public:
90  HANDLE get_process_handle() const noexcept;
91 
96  process_id_t get_process_id() const noexcept;
97 
101 public:
112  bool add_thread(std::unique_ptr<thread_info> thread) noexcept;
113 
125  void remove_thread(thread_id_t tid) noexcept;
126 
130 public:
140  std::map<
143  std::greater<psystem::address_t> > m_modules;
144 
148 
149 private:
152 
155 };
156 
157 } // namespace psystem
158 
159 #endif // PSYSTEM_PROCESS_INFO_HPP
process_info(process_id_t pid, CREATE_PROCESS_DEBUG_INFO const &info) noexcept
Construct a process_info instance.
Definition: process_info.cpp:95
Defines the psystem::not_assignable interface.
thread_info_map m_threads
A mapping of thread ID to the psystem::thread_info instance.
Definition: process_info.hpp:147
Contains information about an executable image or shared library.
Definition: module_info.hpp:48
bool add_thread(std::unique_ptr< thread_info > thread) noexcept
Allow a psystem::thread_info instance to be managed by this process_info instance.
Definition: process_info.cpp:127
void remove_thread(thread_id_t tid) noexcept
Remove a thread from being managed by this process_info instance.
Definition: process_info.cpp:139
Definition: shared_handle.hpp:782
A container for a single thread of execution in a process.
Definition: thread_info.hpp:51
#define noexcept
Replace keyword with something useful.
Definition: platform.hpp:71
Removes the ability to use an assignment operation on derived classes.
Definition: not_assignable.hpp:42
std::uintptr_t address_t
Container type for a memory address.
Definition: platform.hpp:221
process_id_t get_process_id() const noexcept
The system process ID (PID) relating to this instance.
Definition: process_info.cpp:117
DWORD process_id_t
Data-type that stores a process ID (PID).
Definition: platform.hpp:241
A container object for a process's information.
Definition: process_info.hpp:50
Declare a container for process and shared-library module information.
The basic header file for the PSystem namespce.
std::map< thread_id_t, std::unique_ptr< thread_info > > thread_info_map
Mapping of thread IDs (TIDs) to the psystem::thread_info instance.
Definition: process_info.hpp:61
Contains the process examination "system" and basic frameworks.
Definition: pstack_event_handler.hpp:28
HANDLE m_process_handle
A system handle for debug API to access this process.
Definition: process_info.hpp:154
~process_info() noexcept
Free resources from the process_info instance.
Definition: process_info.cpp:102
process_id_t const m_process_id
The system ID the corresponds to the process encapsulated here.
Definition: process_info.hpp:151
Information logging as well as error.
HANDLE get_process_handle() const noexcept
Access the handle to the process for system debugging API.
Definition: process_info.cpp:111
Wraps the C++ standard header, memory, to provide a uniform interface.
DWORD thread_id_t
Data-type that stores a thread ID (TID).
Definition: platform.hpp:247
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.
Definition: process_info.hpp:143