This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

breakpoints/2080: New gcc prologue causes failures setting breakpoint at main


>Number:         2080
>Category:       breakpoints
>Synopsis:       New gcc prologue causes failures setting breakpoint at main
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 13 17:48:07 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Fred Fish
>Release:        all
>Organization:
>Environment:
Fedora core 4 on i686, native
>Description:
For programs compiled wiht the most recent development gcc, gdb sets a breakpoint at the first instruction of main instead of skipping main's prologue.  New gcc's support emitting stack alignment code which gdb's prologue scanner does not support.  For example:

main:
         leal    4(%esp), %ecx
         andl    $-16, %esp
         pushl   -4(%ecx)
         pushl   %ebp
         movl    %esp, %ebp
         pushl   %ecx
         call    foo
>How-To-Repeat:
$ cat t.c
void foo ()
{
}

main ()
{
  foo ();
}
$ gcc -S t.c
$ cat t.s
        .file   "t.c"
        .text
.globl foo
        .type   foo, @function
foo:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        ret
        .size   foo, .-foo
.globl main
        .type   main, @function
main:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ecx
        call    foo
        popl    %ecx
        popl    %ebp
        leal    -4(%ecx), %esp
        ret
        .size   main, .-main
        .ident  "GCC: (GNU) 4.2.0 20060212 (experimental)"
        .section        .note.GNU-stack,"",@progbits
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]