libcsdbg  1.28
C++ exception (and generic) stack trace debug library
tracer & csdbg::tracer::dump ( string dst) 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.

[in]dstthe destination string

Definition at line 806 of file tracer.cpp.

References csdbg::string::append(), csdbg::process::get_thread(), csdbg::thread::handle(), likely, csdbg::util::lock(), m_proc, csdbg::process::thread_count(), trace(), and csdbg::util::unlock().

807 {
808  try {
809  util::lock();
811  for (u32 i = 0, sz = m_proc->thread_count(); likely(i < sz); i++) {
812  thread *thr = m_proc->get_thread(i);
813  trace(dst, thr->handle());
815  if ( likely(i < sz - 1) )
816  dst.append("\r\n");
817  }
819  util::unlock();
820  return const_cast<tracer&> (*this);
821  }
823  catch (...) {
824  util::unlock();
825  throw;
826  }
827 }
virtual u32 thread_count() const
Get the active thread count.
Definition: process.cpp:321
virtual thread * get_thread(pthread_t) const
Get a thread by ID.
Definition: process.cpp:376
process * m_proc
Process handle.
Definition: tracer.hpp:45
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
static void lock()
Lock the global access mutex.
Definition: util.cpp:397
static void unlock()
Unlock the global access mutex.
Definition: util.cpp:406
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.
Definition: tracer.cpp:658
Object default constructor.
Definition: tracer.cpp:454
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102

+ Here is the call graph for this function: