http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50544
Bug #: 50544 Summary: Wrong esp offset in debug infos for functions that call stdcall functions Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: bernhardl...@googlemail.com Created attachment 25372 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25372 compile with -g -O2 In the attached program, f2 disassambles to this: 0x08048400 <+0>: sub $0x1c,%esp 0x08048403 <+3>: mov 0x8049708,%eax 0x08048408 <+8>: mov %eax,(%esp) 0x0804840b <+11>: call 0x80483e0 <f> 0x08048410 <+16>: sub $0x4,%esp 0x08048413 <+19>: add $0x1c,%esp 0x08048416 <+22>: ret If one places a breakpoint at 0x08048410 the stack looks like this: Breakpoint 1, 0x08048410 in f2 () at asdf.c:20 20 f(x); (gdb) bt #0 0x08048410 in f2 () at asdf.c:20 #1 0x08048420 in ?? () #2 0x4dedd413 in __libc_start_main (main=0x8048310 <main>, argc=1, ubp_av=0xbffff724, init=0x8048420 <__libc_csu_init>, fini=0x8048490 <__libc_csu_fini>, rtld_fini=0x4deb1dd0 <_dl_fini>, stack_end=0xbffff71c) at libc-start.c:226 #3 0x08048341 in _start () For 0x08048413, it looks as it should: #0 f2 () at asdf.c:22 #1 0x0804831b in main (argc=1, argv=0xbffff724) at asdf.c:27 I would guess that the frame adjustment DWARF op is not emitted for the instruction at 0x08048410. Normally this wouldn't be much of a problem, but wine hits this sometimes with the way it sets up windows exceptions, which makes this very annoying. gcc version is Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.1/lto-wrapper Target: i686-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux Thread model: posix gcc version 4.6.1 20110804 (Red Hat 4.6.1-7) (GCC)