PStack  2.0
Stack trace printer for MSVC and GCC binaries
pstack::debug_event_dumper Class Reference

As this class encounters events, it prints details to stdout. More...

#include <debug_event_dumper.hpp>

Inheritance diagram for pstack::debug_event_dumper:
Collaboration diagram for pstack::debug_event_dumper:

base_debug_event_listener Interface

virtual bool create_process_event (psystem::process_id_t pid, psystem::thread_id_t tid, psystem::shared_handle<> const &file_handle, CREATE_PROCESS_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger sends an event to indicate process creation. More...
 
virtual bool create_thread_event (psystem::process_id_t pid, psystem::thread_id_t tid, CREATE_THREAD_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger sends an event to indicate thread creation. More...
 
virtual bool exception_event (psystem::process_id_t pid, psystem::thread_id_t tid, EXCEPTION_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger sends an event to indicate some exception in normal process execution. More...
 
virtual bool exit_process_event (psystem::process_id_t pid, psystem::thread_id_t tid, EXIT_PROCESS_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger sends an event to indicate that the process has exited. More...
 
virtual bool exit_thread_event (psystem::process_id_t pid, psystem::thread_id_t tid, EXIT_THREAD_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger sends an event to indicate that a thread has exited. More...
 
virtual bool load_dll_event (psystem::process_id_t pid, psystem::thread_id_t tid, psystem::shared_handle<> const &file_handle, LOAD_DLL_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger sends an event to indicate that a DLL hase been loaded. More...
 
virtual bool output_debug_string_event (psystem::process_id_t pid, psystem::thread_id_t tid, OUTPUT_DEBUG_STRING_INFO const &info) noexcept override
 Invoked when the debugger encounters a trace message from the debuggee. More...
 
virtual bool rip_event (psystem::process_id_t pid, psystem::thread_id_t tid, RIP_INFO const &info) noexcept override
 Invoked when the debugger encounters a fatal application exit or debugger error. More...
 
virtual bool unload_dll_event (psystem::process_id_t pid, psystem::thread_id_t tid, UNLOAD_DLL_DEBUG_INFO const &info) noexcept override
 Invoked when the debugger encounters a DLL unload. More...
 

Additional Inherited Members

- Public Member Functions inherited from proclib::base_debug_event_listener
virtual ~base_debug_event_listener () noexcept
 Clean up base_debug_event_listener resources.
 
- Protected Member Functions inherited from proclib::base_debug_event_listener
 base_debug_event_listener () noexcept
 Construct the base_debug_event_listener instance. More...
 

Detailed Description

As this class encounters events, it prints details to stdout.

This class is useful for viewing the events that the debugger sees in real time. Simply create an instance of this class, and begin printing events by invoking the psystem::process_debugger::add_event_listener() method.

Author
Matt Bisson
Date
14 February, 2008 – 5 August, 2014
Since
PStack 1.2
Version
PStack 2.0
Todo:
Make the output stream a CTOR parameter.

Member Function Documentation

bool pstack::debug_event_dumper::create_process_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
psystem::shared_handle<> const &  file_handle,
CREATE_PROCESS_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger sends an event to indicate process creation.

This events is sent upon attachment to a running process, or when the debugger itself creates a process for debugging. This event is important also because it signifies that the executable module has been loaded, and that the main process thread has been created.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the thread that is currently in the active state.
[in]file_handleThe "shared" handle to the open file that represents this process's module. The handle will be closed if no listeners copy the shared_handle.
[in]infoInformation that pertains specifically to this event. Note that any handles in the structure may be nullptr, and that the hFile member is only valid until exit_process_event().
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::create_thread_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
CREATE_THREAD_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger sends an event to indicate thread creation.

This event is sent when a new thread is created during normal execution in a process being debugged, or when the debugger attaches to a process and encounters a preexisting thread of execution.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the thread that was created or discovered.
[in]infoInformation that applies specifically to this event.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::exception_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
EXCEPTION_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger sends an event to indicate some exception in normal process execution.

An exception may be an unhandled C++ exception, it may be a system-level exception (i.e., sigsegv on UNIX or GPF on Windows plaforms), or it may simply indicate that the debugger has reached a breakpoint (which may be requested either by the debugger itself, or by a user-specified break).

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the thread that is currently in the active state.
[in]infoInformation that applies specifically to this event. This will contain the exception record, which in turn contains the cause of the exception.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.
Todo:
There are also extra "parameters" that we're ignoring.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::exit_process_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
EXIT_PROCESS_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger sends an event to indicate that the process has exited.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the thread that was in the active state on exit.
[in]infoInformation that applies specifically to this event.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.
Postcondition
All handles pertaining to this process are invalid.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::exit_thread_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
EXIT_THREAD_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger sends an event to indicate that a thread has exited.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the thread that just exited.
[in]infoInformation that applies specifically to this event.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.
Postcondition
The thread handle retrieved from create_thread_event() is no longer valid.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::load_dll_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
psystem::shared_handle<> const &  file_handle,
LOAD_DLL_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger sends an event to indicate that a DLL hase been loaded.

This callback may be triggered if a DLL has been loaded into a running process, or if the debugger discovers an already loaded DLL when attaching to a process.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the thread that is currently in the active state.
[in]file_handleThe "shared" handle to the open file that represents this process's module. The handle will be closed if no listeners copy the shared_handle.
[in]infoInformation that applies specifically to this event. Note that any handles in the structure may be nullptr, and that the hFile member is only valid until unload_dll_event().
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::output_debug_string_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
OUTPUT_DEBUG_STRING_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger encounters a trace message from the debuggee.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the currently active thread.
[in]infoInformation that applies specifically to this event.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.
Todo:
Read from other process's memory...

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::rip_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
RIP_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger encounters a fatal application exit or debugger error.

Technically, this event indicates that the debugger passed invalid data to the application, however the application itself generally causes this. The debugger receives exception_event() on any potential crash from the debuggee, and if it forwards this exception to the debuggee, it may result in a crash that triggers this event.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the currently active thread.
[in]infoInformation that applies specifically to this event.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.

Reimplemented from proclib::base_debug_event_listener.

bool pstack::debug_event_dumper::unload_dll_event ( psystem::process_id_t  pid,
psystem::thread_id_t  tid,
UNLOAD_DLL_DEBUG_INFO const &  info 
)
overridevirtualnoexcept

Invoked when the debugger encounters a DLL unload.

Parameters
[in]pidThe ID of the process that signaled this event.
[in]tidThe ID of the currently active thread.
[in]infoInformation that applies specifically to this event.
Returns
This method should return true to indicate that it has taken action based on receiving the event, or false to indicate that it has not.
Postcondition
The handle retrieved from the corresponding load_dll_event() is no longer valid.

Reimplemented from proclib::base_debug_event_listener.


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