From 126e2bbb072a90e0de2f4e36437c1304121bb698 Mon Sep 17 00:00:00 2001 From: Rafael Auler Date: Mon, 18 Nov 2024 17:00:57 -0800 Subject: [PATCH] folly symbolizer support for ROAR symbols Summary: If folly is built under ROAR and the symbol has not been identified, it is possible this symbol is in a JIT arena. Call the JIT asking to symbolize that address. Reviewed By: Gownta Differential Revision: D65977988 fbshipit-source-id: e419447db796e362b179903f03d62efcaadaba1b --- folly/debugging/symbolizer/Symbolizer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/folly/debugging/symbolizer/Symbolizer.cpp b/folly/debugging/symbolizer/Symbolizer.cpp index 19345bcd2c5..81235aefd8a 100644 --- a/folly/debugging/symbolizer/Symbolizer.cpp +++ b/folly/debugging/symbolizer/Symbolizer.cpp @@ -54,6 +54,10 @@ #include #endif +#ifdef __roar__ +extern "C" char* _roar_upcall_symbolizeAddress(void* Address); +#endif + namespace folly { namespace symbolizer { @@ -110,6 +114,14 @@ void setSymbolizedFrame( frame.addr = address; frame.file = file; frame.name = file->getSymbolName(file->getDefinitionByAddress(address)); +#ifdef __roar__ + if (!frame.name) { + char* jit_name = + _roar_upcall_symbolizeAddress(reinterpret_cast(address)); + if (jit_name && jit_name[0] != '\0') + frame.name = jit_name; + } +#endif Dwarf(elfCache, file.get()) .findAddress(address, mode, frame, extraInlineFrames);