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.
- Parameters
-
[in] | dst | the destination string |
- Returns
- *this
- Exceptions
-
- Attention
- The simulated call stack is unwinded even if the method fails, in any way to produce a trace
Definition at line 658 of file tracer.cpp.
References csdbg::symbol::addr(), addr2line(), csdbg::string::append(), csdbg::thread::backtrace(), csdbg::process::current_thread(), csdbg::thread::handle(), csdbg::process::ilookup(), csdbg::thread::lag(), likely, csdbg::util::lock(), m_proc, csdbg::symbol::name(), csdbg::thread::name(), csdbg::call::site(), csdbg::util::unlock(), csdbg::thread::unwind(), and unwind().
Referenced by dump(), and csdbg::operator<<().
665 const i8 *nm = thr->name();
668 dst.append(
"at %s thread (0x%lx) {\r\n", nm, thr->handle());
671 for (
i32 i = thr->lag();
likely(i >= 0); i--) {
672 const call *cur = thr->backtrace(i);
673 dst.append(
" at %s", cur->name());
677 if (
likely (prev < thr->call_depth()) ) {
678 const call *caller = thr->backtrace(prev);
682 addr2line(dst, path, cur->site() - base);
virtual string & append(const string &)
Append a string.
char i8
8-bit signed integer
process * m_proc
Process handle.
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
static void lock()
Lock the global access mutex.
static void unlock()
Unlock the global access mutex.
virtual tracer & unwind()
Unwind the simulated call stack of the current thread.
unsigned int u32
32-bit unsigned integer
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.
int i32
32-bit signed integer
virtual const i8 * ilookup(mem_addr_t, mem_addr_t &) const
Inverse lookup. Find the module (executable or DSO library) that defines a symbol and return its path...
unsigned long long mem_addr_t
64-bit memory address
virtual thread * current_thread()
Get the currently executing thread.