- if (!findDebugInfoOffset(address, aranges_, offset)) {
- // NOTE: clang doesn't generate entries in .debug_aranges for
- // some functions, but always generates .debug_info entries.
- // We could read them from .debug_info but that's too slow.
- // If .debug_aranges is present fast address lookup is assumed.
+ if (findDebugInfoOffset(address, aranges_, offset)) {
+ // Read compilation unit header from .debug_info
+ folly::StringPiece infoEntry(info_);
+ infoEntry.advance(offset);
+ findLocation(address, infoEntry, locationInfo);
+ return locationInfo.hasFileAndLine;
+ } else if (mode == LocationInfoMode::FAST) {
+ // NOTE: Clang (when using -gdwarf-aranges) doesn't generate entries
+ // in .debug_aranges for some functions, but always generates
+ // .debug_info entries. Scanning .debug_info is slow, so fall back to
+ // it only if such behavior is requested via LocationInfoMode.