libcsdbg
1.28
C++ exception (and generic) stack trace debug library
|
A tracer object is the default interface to libcsdbg for the instrumentation functions and for the library user. More...
#include <tracer.hpp>
Public Member Functions | |
virtual process * | proc () const |
Get the process handle. More... | |
virtual tracer & | trace (string &) |
Create an exception stack trace using the simulated call stack of the current thread. The trace is appended to a string and the simulated stack is unwinded. More... | |
virtual tracer & | trace (string &, pthread_t) const |
Create the stack trace of a thread indexed by its ID and append it to a string. More... | |
virtual tracer & | unwind () |
Unwind the simulated call stack of the current thread. More... | |
virtual tracer & | dump (string &) const |
Create multiple stack traces using the simulated call stack of each thread. The traces are appended to a string. The stacks are not unwinded. More... | |
virtual u32 | plugin_count () const |
Get the number of registered plugins. More... | |
virtual const plugin * | add_plugin (const i8 *, const i8 *=NULL) |
Register a plugin module (DSO) More... | |
virtual const plugin * | add_plugin (modsym_t, modsym_t) |
Register a plugin. More... | |
virtual tracer & | remove_plugin (const i8 *) |
Unregister a plugin module (DSO) More... | |
virtual tracer & | remove_plugin (u32) |
Unregister a plugin. More... | |
virtual const plugin * | get_plugin (const i8 *) const |
Get a registered plugin module (DSO) More... | |
virtual const plugin * | get_plugin (u32) const |
Get a registered plugin. More... | |
virtual u32 | filter_count () const |
Get the number of registered filters. More... | |
virtual filter * | add_filter (const i8 *, bool, bool=true) |
Register a filter. More... | |
virtual tracer & | remove_filter (u32) |
Unregister a filter. More... | |
virtual filter * | get_filter (u32) const |
Get a registered filter. More... | |
Public Member Functions inherited from csdbg::object | |
virtual | ~object ()=0 |
To be implemented. More... | |
virtual const i8 * | class_name () const |
Query the class name of an object descending from csdbg::object. More... | |
Static Public Member Functions | |
static tracer * | interface () |
Get the interface object. More... | |
Protected Member Functions | |
tracer () | |
Object default constructor. More... | |
tracer (const tracer &) | |
Object copy constructor. More... | |
virtual | ~tracer () |
Object destructor. More... | |
virtual tracer * | clone () const |
Object virtual copy constructor. More... | |
virtual tracer & | operator= (const tracer &) |
Assignment operator. More... | |
virtual tracer & | destroy () |
Release object resources. More... | |
Static Protected Member Functions | |
static void | on_lib_load () __attribute((constructor)) |
Library constructor. More... | |
static void | on_lib_unload () __attribute((destructor)) |
Library destructor. More... | |
static i32 | on_dso_load (dl_phdr_info *, size_t, void *) |
This is a dl_iterate_phdr (libdl) callback, called for each linked shared object. It loads the symbol table of the DSO (if it's not filtered out) to tracer::m_iface->m_proc. More... | |
static string & | addr2line (string &, const i8 *, mem_addr_t) |
Given an address in an objective code file, extract from the gdb-related debug information, the equivalent source code file name and line and append it to a string buffer. More... | |
Protected Attributes | |
process * | m_proc |
Process handle. More... | |
chain< plugin > * | m_plugins |
Instrumentation plugins. More... | |
chain< filter > * | m_filters |
Instrumentation filters. More... | |
Static Protected Attributes | |
static tracer * | m_iface = NULL |
Interface object. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &, tracer &) |
Stream insertion operator for csdbg::tracer objects. More... | |
A tracer object is the default interface to libcsdbg for the instrumentation functions and for the library user.
The public interface of the class is used by the instrumentation functions to create a call stack simulation for each executing thread. The library user can use the interface to produce and output traces for exceptions or for threads. The constructors of the class are protected so there is no way for the library user to instantiate a tracer object. The library constructor (on_lib_load) creates a global static tracer object to be used as interface to the library facilities. All public methods are thread safe
Definition at line 34 of file tracer.hpp.