Introduce a legacy copy of GetDebugStackTraceHook API.

PiperOrigin-RevId: 852842182
Change-Id: Iadec9bb2fec60b9962a557f82ac998f3cf8d56fe
This commit is contained in:
Abseil Team
2026-01-06 10:36:37 -08:00
committed by Copybara-Service
parent 6bd8e2b51a
commit bbb342c6de
2 changed files with 11 additions and 0 deletions

View File

@@ -149,6 +149,10 @@ void RegisterDebugStackTraceHook(SymbolizeUrlEmitter hook) {
debug_stack_trace_hook = hook;
}
SymbolizeUrlEmitterLegacy GetDebugStackTraceHookLegacy() {
return debug_stack_trace_hook;
}
SymbolizeUrlEmitter GetDebugStackTraceHook() { return debug_stack_trace_hook; }
// Returns the program counter from signal context, nullptr if

View File

@@ -32,12 +32,19 @@ typedef void OutputWriter(const char*, void*);
// `hook` may be called from a signal handler.
typedef void (*SymbolizeUrlEmitter)(void* const stack[], int depth,
OutputWriter* writer, void* writer_arg);
typedef void (*SymbolizeUrlEmitterLegacy)(void* const stack[], int depth,
OutputWriter* writer,
void* writer_arg);
// Registration of SymbolizeUrlEmitter for use inside of a signal handler.
// This is inherently unsafe and must be signal safe code.
void RegisterDebugStackTraceHook(SymbolizeUrlEmitter hook);
SymbolizeUrlEmitter GetDebugStackTraceHook();
// Currently exact copy of above. Needed for the 3-CL dance due to
// TCMallocDebugStackTraceHook dependency on this API.
SymbolizeUrlEmitterLegacy GetDebugStackTraceHookLegacy();
// Returns the program counter from signal context, or nullptr if
// unknown. `vuc` is a ucontext_t*. We use void* to avoid the use of
// ucontext_t on non-POSIX systems.