PStack  2.0
Stack trace printer for MSVC and GCC binaries
debug_engine.hpp
Go to the documentation of this file.
1 // ===-- include/proclib/debug_engine.hpp ----------------- -*- C++ -*- --=== //
2 // Copyright (c) 2014 Matt Bisson. All rights reserved.
3 
18 #pragma once
19 #ifndef PROCLIB_DEBUG_ENGINE_HPP
20 #define PROCLIB_DEBUG_ENGINE_HPP
21 
22 #include "proclib_ns.hpp"
23 
24 #include <map>
25 
28 
29 namespace proclib {
30 
31 class debugger_cache;
32 class process_debugger;
33 
52  : public psystem::not_copyable
53 {
57 public:
61  using process_debuggers =
62  std::map< psystem::process_id_t, std::unique_ptr<process_debugger> >;
63 
67 public:
81  explicit debug_engine(bool kill_on_exit = false) noexcept;
82 
90 
94 public:
117 
128  void enable_debug_privilege() const;
129 
141 
161  bool wait_for_event(DWORD ms = INFINITE) const;
162 
166 private:
169 
171  bool const m_kill_on_exit;
172 };
173 
174 } // namespace proclib
175 
176 #endif // PROCLIB_DEBUG_ENGINE_HPP
process_debugger * get_process_debugger(psystem::process_id_t pid) const
Fetch a process_debugger instance.
Definition: debug_engine.cpp:103
Contains the library for debugging running processes.
Definition: base_debug_event_listener.hpp:26
debug_engine(bool kill_on_exit=false) noexcept
Construct an instance of the debug engine.
Definition: debug_engine.cpp:36
Defines the psystem::not_assignable interface.
bool wait_for_event(DWORD ms=INFINITE) const
Block the current thread until any debugger sees an event.
Definition: debug_engine.cpp:115
#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
std::map< psystem::process_id_t, std::unique_ptr< process_debugger > > process_debuggers
Container for process_debuggers.
Definition: debug_engine.hpp:62
void enable_debug_privilege() const
Allows the current process to debug other processes.
Definition: debug_engine.cpp:71
Debugging facility for an individual process.
Definition: process_debugger.hpp:49
Contains the process examination "system" and basic frameworks.
Definition: pstack_event_handler.hpp:28
process_debugger & attach_to_process(psystem::process_id_t pid)
Attach a debugger to a running process using the process ID (PID).
Definition: debug_engine.cpp:52
bool const m_kill_on_exit
Was the debug_engine asked to kill attached processes on detach?
Definition: debug_engine.hpp:171
The basic header file for the ProcLib namespce.
A management interface for debugging applications.
Definition: debug_engine.hpp:51
process_debuggers m_debuggers
A set of attached debuggers indexed by process ID (PID)
Definition: debug_engine.hpp:168
Wraps the C++ standard header, memory, to provide a uniform interface.