[PATCH] D32492: [llvm-dwarfdump] - Change format for .gdb_index dump.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 08:34:59 PDT 2017


grimar created this revision.

During investigation of PR32319,
I found that it is useful to output size when address ranges
are dumped. It is useful when comparing outputs produced
by different linkers.

In that case address ranges can look very different, when they are the same at fact.
Difference comes from different low address because of different address of .text.
Examples below.

Dumped gold output of llc binary (with patch):

  Low/High address = [0x120c576, 0x1215df8] (Size: 0x9882), CU id = 0
  Low/High address = [0x1215df8, 0x1215e0a] (Size: 0x12), CU id = 0
  Low/High address = [0x1215e0a, 0x1215e45] (Size: 0x3b), CU id = 0

Dumped LLD output for the same place (with patch):

  Low/High address = [0x31f80f6, 0x3201978] (Size: 0x9882), CU id = 0
  Low/High address = [0x3201978, 0x320198a] (Size: 0x12), CU id = 0
  Low/High address = [0x320198a, 0x32019c5] (Size: 0x3b), CU id = 0

And without this patch output does not allow to find out that ranges are the same in a fast way:

  Low address = 0x120c576, High address = 0x1215df8, CU index = 0
  Low address = 0x1215df8, High address = 0x1215e0a, CU index = 0
  Low address = 0x1215e0a, High address = 0x1215e45, CU index = 0

vs

  Low address = 0x31f80f6, High address = 0x3201978, CU index = 0
  Low address = 0x3201978, High address = 0x320198a, CU index = 0
  Low address = 0x320198a, High address = 0x32019c5, CU index = 0


https://reviews.llvm.org/D32492

Files:
  lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
  test/DebugInfo/dwarfdump-dump-gdbindex.test


Index: test/DebugInfo/dwarfdump-dump-gdbindex.test
===================================================================
--- test/DebugInfo/dwarfdump-dump-gdbindex.test
+++ test/DebugInfo/dwarfdump-dump-gdbindex.test
@@ -18,8 +18,8 @@
 ; CHECK-NEXT:   1: Offset = 0x34, Length = 0x34
 
 ; CHECK:      Address area offset = 0x38, has 2 entries:
-; CHECK-NEXT:   Low address = 0x4000e8, High address = 0x4000f3, CU index = 0
-; CHECK-NEXT:   Low address = 0x4000f3, High address = 0x4000fe, CU index = 1
+; CHECK-NEXT:   Low/High address = [0x4000e8, 0x4000f3] (Size: 0xb), CU id = 0
+; CHECK-NEXT:   Low/High address = [0x4000f3, 0x4000fe] (Size: 0xb), CU id = 1
 
 ; CHECK:      Symbol table offset = 0x60, size = 1024, filled slots:
 ; CHECK-NEXT:   489: Name offset = 0x1d, CU vector offset = 0x0
Index: lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
+++ lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
@@ -39,8 +39,9 @@
      << '\n';
   for (const AddressEntry &Addr : AddressArea)
     OS << format(
-        "    Low address = 0x%llx, High address = 0x%llx, CU index = %d\n",
-        Addr.LowAddress, Addr.HighAddress, Addr.CuIndex);
+        "    Low/High address = [0x%llx, 0x%llx] (Size: 0x%llx), CU id = %d\n",
+        Addr.LowAddress, Addr.HighAddress, Addr.HighAddress - Addr.LowAddress,
+        Addr.CuIndex);
 }
 
 void DWARFGdbIndex::dumpSymbolTable(raw_ostream &OS) const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32492.96570.patch
Type: text/x-patch
Size: 1482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170425/a1649cf5/attachment.bin>


More information about the llvm-commits mailing list