The Gaudi Framework  v29r0 (ff2e7097)
IgHookTrace Class Reference

#include <src/component/IgHook_IgHookTrace.h>

Collaboration diagram for IgHookTrace:

Classes

struct  Counter
 Nearly dummy object type to identify a counter. More...
 
class  CounterValue
 Value for a counter chained from a trace. More...
 

Public Member Functions

void * operator new (size_t n, IgHookTraceAlloc *alloc=0)
 
 IgHookTrace (IgHookTrace *parent=0, void *address=0)
 
IgHookTraceparent (void)
 
IgHookTracenext (void)
 
void * address (void)
 
bool symbol (const char *&sym, const char *&lib, int &offset, int &liboffset)
 
IgHookTracechildren (void)
 
IgHookTracechild (void *address)
 
CounterValuecounters (void)
 
CounterValuecounter (Counter *id)
 
void merge (IgHookTrace *other)
 

Static Public Member Functions

static int stacktrace (void **addresses, int nmax)
 
static void * tosymbol (void *address)
 
static bool symbol (void *address, const char *&sym, const char *&lib, int &offset, int &liboffset)
 

Private Attributes

IgHookTraceAllocm_alloc
 
IgHookTracem_parent
 
IgHookTracem_next
 
IgHookTracem_children
 
void * m_address
 
CounterValuem_counters
 

Detailed Description

Definition at line 28 of file IgHook_IgHookTrace.h.

Constructor & Destructor Documentation

IgHookTrace::IgHookTrace ( IgHookTrace parent = 0,
void *  address = 0 
)

Definition at line 209 of file IgHook_IgHookTrace.cpp.

210  : m_alloc( parent ? parent->m_alloc : new IgHookTraceAlloc )
211  , m_parent( parent )
212  , m_next( parent ? parent->m_children : 0 )
213  , m_children( 0 )
214  , m_address( address )
215  , m_counters( 0 )
216 {
217  if ( m_parent ) m_parent->m_children = this;
218 }
IgHookTrace * m_children
IgHookTrace * m_parent
void * address(void)
IgHookTrace * m_next
CounterValue * m_counters
IgHookTraceAlloc * m_alloc

Member Function Documentation

void * IgHookTrace::address ( void  )

Definition at line 224 of file IgHook_IgHookTrace.cpp.

224 { return m_address; }
IgHookTrace* IgHookTrace::child ( void *  address)
IgHookTrace* IgHookTrace::children ( void  )
CounterValue* IgHookTrace::counter ( Counter id)
CounterValue* IgHookTrace::counters ( void  )
void IgHookTrace::merge ( IgHookTrace other)
IgHookTrace * IgHookTrace::next ( void  )

Definition at line 222 of file IgHook_IgHookTrace.cpp.

222 { return m_next; }
IgHookTrace * m_next
void * IgHookTrace::operator new ( size_t  n,
IgHookTraceAlloc alloc = 0 
)

Definition at line 204 of file IgHook_IgHookTrace.cpp.

205 {
206  return alloc ? alloc->allocate( n ) : ::operator new( n );
207 }
void * allocate(size_t bytes)
IgHookTrace * IgHookTrace::parent ( void  )

Definition at line 220 of file IgHook_IgHookTrace.cpp.

220 { return m_parent; }
IgHookTrace * m_parent
static int IgHookTrace::stacktrace ( void **  addresses,
int  nmax 
)
static
bool IgHookTrace::symbol ( void *  address,
const char *&  sym,
const char *&  lib,
int &  offset,
int &  liboffset 
)
static

Definition at line 226 of file IgHook_IgHookTrace.cpp.

227 {
228  sym = lib = 0;
229  offset = 0;
230  liboffset = (unsigned long)address;
231 
232  Dl_info info;
233  if ( dladdr( address, &info ) ) {
234  if ( info.dli_fname && info.dli_fname[0] ) lib = info.dli_fname;
235 
236  if ( info.dli_fbase ) liboffset = (unsigned long)address - (unsigned long)info.dli_fbase;
237 
238  if ( info.dli_saddr ) offset = (unsigned long)address - (unsigned long)info.dli_saddr;
239 
240  if ( info.dli_sname && info.dli_sname[0] ) sym = info.dli_sname;
241 
242  return true;
243  }
244 
245  return false;
246 }
void * address(void)
bool IgHookTrace::symbol ( const char *&  sym,
const char *&  lib,
int &  offset,
int &  liboffset 
)

Definition at line 248 of file IgHook_IgHookTrace.cpp.

249 {
250  return symbol( m_address, sym, lib, offset, liboffset );
251 }
static bool symbol(void *address, const char *&sym, const char *&lib, int &offset, int &liboffset)
void * IgHookTrace::tosymbol ( void *  address)
static

Definition at line 253 of file IgHook_IgHookTrace.cpp.

254 {
255  Dl_info info;
256  return ( dladdr( address, &info ) && info.dli_fname && info.dli_fname[0] && info.dli_saddr ) ? info.dli_saddr
257  : address;
258 }
void * address(void)

Member Data Documentation

void* IgHookTrace::m_address
private

Definition at line 97 of file IgHook_IgHookTrace.h.

IgHookTraceAlloc* IgHookTrace::m_alloc
private

Definition at line 93 of file IgHook_IgHookTrace.h.

IgHookTrace* IgHookTrace::m_children
private

Definition at line 96 of file IgHook_IgHookTrace.h.

CounterValue* IgHookTrace::m_counters
private

Definition at line 98 of file IgHook_IgHookTrace.h.

IgHookTrace* IgHookTrace::m_next
private

Definition at line 95 of file IgHook_IgHookTrace.h.

IgHookTrace* IgHookTrace::m_parent
private

Definition at line 94 of file IgHook_IgHookTrace.h.


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