[llvm] r174976 - Add support for the pubnames section to llvm-dwarfdump.

Krzysztof Parzyszek kparzysz at codeaurora.org
Tue Feb 12 08:20:29 PST 2013


Author: kparzysz
Date: Tue Feb 12 10:20:28 2013
New Revision: 174976

URL: http://llvm.org/viewvc/llvm-project?rev=174976&view=rev
Log:
Add support for the pubnames section to llvm-dwarfdump.

Modified:
    llvm/trunk/include/llvm/DebugInfo/DIContext.h
    llvm/trunk/lib/DebugInfo/DWARFContext.cpp
    llvm/trunk/lib/DebugInfo/DWARFContext.h
    llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=174976&r1=174975&r2=174976&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Tue Feb 12 10:20:28 2013
@@ -106,6 +106,7 @@ enum DIDumpType {
   DIDT_InfoDwo,
   DIDT_Line,
   DIDT_Ranges,
+  DIDT_Pubnames,
   DIDT_Str,
   DIDT_StrDwo,
   DIDT_StrOffsetsDwo

Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=174976&r1=174975&r2=174976&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Tue Feb 12 10:20:28 2013
@@ -88,6 +88,24 @@ void DWARFContext::dump(raw_ostream &OS,
       rangeList.dump(OS);
   }
 
+  if (DumpType == DIDT_All || DumpType == DIDT_Pubnames) {
+    OS << "\n.debug_pubnames contents:\n";
+    DataExtractor pubNames(getPubNamesSection(), isLittleEndian(), 0);
+    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 << "\n  Offset    Name\n";
+    while (offset < getPubNamesSection().size()) {
+      uint32_t n = pubNames.getU32(&offset);
+      if (n == 0)
+        break;
+      OS << format("%8x    ", n);
+      OS << pubNames.getCStr(&offset) << "\n";
+    }
+  }
+
   if (DumpType == DIDT_All || DumpType == DIDT_AbbrevDwo) {
     OS << "\n.debug_abbrev.dwo contents:\n";
     getDebugAbbrevDWO()->dump(OS);
@@ -494,6 +512,8 @@ DWARFContextInMemory::DWARFContextInMemo
       RangeDWOSection = data;
       RangeSection = data;
     }
+    else if (name == "debug_pubnames")
+      PubNamesSection = data;
     else if (name == "debug_info.dwo")
       InfoDWOSection = data;
     else if (name == "debug_abbrev.dwo")

Modified: llvm/trunk/lib/DebugInfo/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=174976&r1=174975&r2=174976&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFContext.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFContext.h Tue Feb 12 10:20:28 2013
@@ -111,6 +111,7 @@ public:
   virtual StringRef getLineSection() = 0;
   virtual StringRef getStringSection() = 0;
   virtual StringRef getRangeSection() = 0;
+  virtual StringRef getPubNamesSection() = 0;
 
   // Sections for DWARF5 split dwarf proposal.
   virtual StringRef getInfoDWOSection() = 0;
@@ -149,6 +150,7 @@ class DWARFContextInMemory : public DWAR
   StringRef LineSection;
   StringRef StringSection;
   StringRef RangeSection;
+  StringRef PubNamesSection;
 
   // Sections for DWARF5 split dwarf proposal.
   RelocAddrMap InfoDWORelocMap;
@@ -172,6 +174,7 @@ public:
   virtual StringRef getLineSection() { return LineSection; }
   virtual StringRef getStringSection() { return StringSection; }
   virtual StringRef getRangeSection() { return RangeSection; }
+  virtual StringRef getPubNamesSection() { return PubNamesSection; }
 
   // Sections for DWARF5 split dwarf proposal.
   virtual StringRef getInfoDWOSection() { return InfoDWOSection; }

Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=174976&r1=174975&r2=174976&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Tue Feb 12 10:20:28 2013
@@ -65,6 +65,7 @@ DumpType("debug-dump", cl::init(DIDT_All
         clEnumValN(DIDT_Line, "line", ".debug_line"),
         clEnumValN(DIDT_Frames, "frames", ".debug_frame"),
         clEnumValN(DIDT_Ranges, "ranges", ".debug_ranges"),
+        clEnumValN(DIDT_Pubnames, "pubnames", ".debug_pubnames"),
         clEnumValN(DIDT_Str, "str", ".debug_str"),
         clEnumValN(DIDT_StrDwo, "str.dwo", ".debug_str.dwo"),
         clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"),





More information about the llvm-commits mailing list