[llvm-commits] [PATCH]: Fix for DW_at_stmt_list offset

Tobias Grosser grosser at fim.uni-passau.de
Tue Aug 31 17:57:46 PDT 2010


On 08/26/2010 10:08 AM, Krister Wombell wrote:
> In the compilation unit DIE, DW_at_stmt_list is supposed to be an offset
> into the debug_line information where the line program for this compile
> unit begins.
>
> It needs to be a label so that a relocation is emitted and during final
> linking the offset is adjusted.  Without this all CUs contain offset 0
> (and only 1 of them will be correct)
>
> Mostly been able to debug an ELF program under gdb now.
>
> Krister

Hey Krister,

I tried your patch and it solved the issue that I was not even able to 
set break points at a specific line. With your patch this works nicely 
in gdb.

One thing I realized is that this patch needs the patch in
"[PATCH] fix debug_ranges for ELF targets". Furthermore the following 
change is in both patches. I suppose it should be part of the "fix 
debug_ranges" patch?

Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp	(revision 112155)
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp	(working copy)
@@ -3119,9 +3120,8 @@
      case dwarf::DW_AT_ranges: {
        // DW_AT_range Value encodes offset in debug_range section.
        DIEInteger *V = cast<DIEInteger>(Values[i]);
-      Asm->EmitLabelOffsetDifference(DwarfDebugRangeSectionSym,
+      Asm->EmitLabelPlusOffset(DwarfDebugRangeSectionSym,
                                       V->getValue(),
-                                     DwarfDebugRangeSectionSym,
                                       4);
        break;
      }


@everybody: Could someone knowing DWARF review these patches. It is 
really nice to have usable debugging in gdb with programs consisting of 
more than one CU.

Cheers
Tobi



More information about the llvm-commits mailing list