[llvm] r193872 - DebugInfo: Make pubnames header printing similar to unit header printing

David Blaikie dblaikie at gmail.com
Fri Nov 1 10:53:30 PDT 2013


Author: dblaikie
Date: Fri Nov  1 12:53:30 2013
New Revision: 193872

URL: http://llvm.org/viewvc/llvm-project?rev=193872&view=rev
Log:
DebugInfo: Make pubnames header printing similar to unit header printing

In a failed attempt to allow the gnu-public-names.ll test case to not
hardcode the size of the unit that the pubnames section referred to I've
at least managed to have unit headers and pubnames headers print out in
a similar style.

This failed to achieve the desired goal because the header in a unit
specifies the length of the unit without the length element of the
header whereas the length in the pubnames includes this element, so the
numbers are off by 4 bytes. I don't know of any arithmetic powers in
FileCheck so the test case can't simply say "CU_LENGTH + 4".

Modified:
    llvm/trunk/lib/DebugInfo/DWARFContext.cpp
    llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll
    llvm/trunk/test/DebugInfo/dwarf-public-names.ll
    llvm/trunk/test/DebugInfo/dwarfdump-pubnames.test

Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=193872&r1=193871&r2=193872&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Fri Nov  1 12:53:30 2013
@@ -34,10 +34,10 @@ static void dumpPubSection(raw_ostream &
   OS << "\n." << Name << " contents:\n";
   DataExtractor pubNames(Data, LittleEndian, 0);
   uint32_t offset = 0;
-  OS << "Length:                " << pubNames.getU32(&offset) << "\n";
-  OS << "Version:               " << pubNames.getU16(&offset) << "\n";
-  OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
-  OS << "Size:                  " << pubNames.getU32(&offset) << "\n";
+  OS << "length = " << format("0x%08x", pubNames.getU32(&offset));
+  OS << " version = " << format("0x%04x", pubNames.getU16(&offset));
+  OS << " unit_offset = " << format("0x%08x", pubNames.getU32(&offset));
+  OS << " unit_size = " << format("0x%08x", pubNames.getU32(&offset)) << '\n';
   if (GnuStyle)
     OS << "Offset     Linkage  Kind     Name\n";
   else

Modified: llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll?rev=193872&r1=193871&r2=193872&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/gnu-public-names.ll Fri Nov  1 12:53:30 2013
@@ -104,10 +104,7 @@
 ; CHECK-NEXT: DW_AT_name {{.*}} "global_function"
 
 ; CHECK-LABEL: .debug_gnu_pubnames contents:
-; CHECK-NEXT: Length:                231
-; CHECK-NEXT: Version:               2
-; CHECK-NEXT: Offset in .debug_info: 0
-; CHECK-NEXT: Size:                  379
+; CHECK-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x0000017b
 ; CHECK-NEXT: Offset     Linkage  Kind     Name
 ; CHECK-DAG:  [[GLOBAL_FUNC]] EXTERNAL FUNCTION "global_function"
 ; CHECK-DAG:  [[NS]] EXTERNAL TYPE     "ns"
@@ -121,11 +118,7 @@
 
 
 ; CHECK-LABEL: debug_gnu_pubtypes contents:
-; CHECK-NEXT: Length:
-; CHECK-NEXT: Version:
-; CHECK-NEXT: Offset in .debug_info:
-; CHECK-NEXT: Size:
-; CHECK-NEXT: Offset     Linkage  Kind     Name
+; CHECK: Offset     Linkage  Kind     Name
 ; CHECK-DAG:  [[C]] EXTERNAL TYPE     "C"
 ; CHECK-DAG:  [[D]] EXTERNAL TYPE     "ns::D"
 ; CHECK-DAG:  [[INT]] STATIC   TYPE     "int"

Modified: llvm/trunk/test/DebugInfo/dwarf-public-names.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarf-public-names.ll?rev=193872&r1=193871&r2=193872&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/dwarf-public-names.ll Fri Nov  1 12:53:30 2013
@@ -37,7 +37,7 @@
 
 ; Skip the output to the header of the pubnames section.
 ; CHECK: debug_pubnames
-; CHECK: Version:               2
+; CHECK: version = 0x0002
 
 ; Check for each name in the output.
 ; CHECK: global_namespace_variable

Modified: llvm/trunk/test/DebugInfo/dwarfdump-pubnames.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-pubnames.test?rev=193872&r1=193871&r2=193872&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-pubnames.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-pubnames.test Fri Nov  1 12:53:30 2013
@@ -2,10 +2,7 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-
 RUN:   -debug-dump=pubnames | FileCheck %s
 
 CHECK: .debug_pubnames contents:
-CHECK: Length:                161
-CHECK: Version:               2
-CHECK: Offset in .debug_info: 0
-CHECK: Size:                  321
+CHECK: length = 0x000000a1 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000141
 
 CHECK: Offset        Name
 CHECK: 0x00000098    "global_namespace_variable"





More information about the llvm-commits mailing list