aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/GSYM/LineTable.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@fb.com>2019-12-03 16:44:02 -0800
committerGreg Clayton <gclayton@fb.com>2019-12-05 16:49:53 -0800
commitaeda128a96c4ac9eecef7563f4cf07dfcd2af0db (patch)
tree2452f0050027c3a641fee592fdfa16b0bfc9e9fc /llvm/lib/DebugInfo/GSYM/LineTable.cpp
parent6470497817eafe3fe2d15e11ade78fd99753d7ca (diff)
downloadllvm-aeda128a96c4ac9eecef7563f4cf07dfcd2af0db.zip
llvm-aeda128a96c4ac9eecef7563f4cf07dfcd2af0db.tar.gz
llvm-aeda128a96c4ac9eecef7563f4cf07dfcd2af0db.tar.bz2
Add lookup functions for efficient lookups of addresses when using GsymReader classes.
Summary: Lookup functions are designed to not fully decode a FunctionInfo, LineTable or InlineInfo, they decode only what is needed into a LookupResult object. This allows lookups to avoid costly memory allocations and avoid parsing large amounts of information one a suitable match is found. LookupResult objects contain the address that was looked up, the concrete function address range, the name of the concrete function, and a list of source locations. One for each inline function, and one for the concrete function. This allows one address to turn into multiple frames and improves the signal you get when symbolicating addresses in GSYM files. Reviewers: labath, aprantl Subscribers: mgorny, hiraditya, llvm-commits, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70993
Diffstat (limited to 'llvm/lib/DebugInfo/GSYM/LineTable.cpp')
-rw-r--r--llvm/lib/DebugInfo/GSYM/LineTable.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/GSYM/LineTable.cpp b/llvm/lib/DebugInfo/GSYM/LineTable.cpp
index 824c004..a49a3ba 100644
--- a/llvm/lib/DebugInfo/GSYM/LineTable.cpp
+++ b/llvm/lib/DebugInfo/GSYM/LineTable.cpp
@@ -262,8 +262,8 @@ llvm::Expected<LineTable> LineTable::decode(DataExtractor &Data,
// Parse the line table on the fly and find the row we are looking for.
// We will need to determine if we need to cache the line table by calling
// LineTable::parseAllEntries(...) or just call this function each time.
-// There is a CPU vs memory tradeoff we will need to determine.
-LineEntry LineTable::lookup(DataExtractor &Data, uint64_t BaseAddr, uint64_t Addr) {
+// There is a CPU vs memory tradeoff we will need to determined.
+Expected<LineEntry> LineTable::lookup(DataExtractor &Data, uint64_t BaseAddr, uint64_t Addr) {
LineEntry Result;
llvm::Error Err = parse(Data, BaseAddr,
[Addr, &Result](const LineEntry &Row) -> bool {
@@ -277,7 +277,13 @@ LineEntry LineTable::lookup(DataExtractor &Data, uint64_t BaseAddr, uint64_t Add
}
return true; // Keep parsing till we find the right row.
});
- return Result;
+ if (Err)
+ return std::move(Err);
+ if (Result.isValid())
+ return Result;
+ return createStringError(std::errc::invalid_argument,
+ "address 0x%" PRIx64 " is not in the line table",
+ Addr);
}
raw_ostream &llvm::gsym::operator<<(raw_ostream &OS, const LineTable &LT) {