[llvm] r189289 - Treat the pubtypes section similarly to the pubnames section and emit

Eric Christopher echristo at gmail.com
Mon Aug 26 16:24:35 PDT 2013


Author: echristo
Date: Mon Aug 26 18:24:35 2013
New Revision: 189289

URL: http://llvm.org/viewvc/llvm-project?rev=189289&view=rev
Log:
Treat the pubtypes section similarly to the pubnames section and emit
it by default under linux or when we're trying to keep compatibility
with old gdb versions.

Fix testcase for option name change.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/test/DebugInfo/dwarf-public-names.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=189289&r1=189288&r2=189289&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 26 18:24:35 2013
@@ -101,12 +101,12 @@ SplitDwarf("split-dwarf", cl::Hidden,
            cl::init(Default));
 
 static cl::opt<DefaultOnOff>
-DwarfPubNames("generate-dwarf-pubnames", cl::Hidden,
-              cl::desc("Generate DWARF pubnames section"),
-              cl::values(clEnumVal(Default, "Default for platform"),
-                         clEnumVal(Enable, "Enabled"),
-                         clEnumVal(Disable, "Disabled"), clEnumValEnd),
-              cl::init(Default));
+DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
+                 cl::desc("Generate DWARF pubnames and pubtypes sections"),
+                 cl::values(clEnumVal(Default, "Default for platform"),
+                            clEnumVal(Enable, "Enabled"),
+                            clEnumVal(Disable, "Disabled"), clEnumValEnd),
+                 cl::init(Default));
 
 static const char *const DWARFGroupName = "DWARF Emission";
 static const char *const DbgTimerName = "DWARF Debug Writer";
@@ -217,10 +217,10 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
   else
     HasSplitDwarf = SplitDwarf == Enable;
 
-  if (DwarfPubNames == Default)
-    HasDwarfPubNames = !IsDarwin;
+  if (DwarfPubSections == Default)
+    HasDwarfPubSections = !IsDarwin;
   else
-    HasDwarfPubNames = DwarfPubNames == Enable;
+    HasDwarfPubSections = DwarfPubSections == Enable;
 
   DwarfVersion = getDwarfVersionFromModule(MMI->getModule());
 
@@ -792,7 +792,7 @@ void DwarfDebug::constructSubprogramDIE(
   TheCU->addToContextOwner(SubprogramDie, SP.getContext());
 
   // Expose as global, if requested.
-  if (HasDwarfPubNames)
+  if (HasDwarfPubSections)
     TheCU->addGlobalName(SP.getName(), SubprogramDie);
 }
 
@@ -1141,13 +1141,13 @@ void DwarfDebug::endModule() {
   }
 
   // Emit info into a debug pubnames section, if requested.
-  if (HasDwarfPubNames)
+  if (HasDwarfPubSections)
     emitDebugPubnames();
 
   // Emit info into a debug pubtypes section.
   // TODO: When we don't need the option anymore we can
   // remove all of the code that adds to the table.
-  if (useDarwinGDBCompat())
+  if (useDarwinGDBCompat() || HasDwarfPubSections)
     emitDebugPubTypes();
 
   // Finally emit string information into a string table.
@@ -1927,9 +1927,9 @@ void DwarfDebug::emitSectionLabels() {
   DwarfLineSectionSym =
     emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
   emitSectionSym(Asm, TLOF.getDwarfLocSection());
-  if (HasDwarfPubNames)
+  if (HasDwarfPubSections)
     emitSectionSym(Asm, TLOF.getDwarfPubNamesSection());
-  if (useDarwinGDBCompat())
+  if (useDarwinGDBCompat() || HasDwarfPubSections)
     emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
   DwarfStrSectionSym =
     emitSectionSym(Asm, TLOF.getDwarfStrSection(), "info_string");

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=189289&r1=189288&r2=189289&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Aug 26 18:24:35 2013
@@ -431,12 +431,15 @@ class DwarfDebug {
   // Holder for types that are going to be extracted out into a type unit.
   std::vector<DIE *> TypeUnits;
 
+  // Whether to emit the pubnames/pubtypes sections.
+  bool HasDwarfPubSections;
+
+  // Version of dwarf we're emitting.
+  unsigned DwarfVersion;
+
   // DWARF5 Experimental Options
   bool HasDwarfAccelTables;
   bool HasSplitDwarf;
-  bool HasDwarfPubNames;
-
-  unsigned DwarfVersion;
 
   // Separated Dwarf Variables
   // In general these will all be for bits that are left in the

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=189289&r1=189288&r2=189289&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarf-public-names.ll (original)
+++ llvm/trunk/test/DebugInfo/dwarf-public-names.ll Mon Aug 26 18:24:35 2013
@@ -1,6 +1,6 @@
 ; REQUIRES: object-emission
 
-; RUN: llc -generate-dwarf-pubnames=Enable -filetype=obj -o %t.o < %s
+; RUN: llc -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s
 ; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s
 ; ModuleID = 'dwarf-public-names.cpp'
 ;





More information about the llvm-commits mailing list