Update *SymbolizeURL APIs to add crash_pc parameter.
PiperOrigin-RevId: 855335009
Change-Id: I1632c5a89e91b857dc18ff9434abf22c3f622d8f
diff --git a/absl/debugging/internal/examine_stack.cc b/absl/debugging/internal/examine_stack.cc
index cc24ebd..9a47f19 100644
--- a/absl/debugging/internal/examine_stack.cc
+++ b/absl/debugging/internal/examine_stack.cc
@@ -143,6 +143,12 @@
writer(buf, writer_arg);
}
+void DebugStackTraceHookLegacyAdapter(void* const stack[], int depth,
+ OutputWriter* writer, void* writer_arg) {
+ debug_stack_trace_hook(stack, depth, /*crash_pc=*/nullptr, writer,
+ writer_arg);
+}
+
} // namespace
void RegisterDebugStackTraceHook(SymbolizeUrlEmitter hook) {
@@ -150,7 +156,11 @@
}
SymbolizeUrlEmitterLegacy GetDebugStackTraceHookLegacy() {
- return debug_stack_trace_hook;
+ if (debug_stack_trace_hook == nullptr) {
+ // No prior call to RegisterDebugStackTraceHook.
+ return nullptr;
+ }
+ return &DebugStackTraceHookLegacyAdapter;
}
SymbolizeUrlEmitter GetDebugStackTraceHook() { return debug_stack_trace_hook; }
@@ -313,7 +323,7 @@
auto hook = GetDebugStackTraceHook();
if (hook != nullptr) {
- (*hook)(stack, depth, writer, writer_arg);
+ hook(stack, depth, /*crash_pc=*/nullptr, writer, writer_arg);
}
if (allocated_bytes != 0) Deallocate(stack, allocated_bytes);
diff --git a/absl/debugging/internal/examine_stack.h b/absl/debugging/internal/examine_stack.h
index 2094d62..eca430f 100644
--- a/absl/debugging/internal/examine_stack.h
+++ b/absl/debugging/internal/examine_stack.h
@@ -31,7 +31,8 @@
// `hook` that is called each time DumpStackTrace() is called.
// `hook` may be called from a signal handler.
typedef void (*SymbolizeUrlEmitter)(void* const stack[], int depth,
- OutputWriter* writer, void* writer_arg);
+ const void* crash_pc, OutputWriter* writer,
+ void* writer_arg);
typedef void (*SymbolizeUrlEmitterLegacy)(void* const stack[], int depth,
OutputWriter* writer,
void* writer_arg);
@@ -41,8 +42,6 @@
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