#include "precompiled.h"
#include "lib/sysdep/sysdep.h"
#include "lib/debug.h"
#include <execinfo.h>
Go to the source code of this file.
Status debug_DumpStack |
( |
wchar_t * |
buf, |
|
|
size_t |
maxChars, |
|
|
void * |
context, |
|
|
const wchar_t * |
lastFuncToSkip |
|
) |
| |
write a complete stack trace (including values of local variables) into the specified buffer.
- Parameters
-
buf | Target buffer. |
maxChars | Max chars of buffer (should be several thousand). |
context | Platform-specific representation of execution state (e.g. Win32 CONTEXT). either specify an SEH exception's context record or use debug_CaptureContext to retrieve the current state. Rationale: intermediates such as debug_DisplayError change the context, so it should be captured as soon as possible. |
lastFuncToSkip | Is used for omitting error-reporting functions like debug_OnAssertionFailure from the stack trace. It is either 0 (skip nothing) or a substring of a function's name (this allows platform-independent matching of stdcall-decorated names). Rationale: this is safer than specifying a fixed number of frames, which can be incorrect due to inlining. |
- Returns
- Status; ERR::REENTERED if reentered via recursion or multithreading (not allowed since static data is used).
Definition at line 52 of file bdbg.cpp.
void* debug_GetCaller |
( |
void * |
context, |
|
|
const wchar_t * |
lastFuncToSkip |
|
) |
| |
return the caller of a certain function on the call stack.
this function is useful for recording (partial) stack traces for memory allocation tracking, etc.
- Parameters
-
context,lastFuncToSkip | - see debug_DumpStack |
- Returns
- address of the caller
Definition at line 38 of file bdbg.cpp.
Status debug_ResolveSymbol |
( |
void * |
ptr_of_interest, |
|
|
wchar_t * |
sym_name, |
|
|
wchar_t * |
file, |
|
|
int * |
line |
|
) |
| |
read and return symbol information for the given address.
NOTE: the PDB implementation is rather slow (~500 us).
- Parameters
-
ptr_of_interest | address of symbol (e.g. function, variable) |
sym_name | optional out; holds at least DEBUG_SYMBOL_CHARS; receives symbol name returned via debug info. |
file | optional out; holds at least DEBUG_FILE_CHARS; receives base name only (no path; see rationale in wdbg_sym) of source file containing the symbol. |
line | optional out; receives source file line number of symbol. |
note: all of the output parameters are optional; we pass back as much information as is available and desired.
- Returns
- Status; INFO::OK iff any information was successfully retrieved and stored.
Definition at line 99 of file bdbg.cpp.
void debug_SetThreadName |
( |
const char * |
name | ) |
|
inform the debugger of the current thread's name.
(threads are easier to keep apart when they are identified by name rather than TID.)
Definition at line 126 of file bdbg.cpp.