absl::Symbolize

Symbolizes a program counter (instruction pointer value) pc and, on success, writes the name to out. The symbol name is demangled, if possible. Note that the symbolized name may be truncated and will be NUL-terminated. Demangling is supported for symbols generated by GCC 3.x or newer). Returns false on failure.

Synopsis

Declared in <absl/debugging/symbolize.h>

bool
Symbolize(
    void const* pc,
    char* out,
    int out_size);

Description

Example:

// Print a program counter and its symbol name. static void DumpPCAndSymbol(void *pc) { char tmp[1024]; const char *symbol = "(unknown)"; if (absl::Symbolize(pc, tmp, sizeof(tmp))) { symbol = tmp; } absl::PrintF("%p %sn", pc, symbol); }

Return Value

True on success, false if the program counter could not be symbolized.

Parameters

NameDescription
pcProgram counter (instruction pointer value) to symbolize.
outBuffer to receive the demangled symbol name.
out_sizeSize, in bytes, of the out buffer.