[llvm-commits] [llvm-gcc-4.2] r66644 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-debug.cpp llvm-debug.h

Devang Patel dpatel at apple.com
Tue Mar 10 23:21:10 PDT 2009


Author: dpatel
Date: Wed Mar 11 01:21:10 2009
New Revision: 66644

URL: http://llvm.org/viewvc/llvm-project?rev=66644&view=rev
Log:
When PCH is read, TheDebugInfo is re-created. However, this set up loses main compile unit already created from main_input_filename because CUCache is reset.
Re-initialize this by creating new main compile unit.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=66644&r1=66643&r2=66644&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Mar 11 01:21:10 2009
@@ -461,18 +461,8 @@
 }
 
 void llvm_lang_dependent_init(const char *Name) {
-
-  // Each input file is encoded as a separate compile unit in LLVM
-  // debugging information output. However, many target specific tool chains
-  // prefer to encode only one compile unit in an object file. In this 
-  // situation, the LLVM code generator will include  debugging information
-  // entities in the compile unit that is marked as main compile unit. The 
-  // code generator accepts maximum one main compile unit per module. If a
-  // module does not contain any main compile unit then the code generator 
-  // will emit multiple compile units in the output object file.
   if (TheDebugInfo)
-    TheDebugInfo->getOrCreateCompileUnit(main_input_filename, true);
-
+    TheDebugInfo->Initialize();
   if (Name)
     TheModule->setModuleIdentifier(Name);
 }
@@ -499,8 +489,10 @@
   delete MB;
 
   // FIXME - Do not disable debug info while writing pch.
-  if (!flag_pch_file && debug_info_level > DINFO_LEVEL_NONE)
+  if (!flag_pch_file && debug_info_level > DINFO_LEVEL_NONE) {
     TheDebugInfo = new DebugInfo(TheModule);
+    TheDebugInfo->Initialize();
+  }
 
   if (!TheModule) {
     cerr << "Error reading bytecodes from PCH file\n";

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=66644&r1=66643&r2=66644&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Wed Mar 11 01:21:10 2009
@@ -832,6 +832,22 @@
   return Ty;
 }
 
+/// Initialize - Initialize debug info by creating compile unit for
+/// main_input_filename. This must be inovked after language dependent
+/// initialization is done.
+void DebugInfo::Initialize() {
+
+  // Each input file is encoded as a separate compile unit in LLVM
+  // debugging information output. However, many target specific tool chains
+  // prefer to encode only one compile unit in an object file. In this 
+  // situation, the LLVM code generator will include  debugging information
+  // entities in the compile unit that is marked as main compile unit. The 
+  // code generator accepts maximum one main compile unit per module. If a
+  // module does not contain any main compile unit then the code generator 
+  // will emit multiple compile units in the output object file.
+  getOrCreateCompileUnit(main_input_filename, true);
+}
+
 /// getOrCreateCompileUnit - Get the compile unit from the cache or 
 /// create a new one if necessary.
 DICompileUnit DebugInfo::getOrCreateCompileUnit(const char *FullPath,

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=66644&r1=66643&r2=66644&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Wed Mar 11 01:21:10 2009
@@ -70,6 +70,11 @@
 public:
   DebugInfo(Module *m);
 
+  /// Initialize - Initialize debug info by creating compile unit for
+  /// main_input_filename. This must be inovked after language dependent
+  /// initialization is done.
+  void Initialize();
+
   // Accessors.
   void setLocationFile(const char *FullPath) { CurFullPath = FullPath; }
   void setLocationLine(int LineNo)           { CurLineNo = LineNo; }





More information about the llvm-commits mailing list