[LLVMbugs] [Bug 14016] New: Clang doesn't emit enough debug info for some functions with -gline-tables-only and -O1
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 4 05:05:53 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=14016
Bug #: 14016
Summary: Clang doesn't emit enough debug info for some
functions with -gline-tables-only and -O1
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: samsonov at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
$ cat zbug.cc
#include <stdio.h>
namespace {
void zzz (void *foo) {
fprintf(stderr, "zzz\n");
}
void bar () {
void *foo;
zzz(foo);
}
}
void run() { bar(); }
$ clang++ -gline-tables-only -O1 zbug.cc -c -o zbug.o
Now the function "zzz" is present in the object file:
$ objdump -d zbug.o | grep zzz
10: eb 0e jmp 20 <_ZN12_GLOBAL__N_13zzzEPv>
0000000000000020 <_ZN12_GLOBAL__N_13zzzEPv>:
20: 48 8b 0d 00 00 00 00 mov 0x0(%rip),%rcx # 27
<_ZN12_GLOBAL__N_13zzzEPv+0x7>
36: e9 00 00 00 00 jmpq 3b <_ZN12_GLOBAL__N_13zzzEPv+0x1b>
But the debug info for it doesn't have low_pc/high_pc attributes:
$ readelf -wi zbug.o
...
<1><58>: Abbrev Number: 4 (DW_TAG_subprogram)
<59> DW_AT_name : (indirect string, offset: 0x4d): zzz
<5d> DW_AT_decl_file : 1
<5e> DW_AT_decl_line : 4
It seems that LLVM IR is misleading. Metadata for function "bar" has pointer to
LLVM function @_ZN12_GLOBAL__N_13barEv while metadata for "zzz" doesn't have
pointer to @_ZN12_GLOBAL__N_13zzzEPv
$ clang++ -gline-tables-only -O1 zbug.cc -c -S -emit-llvm -o zbug.ll
$ cat zbug.ll
...
!8 = metadata !{i32 786478, i32 0, metadata !6, metadata !"bar", metadata
!"bar", metadata !"", metadata !6, i32 7, metadata !7, i1 true, i1 true, i32 0,
i32 0, null, i32 256, i1 true, void ()* @_ZN12_GLOBAL__N_13barEv, null, null,
metadata !1, i32 7} ; [ DW_TAG_subprogram ] [line 7] [local] [def] [bar]
!9 = metadata !{i32 786478, i32 0, metadata !6, metadata !"zzz", metadata
!"zzz", metadata !"", metadata !6, i32 4, metadata !7, i1 true, i1 true, i32 0,
i32 0, null, i32 256, i1 true, null, null, null, metadata !1, i32 4} ; [
DW_TAG_subprogram ] [line 4] [local] [def] [zzz]
--
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