// DWARF record parser
-#ifndef FOLLY_EXPERIMENTAL_SYMBOLIZER_DWARF_H_
-#define FOLLY_EXPERIMENTAL_SYMBOLIZER_DWARF_H_
+#pragma once
#include <boost/variant.hpp>
folly::StringPiece file_;
};
- struct LocationInfo {
- LocationInfo() : hasMainFile(false), hasFileAndLine(false), line(0) { }
+ enum class LocationInfoMode {
+ // Don't resolve location info.
+ DISABLED,
+ // Perform CU lookup using .debug_aranges (might be incomplete).
+ FAST,
+ // Scan all CU in .debug_info (slow!) on .debug_aranges lookup failure.
+ FULL,
+ };
- bool hasMainFile;
+ struct LocationInfo {
+ bool hasMainFile = false;
Path mainFile;
- bool hasFileAndLine;
+ bool hasFileAndLine = false;
Path file;
- uint64_t line;
+ uint64_t line = 0;
};
- /** Find the file and line number information corresponding to address */
- bool findAddress(uintptr_t address, LocationInfo& info) const;
+ /**
+ * Find the file and line number information corresponding to address.
+ */
+ bool findAddress(uintptr_t address,
+ LocationInfo& info,
+ LocationInfoMode mode) const;
private:
+ static bool findDebugInfoOffset(uintptr_t address,
+ StringPiece aranges,
+ uint64_t& offset);
+
void init();
+ bool findLocation(uintptr_t address,
+ StringPiece& infoEntry,
+ LocationInfo& info) const;
const ElfFile* elf_;
} // namespace symbolizer
} // namespace folly
-
-#endif /* FOLLY_EXPERIMENTAL_SYMBOLIZER_DWARF_H_ */