aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/GSYM/GsymReader.cpp')
-rw-r--r--llvm/lib/DebugInfo/GSYM/GsymReader.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
index fa5476d..0a5bb7c 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
@@ -334,14 +334,52 @@ GsymReader::getFunctionInfoAtIndex(uint64_t Idx) const {
return ExpectedData.takeError();
}
-llvm::Expected<LookupResult> GsymReader::lookup(uint64_t Addr) const {
+llvm::Expected<LookupResult>
+GsymReader::lookup(uint64_t Addr,
+ std::optional<DataExtractor> *MergedFunctionsData) const {
uint64_t FuncStartAddr = 0;
if (auto ExpectedData = getFunctionInfoDataForAddress(Addr, FuncStartAddr))
- return FunctionInfo::lookup(*ExpectedData, *this, FuncStartAddr, Addr);
+ return FunctionInfo::lookup(*ExpectedData, *this, FuncStartAddr, Addr,
+ MergedFunctionsData);
else
return ExpectedData.takeError();
}
+llvm::Expected<std::vector<LookupResult>>
+GsymReader::lookupAll(uint64_t Addr) const {
+ std::vector<LookupResult> Results;
+ std::optional<DataExtractor> MergedFunctionsData;
+
+ // First perform a lookup to get the primary function info result.
+ auto MainResult = lookup(Addr, &MergedFunctionsData);
+ if (!MainResult)
+ return MainResult.takeError();
+
+ // Add the main result as the first entry.
+ Results.push_back(std::move(*MainResult));
+
+ // Now process any merged functions data that was found during the lookup.
+ if (MergedFunctionsData) {
+ // Get data extractors for each merged function.
+ auto ExpectedMergedFuncExtractors =
+ MergedFunctionsInfo::getFuncsDataExtractors(*MergedFunctionsData);
+ if (!ExpectedMergedFuncExtractors)
+ return ExpectedMergedFuncExtractors.takeError();
+
+ // Process each merged function data.
+ for (DataExtractor &MergedData : *ExpectedMergedFuncExtractors) {
+ if (auto FI = FunctionInfo::lookup(MergedData, *this,
+ MainResult->FuncRange.start(), Addr)) {
+ Results.push_back(std::move(*FI));
+ } else {
+ return FI.takeError();
+ }
+ }
+ }
+
+ return Results;
+}
+
void GsymReader::dump(raw_ostream &OS) {
const auto &Header = getHeader();
// Dump the GSYM header.