folly/experimental/symbolizer: symbolize inlined functions
Summary: The previous approach (D16760775) reserved space for inlined function info in each `SymbolizedFrame`. ``` struct SymbolizedFrame { Dwarf::LocationInfo location; Dwarf::LocationInfo inlineLocations[Dwarf::kMaxLocationInfoPerFrame]; ... ``` That increased the size of `SymbolizedFrame` and `FrameArray` and lead to stack overflow in some already deep stacks. ``` template <size_t N> struct FrameArray { FrameArray() {} size_t frameCount = 0; uintptr_t addresses[N]; SymbolizedFrame frames[N]; }; ``` To avoid allocate more space on stack, changed to use extra frames to store inline calls: - Usually the callers allocate `FrameArray<100>` frames, but the stack trace is usually smaller than 100 - Use the unused slots to fill in inlined function info: -- each function gets at most `kMaxLocationInfoPerFrame` (currently 3) inlined entries -- when the available buffer fills up no more inlined functions are filled in. To find the inline calling stack, we need first need to find the subprogram Debug Info Entry (with tag DW_TAG_subprogram) with the given address, then recursively find all the inline subroutines (with tag DW_TAG_inlined_subroutine) in the call stack. Sadly debug info has no index we can use for jump, and a linear search over debug info entries (and their attributes) is needed during the process, which would cause performance regression. ``` buck run mode/opt folly/experimental/symbolizer/test:dwarf_benchmark -- --benchmark ============================================================================ folly/experimental/symbolizer/test/DwarfBenchmark.cpprelative time/iter iters/s ============================================================================ DwarfFindAddressFast 4.03us 248.36K DwarfFindAddressFull 4.03us 248.18K DwarfFindAddressFullWithInline 293.23us 3.41K ============================================================================ ``` Reviewed By: luciang Differential Revision: D17586385 fbshipit-source-id: 1b84b3f3a576573ce24092b433a501a3bdf76be0
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment