[llvm] Modify llvm-gsymutil lookups to handle overlapping ranges correctly. (PR #72350)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 14:38:54 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 51c351f49ed1e1406543fcadc7f6d3a4272e74bd 1bb09c1ac828bab0c91763d57885dd1401e163a7 -- llvm/include/llvm/DebugInfo/GSYM/GsymReader.h llvm/lib/DebugInfo/GSYM/GsymReader.cpp llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
index 4ac7ec5342..e290bb5684 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
@@ -357,7 +357,6 @@ protected:
/// address.
llvm::Expected<llvm::DataExtractor>
getFunctionInfoDataAtIndex(uint64_t AddrIdx, uint64_t &FuncStartAddr) const;
-
};
} // namespace gsym
diff --git a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
index 0ee529825f..4b1b352466 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
@@ -254,7 +254,8 @@ GsymReader::getAddressIndex(const uint64_t Addr) const {
}
llvm::Expected<DataExtractor>
-GsymReader::getFunctionInfoDataForAddress(uint64_t Addr, uint64_t &FuncStartAddr) const {
+GsymReader::getFunctionInfoDataForAddress(uint64_t Addr,
+ uint64_t &FuncStartAddr) const {
Expected<uint64_t> ExpectedAddrIdx = getAddressIndex(Addr);
if (!ExpectedAddrIdx)
return ExpectedAddrIdx.takeError();
@@ -300,8 +301,7 @@ GsymReader::getFunctionInfoDataAtIndex(uint64_t AddrIdx,
uint64_t &FuncStartAddr) const {
if (AddrIdx >= getNumAddresses())
return createStringError(std::errc::invalid_argument,
- "invalid address index %" PRIu64,
- AddrIdx);
+ "invalid address index %" PRIu64, AddrIdx);
const uint32_t AddrInfoOffset = AddrInfoOffsets[AddrIdx];
assert((Endian == endianness::big || Endian == endianness::little) &&
"Endian must be either big or little");
@@ -313,8 +313,7 @@ GsymReader::getFunctionInfoDataAtIndex(uint64_t AddrIdx,
std::optional<uint64_t> OptFuncStartAddr = getAddress(AddrIdx);
if (!OptFuncStartAddr)
return createStringError(std::errc::invalid_argument,
- "failed to extract address[%" PRIu64 "]",
- AddrIdx);
+ "failed to extract address[%" PRIu64 "]", AddrIdx);
FuncStartAddr = *OptFuncStartAddr;
return DataExtractor(Bytes, Endian == llvm::endianness::little, 4);
}
@@ -327,7 +326,8 @@ llvm::Expected<FunctionInfo> GsymReader::getFunctionInfo(uint64_t Addr) const {
return ExpectedData.takeError();
}
-llvm::Expected<FunctionInfo> GsymReader::getFunctionInfoAtIndex(uint64_t Idx) const {
+llvm::Expected<FunctionInfo>
+GsymReader::getFunctionInfoAtIndex(uint64_t Idx) const {
uint64_t FuncStartAddr = 0;
if (auto ExpectedData = getFunctionInfoDataAtIndex(Idx, FuncStartAddr))
return FunctionInfo::decode(*ExpectedData, FuncStartAddr);
diff --git a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
index 82129e5a5d..f7ee7693ac 100644
--- a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -4871,9 +4871,8 @@ TEST(GSYMTest, TestLookupsOfOverlappingAndUnequalRanges) {
// Make sure we see both "foo" and "bar" in the output of an entire GSYM
// dump. Prior to this fix we would two "foo" entries.
std::vector<std::string> ExpectedDumpLines = {
- "@ 0x00000068: [0x0000000000001000 - 0x0000000000001050) \"foo\"",
- "@ 0x00000088: [0x0000000000001000 - 0x0000000000001100) \"bar\""
- };
+ "@ 0x00000068: [0x0000000000001000 - 0x0000000000001050) \"foo\"",
+ "@ 0x00000088: [0x0000000000001000 - 0x0000000000001100) \"bar\""};
// Make sure all expected errors are in the error stream for the two invalid
// inlined functions that we removed due to invalid range scoping.
for (const auto &Line : ExpectedDumpLines)
``````````
</details>
https://github.com/llvm/llvm-project/pull/72350
More information about the llvm-commits
mailing list