Bug 12680 - regression by physname: PE32 prologue skip vs. static initializers
Summary: regression by physname: PE32 prologue skip vs. static initializers
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.5
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-15 18:38 UTC by Jan Kratochvil
Modified: 2013-01-14 19:52 UTC (History)
3 users (show)

See Also:
Host:
Target: i686-pc-mingw32
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2011-04-15 18:38:42 UTC
int v; class C { public: C() { v++; } } c; int main () {}

i686-pc-mingw32-g++ -Wall -g
mingw32-gcc-c++-4.5.0-1.fc14.x86_64

PASS: pre-physname
GNU gdb (GDB) 7.1.50.20100309-cvs
Breakpoint 1 at 0x40133f: file ..., line 13.

FAIL: post-physname
GNU gdb (GDB) 7.3.50.20110415-cvs
Breakpoint 1 at 0x40133a: file ..., line 12.

Dump of assembler code for function main:
   0x00401334 <+0>:	push   %ebp
   0x00401335 <+1>:	mov    %esp,%ebp
   0x00401337 <+3>:	and    $0xfffffff0,%esp
<-- FAIL
   0x0040133a <+6>:	call   0x401530 <__main>
<-- PASS
   0x0040133f <+11>:	call   0x401322 <_Z1fv>
   0x00401344 <+16>:	mov    $0x0,%eax
   0x00401349 <+21>:	mov    %ebp,%esp
   0x0040134b <+23>:	pop    %ebp
   0x0040134c <+24>:	ret    

SYMBOL_LINKAGE_NAME was "main" before.  It is "main()" now for symtabs.
This breaks the skip_prologue_sal comparison for gdbarch_skip_main_prologue.

SYMBOL_LINKAGE_NAME is no longer a linkage name for symtabs, it is demangled now, such as `C::C(C const&)'.  SYMBOL_LINKAGE_NAME is mangled for minsyms.
SYMBOL_LINKAGE_NAME behaves differently for symbols vs. minsyms.

This is a regression by the patch:
        42284fdf9d8cdb20c8e833bdbdb2b56977fea525
        http://sourceware.org/ml/gdb-cvs/2010-03/msg00082.html
        dwarf2_physname patchset:
        [RFA] dwarf2_physname FINAL
        http://sourceware.org/ml/gdb-patches/2010-03/msg00220.html
Comment 1 Tom Tromey 2013-01-14 17:57:46 UTC
Is this still a problem?
With 7.1 and also with cvs trunk I get

(gdb) b main
Breakpoint 1 at 0x40136b: file pr.cc, line 1.
(gdb) disassemble main
Dump of assembler code for function main:
   0x00401360 <+0>:	push   %ebp
   0x00401361 <+1>:	mov    %esp,%ebp
   0x00401363 <+3>:	and    $0xfffffff0,%esp
   0x00401366 <+6>:	call   0x401a60 <__main>
   0x0040136b <+11>:	mov    $0x0,%eax
   0x00401370 <+16>:	leave  
   0x00401371 <+17>:	ret    


With 6.8 I get

(gdb) b main
Breakpoint 1 at 0x401366: file pr.cc, line 1.
Comment 2 Jan Kratochvil 2013-01-14 19:52:16 UTC
[RFC] symtab.c: Change skip_prologue_sal comparison to match main() too
http://sourceware.org/ml/gdb-patches/2012-03/msg00454.html
Message-ID: <20120313155817.44b4f280@mesquite.lan>

fda4b74499e5d26b718a51b84ec637e435997fa6 is the first bad (=good) commit
commit fda4b74499e5d26b718a51b84ec637e435997fa6
Author: Kevin Buettner <kevinb@redhat.com>
Date:   Wed Mar 21 21:59:12 2012 +0000

    	* symtab.c (skip_prologue_sal): Change test to check for "main()"
    	in addition to "main".