libcsdbg  1.28
C++ exception (and generic) stack trace debug library
csdbg::tracer Class Reference

A tracer object is the default interface to libcsdbg for the instrumentation functions and for the library user. More...

#include <tracer.hpp>

+ Inheritance diagram for csdbg::tracer:
+ Collaboration diagram for csdbg::tracer:

Public Member Functions

virtual processproc () const
 Get the process handle. More...
 
virtual tracertrace (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 tracertrace (string &, pthread_t) const
 Create the stack trace of a thread indexed by its ID and append it to a string. More...
 
virtual tracerunwind ()
 Unwind the simulated call stack of the current thread. More...
 
virtual tracerdump (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 pluginadd_plugin (const i8 *, const i8 *=NULL)
 Register a plugin module (DSO) More...
 
virtual const pluginadd_plugin (modsym_t, modsym_t)
 Register a plugin. More...
 
virtual tracerremove_plugin (const i8 *)
 Unregister a plugin module (DSO) More...
 
virtual tracerremove_plugin (u32)
 Unregister a plugin. More...
 
virtual const pluginget_plugin (const i8 *) const
 Get a registered plugin module (DSO) More...
 
virtual const pluginget_plugin (u32) const
 Get a registered plugin. More...
 
virtual u32 filter_count () const
 Get the number of registered filters. More...
 
virtual filteradd_filter (const i8 *, bool, bool=true)
 Register a filter. More...
 
virtual tracerremove_filter (u32)
 Unregister a filter. More...
 
virtual filterget_filter (u32) const
 Get a registered filter. More...
 
- Public Member Functions inherited from csdbg::object
virtual ~object ()=0
 To be implemented. More...
 
virtual const i8class_name () const
 Query the class name of an object descending from csdbg::object. More...
 

Static Public Member Functions

static tracerinterface ()
 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 tracerclone () const
 Object virtual copy constructor. More...
 
virtual traceroperator= (const tracer &)
 Assignment operator. More...
 
virtual tracerdestroy ()
 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 stringaddr2line (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

processm_proc
 Process handle. More...
 
chain< plugin > * m_plugins
 Instrumentation plugins. More...
 
chain< filter > * m_filters
 Instrumentation filters. More...
 

Static Protected Attributes

static tracerm_iface = NULL
 Interface object. More...
 

Friends

std::ostream & operator<< (std::ostream &, tracer &)
 Stream insertion operator for csdbg::tracer objects. More...
 

Detailed Description

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.


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