[Bug debug/56502] New: entry-value: Missing DW_AT_linkage_name for C<->C++ calls
jan.kratochvil at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Mar 1 21:13:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56502
Bug #: 56502
Summary: entry-value: Missing DW_AT_linkage_name for C<->C++
calls
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jan.kratochvil@redhat.com
Target: x86_64-unknown-linux-gnu
Created attachment 29564
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29564
FSF GDB HEAD patch before it is upstreamed.
gcc-4.8.0-0.14.fc19.x86_64
gdb FSF HEAD with attached patch (reproducer does not work without patched GDB)
gcc -o extcall3.o -c extcall3.c -Wall -g -O2; g++ -o extcall extcall3.o
extcall{,2}.C -Wall -g -O2
gdb ./extcall -ex 'b a' -ex 'b b' -ex 'set debug entry-values 1' -ex r
Breakpoint 1, Cannot find function "f(int)" for a call site target at 0x4004ce
in main
(gdb) bt
#0 a (y=1) at extcall3.c:2
#1 0x00000000004004ce in main () at extcall.C:4
(gdb) c
[...]
(gdb) bt
#0 b (y=y@entry=2) at extcall2.C:2
#1 0x0000000000400607 in g (x=x@entry=42) at extcall2.C:3
#2 0x00000000004004d8 in main () at extcall.C:5
You can see the first case main->f->a is missing the tail call frame because:
Cannot find function "f(int)" for a call site target at 0x4004ce in main
<0><bb>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c0> DW_AT_language : 4 (C++)
<c1> DW_AT_name : extcall.C
<2><fa>: Abbrev Number: 3 (DW_TAG_GNU_call_site)
<fb> DW_AT_low_pc : 0x4004ce
<103> DW_AT_abstract_origin: <0x12e>
<1><12e>: Abbrev Number: 7 (DW_TAG_subprogram)
<12f> DW_AT_external : 1
<12f> DW_AT_name : f
<133> DW_AT_declaration : 1
<2><137>: Abbrev Number: 8 (DW_TAG_formal_parameter)
<138> DW_AT_type : <0x127>
<2><13c>: Abbrev Number: 0
As <12e> is in C++ CU and it has no DW_AT_linkage_name GDB expects it is
"f(int)" but the C symbol is "f".
==> extcall.C <==
extern "C" { void f(int x); }
void g(int x);
int main() {
f(42);
g(42);
}
==> extcall2.C <==
static volatile int j;
static __attribute__((noinline, noclone)) void b(int y) { j=y; }
void g(int x) { b(2); }
==> extcall3.c <==
static volatile int i;
static __attribute__((noinline, noclone)) void a(int y) { i=y; }
void f(int x) { a(1); }
More information about the Gcc-bugs
mailing list