[PATCH] Debug Info on Windows

Carlo Kok ck at remobjects.com
Thu Jul 25 13:06:48 PDT 2013


Attached is a possible fix for:
Bug 16249 - LLVM generates broken debug info on Windows

 From what I can find out the issue is that DIE Labels to strings and 
other objects should be emitted as a coff "secrel32" symbol, not a .long.

After applying this patch gdb and llvm-dwarfdump can properly read the file.



--
Carlo Kok
-------------- next part --------------
 lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 8dc44b7..dbf831d 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1957,8 +1957,13 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
       break;
     }
     default:
+      const DIEValue* value = Values[i];
+      if (value->getType() == DIEValue::isLabel && Asm->MAI->needsDwarfSectionOffsetDirective()) {
+        Asm->OutStreamer.EmitCOFFSecRel32(((DIELabel*)value)->getValue());
+        break;
+      } 
       // Emit an attribute using the defined form.
-      Values[i]->EmitValue(Asm, Form);
+      value->EmitValue(Asm, Form);
       break;
     }
   }


More information about the llvm-commits mailing list