[LLVMbugs] [Bug 11112] New: llvm-ld corrupts debugging information of local variables.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Oct 11 11:02:22 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=11112
Summary: llvm-ld corrupts debugging information of local
variables.
Product: libraries
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Linker
AssignedTo: unassignedbugs at nondot.org
ReportedBy: haohui.mai at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=7440)
--> (http://llvm.org/bugs/attachment.cgi?id=7440)
the bitcode file
I'm using clang+llvm to compile my project, and I found out llvm-ld somehow
made the debugging information of local variables unavailable in debugger.
Here is a simple C program:
extern int putchar(int c);
int main() {
for (int debug_var = 0; debug_var < 26; ++debug_var)
putchar(debug_var + 'A');
return 0;
}
I compiled it with clang in mainline:
$clang -march=armv7 -mfloat-abi=soft -ccc-host-triple arm-elf -Wall -Werror
-emit-llvm t.c -c -o t.bc -O0 -g
The debugging information for "debug_var" is available after llc:
$llc -disable-fp-elim -march=arm -mcpu=cortex-a9 -mattr=+vfp3,+neon
-float-abi=soft -O=0 t.bc -o -|grep "debug_var" -a3
.long .Ltmp0 @ DW_AT_low_pc
.long .Ltmp1 @ DW_AT_high_pc
.byte 4 @ Abbrev [4] 0x7f:0x14 DW_TAG_variable
.ascii "debug_var" @ DW_AT_name
.byte 0
.byte 1 @ DW_AT_decl_file
.byte 4 @ DW_AT_decl_line
However, if I pass the bitcode file through llvm-ld, the information is no
longer available:
$llvm-ld -disable-opt -link-as-library t.bc -o -|/opt/local/ibos/bin/llc
-disable-fp-elim -march=arm -mcpu=cortex-a9 -mattr=+vfp3,+neon -float-abi=soft
-O=0|grep "debug_var" -a3
The diff of bitcode before and after llvm-ld shows slight difference:
$ diff -u before-llvm-ld.ll after-llvm-ld.ll
...
- call void @llvm.dbg.declare(metadata !{i32* %debug_var}, metadata !12), !dbg
!15
- store i32 0, i32* %debug_var, align 4, !dbg !16
- br label %for.cond, !dbg !16
+ call void @llvm.dbg.declare(metadata !12, metadata !13), !dbg !16
+ store i32 0, i32* %debug_var, align 4, !dbg !17
+ br label %for.cond, !dbg !17
...
-!12 = metadata !{i32 721152, metadata !13, metadata !"debug_var", metadata !6,
i32 4, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
-!13 = metadata !{i32 720907, metadata !14, i32 4, i32 2, metadata !6, i32 1} ;
[ DW_TAG_lexical_block ]
+!12 = metadata !{null}
+!13 = metadata !{i32 721152, metadata !14, metadata !"debug_var", metadata !6,
i32 4, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
You can see the first argument of @llvm.dbg.declare is nullified for some
reason.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list