[PATCH] D146852: [DWARF][GDB INDEX] Fix to deal with constant pool de-dupliation Summary:
Alexander Yermolovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 24 15:57:46 PDT 2023
ayermolo created this revision.
Herald added subscribers: hoy, modimo, wenlei, arphaman, hiraditya.
Herald added a project: All.
ayermolo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
GDB 11.2 generates V8 version of gdb-index where it de-duplicates entries in
constant pool based on cu indices. Changed how constant pool entries are counted
to account for this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146852
Files:
llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
Index: llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
+#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataExtractor.h"
@@ -166,19 +167,20 @@
// for both a string and a CU vector.
uint32_t SymTableSize = (ConstantPoolOffset - SymbolTableOffset) / 8;
SymbolTable.reserve(SymTableSize);
- uint32_t CuVectorsTotal = 0;
+ DenseSet<uint32_t> CUIndeces;
for (uint32_t i = 0; i < SymTableSize; ++i) {
uint32_t NameOffset = Data.getU32(&Offset);
uint32_t CuVecOffset = Data.getU32(&Offset);
SymbolTable.push_back({NameOffset, CuVecOffset});
if (NameOffset || CuVecOffset)
- ++CuVectorsTotal;
+ CUIndeces.insert(CuVecOffset);
}
// The constant pool. CU vectors are stored first, followed by strings.
// The first value is the number of CU indices in the vector. Each subsequent
// value is the index and symbol attributes of a CU in the CU list.
- for (uint32_t i = 0; i < CuVectorsTotal; ++i) {
+ for (uint32_t I = 0, CuVectorsTotal = CUIndeces.size(); I < CuVectorsTotal;
+ ++I) {
ConstantPoolVectors.emplace_back(0, SmallVector<uint32_t, 0>());
auto &Vec = ConstantPoolVectors.back();
Vec.first = Offset - ConstantPoolOffset;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146852.508238.patch
Type: text/x-patch
Size: 1583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230324/e897abcd/attachment.bin>
More information about the llvm-commits
mailing list