This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
debug/10001: gcc -g puts labels before function prologue
- From: werner at almesberger dot net
- To: gcc-gnats at gcc dot gnu dot org
- Date: Sat, 8 Mar 2003 11:19:33 -0300
- Subject: debug/10001: gcc -g puts labels before function prologue
>Number: 10001
>Category: debug
>Synopsis: gcc -g puts labels before function prologue
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Mar 08 14:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Werner Almesberger
>Release: 3.3 20030303 (prerelease)
>Organization:
>Environment:
System: Linux ar 2.4.18 #5 Mon Mar 18 09:25:24 ART 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --prefix=/usr/local/gcc20030303/ --enable-languages=c
>Description:
gcc -g puts labels before function prologue
A variation of the breakpoint-before-prologue problem: even if we
use a label to set the breakpoint, this doesn't always help. (It
seems to avoid ill effects in functions with extern scope, though.)
>How-To-Repeat:
Example (with Red Hat's gcc 3.1 20011127 on ia32):
$ cat <<EOF >foo.c
static void foo(int blah)
{
label:
return;
}
int main(void)
{
foo(321);
return 0;
}
EOF
$ gcc -g foo.c
$ readelf -w a.out
...
DW_AT_name : foo
...
DW_AT_low_pc : 0x8048398 134513560
DW_AT_high_pc : 0x804839d 134513565
DW_AT_frame_base : 1 byte block: 55 (DW_OP_reg5; )
...
DW_AT_name : (indirect string, offset: 0x3a): blah
...
DW_AT_location : 2 byte block: 91 8 (DW_OP_fbreg: 8; )
...
DW_AT_name : (indirect string, offset: 0x55): label
...
DW_AT_low_pc : 0x8048398 134513560
...
$ objdump -d a.out
...
08048398 <foo>:
8048398: 55 push %ebp
8048399: 89 e5 mov %esp,%ebp
804839b: c9 leave
804839c: c3 ret
804839d: 90 nop
...
>Fix:
I don't know any useful work-around, except liberally sprinkling
asm("")s all over the code.
>Release-Note:
>Audit-Trail:
>Unformatted: