|
Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
|
Portable symbol resolution for error trace printing. More...
#include <stddef.h>Go to the source code of this file.
Macros | |
| #define | SRN_DBG_SYM_WIN32 0 |
Functions | |
| const char * | srn_dbg_sym_name (void *addr, char *buf, size_t buflen) |
| Resolve addr to a symbol name and write it into buf (null-terminated, at most buflen bytes including the terminator). | |
Portable symbol resolution for error trace printing.
Given a return address captured by __builtin_return_address(0), srn_dbg_sym_name writes the nearest symbol name into a caller-supplied buffer. On POSIX it uses dladdr; on Windows it uses SymFromAddr from DbgHelp.
Resolution is best-effort: when the binary is stripped or the platform has no debug info, the buffer is left empty and the function returns null. Raw addresses are still useful; the caller can pass them to llvm-symbolizer offline.
Definition in file srn_dbg_sym.h.
| #define SRN_DBG_SYM_WIN32 0 |
Definition at line 40 of file srn_dbg_sym.h.
|
extern |
Resolve addr to a symbol name and write it into buf (null-terminated, at most buflen bytes including the terminator).
Returns buf on success, nullptr when resolution fails or buflen is zero.
Definition at line 26 of file srn_dbg_sym.c.