PStack  2.0
Stack trace printer for MSVC and GCC binaries
process_debugger.hpp
Go to the documentation of this file.
1 // ===-- include/proclib/process_debugger.hpp ------------- -*- C++ -*- --=== //
2 // Copyright (c) 2014 Matt Bisson. All rights reserved.
3 
18 #pragma once
19 #ifndef PROCLIB_PROCESS_DEBUGGER_HPP
20 #define PROCLIB_PROCESS_DEBUGGER_HPP
21 
22 #include "proclib_ns.hpp"
23 
26 
27 namespace proclib {
28 
29 class base_debug_event_listener;
30 
51 {
55 public:
57  using event_listener_id_t = int32_t;
58 
62 
66 public:
78 
93 
97 public:
109 
115 
119 public:
143  std::shared_ptr<base_debug_event_listener> const& l);
144 
163 
183  void set_kill_process_on_exit(bool kill_on_exit);
184 
188 private:
191 
192  // PImpl pattern (somewhat) -- make a pointer to the data that will be used
193  // for real work so we can forward declare it and avoid a direct header
194  // dependency.
196 
201  std::unique_ptr<dispatching_event_listener> const m_events;
202 };
203 
204 } // namespace proclib
205 
206 #endif // PROCLIB_PROCESS_DEBUGGER_HPP
Contains the library for debugging running processes.
Definition: base_debug_event_listener.hpp:26
event_listener_id_t add_event_listener(std::shared_ptr< base_debug_event_listener > const &l)
Add a listener for debugger events sent to this process.
Definition: process_debugger.cpp:222
process_debugger(psystem::process_id_t pid)
Create an instance of the debugger with a given process ID.
Definition: process_debugger.cpp:175
bool remove_event_listener(event_listener_id_t id)
Remove an already registered event listener.
Definition: process_debugger.cpp:233
std::unique_ptr< dispatching_event_listener > const m_events
Debug events will be passed here, and forwarded to added custom versions of the listeners.
Definition: process_debugger.hpp:195
Defines the psystem::not_assignable interface.
psystem::process_id_t get_process_id() const noexcept
Get the ID of the process being debugged here.
Definition: process_debugger.cpp:216
Definition: shared_handle.hpp:782
#define noexcept
Replace keyword with something useful.
Definition: platform.hpp:71
Remove the ability to copy or reassign from derived classes.
Definition: not_copyable.hpp:43
DWORD process_id_t
Data-type that stores a process ID (PID).
Definition: platform.hpp:241
The implementation class for passing debugger events to registered listeners.
Definition: process_debugger.cpp:47
void set_kill_process_on_exit(bool kill_on_exit)
Determine the fate of a process after the debugger detaches.
Definition: process_debugger.cpp:240
int32_t event_listener_id_t
An unique ID for events registered with add_event_listener()
Definition: process_debugger.hpp:57
Debugging facility for an individual process.
Definition: process_debugger.hpp:49
A polymorphic interface for detecting events received by the debugger.
Definition: base_debug_event_listener.hpp:44
static constexpr event_listener_id_t invalid_event_listener_id
Indicates that the value stored in a process_debugger::event_listener_id_t is not valid...
Definition: process_debugger.hpp:61
Contains the process examination "system" and basic frameworks.
Definition: pstack_event_handler.hpp:28
#define constexpr
Replace keyword with something useful.
Definition: platform.hpp:70
~process_debugger()
Detach the debugger from the process.
Definition: process_debugger.cpp:186
base_debug_event_listener & get_events() const noexcept
Access the main event handler for this process.
Definition: process_debugger.cpp:209
The basic header file for the ProcLib namespce.
Wraps the C++ standard header, memory, to provide a uniform interface.
psystem::process_id_t const m_process_id
The Process ID (PID) of the process debugged by this instance.
Definition: process_debugger.hpp:190