diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:31:57 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:33:27 +0900 |
commit | df025ebf872052c0761d44a3ef9b65e9675af8a8 (patch) | |
tree | 9b4e94583e2536546d6606270bcdf846c95e1ba2 /llvm/lib/DebugInfo/GSYM/GsymReader.cpp | |
parent | 4428c9d0b1344179f85a72e183a44796976521e3 (diff) | |
parent | bdcf47e4bcb92889665825654bb80a8bbe30379e (diff) | |
download | llvm-users/chapuni/cov/single/loop.zip llvm-users/chapuni/cov/single/loop.tar.gz llvm-users/chapuni/cov/single/loop.tar.bz2 |
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/loopusers/chapuni/cov/single/loop
Conflicts:
clang/lib/CodeGen/CoverageMappingGen.cpp
Diffstat (limited to 'llvm/lib/DebugInfo/GSYM/GsymReader.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/GSYM/GsymReader.cpp | 42 |
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. |