Set up DwarfDebug using DebugInfo API.
authorDevang Patel <dpatel@apple.com>
Tue, 6 Jan 2009 21:07:30 +0000 (21:07 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 6 Jan 2009 21:07:30 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61822 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfWriter.cpp

index fb0c86b54936b160dacf294c9b2e216a91a54dfb..6e2011ea2806f5384b6623d24adb84a320db3a84 100644 (file)
@@ -3291,6 +3291,39 @@ public:
       delete Values[j];
   }
 
+  /// SetDebugInfo - Create global DIEs and emit initial debug info sections.
+  /// This is inovked by the target AsmPrinter.
+  void SetDebugInfo() {
+    // FIXME - Check if the module has debug info or not.
+      // Create all the compile unit DIEs.
+      ConstructCompileUnits();
+
+      // Create DIEs for each of the externally visible global variables.
+      ConstructGlobalVariableDIEs();
+
+      // Create DIEs for each of the externally visible subprograms.
+      ConstructSubprograms();
+
+      // Prime section data.
+      SectionMap.insert(TAI->getTextSection());
+
+      // Print out .file directives to specify files for .loc directives. These
+      // are printed out early so that they precede any .loc directives.
+      if (TAI->hasDotLocAndDotFile()) {
+        for (unsigned i = 1, e = SrcFiles.size(); i <= e; ++i) {
+          sys::Path FullPath(Directories[SrcFiles[i].getDirectoryID()]);
+          bool AppendOk = FullPath.appendComponent(SrcFiles[i].getName());
+          assert(AppendOk && "Could not append filename to directory!");
+          AppendOk = false;
+          Asm->EmitFile(i, FullPath.toString());
+          Asm->EOL();
+        }
+      }
+
+      // Emit initial sections
+      EmitInitial();
+  }
+
   /// SetModuleInfo - Set machine module information when it's known that pass
   /// manager has created it.  Set by the target AsmPrinter.
   void SetModuleInfo(MachineModuleInfo *mmi) {