[PATCH] D21503: [llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 15:10:31 PDT 2016


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Looks alright - some basic cleanup to do before committing.

(we might consider the format changing over time to make it a bit more terse/legible about what it's meant to be describing rather than the mechanical format that it's using to represent that (eg: dumping the string offsets might not be generically useful, just printing the strings might suffice))


================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:114
@@ +113,3 @@
+  CuList.reserve(CuListSize);
+  for (uint32_t I = 0; I < CuListSize; ++I) {
+    uint64_t CuOffset = Data.getU64(&Offset);
----------------
Prefer 'i' (lowercase) for loop indexes

================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:128
@@ +127,3 @@
+  AddressArea.reserve(AddressAreaSize);
+  for (uint32_t I = 0; I < AddressAreaSize; ++I) {
+    uint64_t LowAddress = Data.getU64(&Offset);
----------------
Prefer 'i' for loop indexes.

================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:146
@@ +145,3 @@
+  uint32_t CuVectorsTotal = 0;
+  for (uint32_t I = 0; I < SymTableSize; ++I) {
+    uint32_t NameOffset = Data.getU32(&Offset);
----------------
Prefer 'i' for loop indexes

================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:157
@@ +156,3 @@
+  // value is the index and symbol attributes of a CU in the CU list.
+  for (uint32_t I = 0; I < CuVectorsTotal; ++I) {
+    ConstantPoolVectors.push_back(
----------------
Generally we use 'i' for loop indexes.

================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:158-159
@@ +157,4 @@
+  for (uint32_t I = 0; I < CuVectorsTotal; ++I) {
+    ConstantPoolVectors.push_back(
+        std::pair<uint32_t, SmallVector<uint32_t, 0>>());
+    std::pair<uint32_t, SmallVector<uint32_t, 0>> &Vec =
----------------
Maybe just emplace_back()?

================
Comment at: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp:160-161
@@ +159,4 @@
+        std::pair<uint32_t, SmallVector<uint32_t, 0>>());
+    std::pair<uint32_t, SmallVector<uint32_t, 0>> &Vec =
+        ConstantPoolVectors.back();
+    Vec.first = Offset - ConstantPoolOffset;
----------------
Maybe auto?


https://reviews.llvm.org/D21503





More information about the llvm-commits mailing list