libcsdbg  1.28
C++ exception (and generic) stack trace debug library
thread & csdbg::thread::called ( mem_addr_t  addr,
mem_addr_t  site,
const i8 nm 
)
virtual

Simulate a function call.

Parameters
[in]addrthe function address
[in]sitethe call site address
[in]nmthe function name
Returns
*this
Exceptions
std::bad_alloc

Definition at line 230 of file thread.cpp.

References __D_ASSERT, m_lag, m_stack, and unlikely.

Referenced by csdbg::__cyg_profile_func_enter().

231 {
232  /*
233  * If the function is called while an exception is unwinding the stack, keep
234  * track of the call depth difference between the simulated and the real call
235  * stack (the 'lag')
236  */
237  if ( unlikely(std::uncaught_exception()) ) {
238  m_lag--;
239  return *this;
240  }
241 
242  call *c = NULL;
243  try {
244  __D_ASSERT(nm != NULL);
245  c = new call(addr, site, nm);
246  m_stack->push(c);
247  return *this;
248  }
249 
250  catch (...) {
251  delete c;
252  throw;
253  }
254 }
stack< call > * m_stack
Simulated call stack.
Definition: thread.hpp:37
i32 m_lag
The number of calls that must be popped off the simulated stack for it to match the real one...
Definition: thread.hpp:39
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349
#define __D_ASSERT(x)
Assertion macro.
Definition: config.hpp:268

+ Here is the caller graph for this function: