public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/12644] New: GDB steps over function
@ 2011-04-06 18:03 jengelh at medozas dot de
  2011-04-06 18:05 ` [Bug gdb/12644] " jan.kratochvil at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jengelh at medozas dot de @ 2011-04-06 18:03 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12644

           Summary: GDB steps over function
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jengelh@medozas.de


Using below's example, gdb's single stepping steps over the call to f.


Reading symbols from /dev/shm/d...done.
(gdb) b main
Breakpoint 1 at 0x40055a: file d.c, line 17.
(gdb) r
Starting program: /dev/shm/d 
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C 
"debuginfo(build-id)=b1d398a5cb1609e7ac1c51a26588e87fc20f753c"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C 
"debuginfo(build-id)=1493bf69b1d671cbad9be1d1b0284fbd9138444b"

Breakpoint 1, main () at d.c:17
17              f(0);
(gdb) s
Foo

Program exited normally.
(gdb) 
---

gdb --version:
GNU gdb (GDB) SUSE (7.2-3.3)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show 
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.


Testcase:
---
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

static void f(bool c)
{
        do {
                if (c)
                        continue;
                printf("Foo\n");
                return;
        } while (true);
}

int main(void)
{
        f(0);
        return EXIT_SUCCESS;
}

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/12644] GDB steps over function
  2011-04-06 18:03 [Bug gdb/12644] New: GDB steps over function jengelh at medozas dot de
@ 2011-04-06 18:05 ` jan.kratochvil at redhat dot com
  2011-04-06 18:16 ` jan.kratochvil at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-04-06 18:05 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12644

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/12644] GDB steps over function
  2011-04-06 18:03 [Bug gdb/12644] New: GDB steps over function jengelh at medozas dot de
  2011-04-06 18:05 ` [Bug gdb/12644] " jan.kratochvil at redhat dot com
@ 2011-04-06 18:16 ` jan.kratochvil at redhat dot com
  2011-04-06 18:22 ` jan.kratochvil at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-04-06 18:16 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12644

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2011-04-06 18:16:49 UTC ---
625c318cdc3f4cda81d28a76878827b3930de728 is the first bad commit
commit 625c318cdc3f4cda81d28a76878827b3930de728
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Dec 9 16:09:49 2010 +0000

    gdb
        PR c++/9593:
        * thread.c (clear_thread_inferior_resources): Call
        delete_longjmp_breakpoint.
        * infrun.c (handle_inferior_event): Handle exception breakpoints.
        (handle_inferior_event): Likewise.
        (insert_exception_resume_breakpoint): New function.
        (check_exception_resume): Likewise.
        * inferior.h (delete_longjmp_breakpoint_cleanup): Declare.
        * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static.
        (step_1): Set thread's initiating frame.
        (until_next_continuation): New function.
        (until_next_command): Support exception breakpoints.
        (finish_command_continuation): Delete longjmp breakpoint.
        (finish_forward): Support exception breakpoints.
        * gdbthread.h (struct thread_info) <initiating_frame>: New field.
        * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume,
        bp_exception_master>: New constants.
        (struct bpstat_what) <is_longjmp>: New field.
        (set_longjmp_breakpoint): Update.
        * breakpoint.c (create_exception_master_breakpoint): New function.
        (update_breakpoints_after_exec): Handle bp_exception_master.  Call
        create_exception_master_breakpoint.
        (print_it_typical): Handle bp_exception_master, bp_exception.
        (bpstat_stop_status): Handle bp_exception_master.
        (bpstat_what): Handle bp_exception_master, bp_exception,
        bp_exception_resume.
        (bptype_string): Likewise.
        (print_one_breakpoint_location): Likewise.
        (allocate_bp_location): Likewise.
        (set_longjmp_breakpoint): Handle exception breakpoints.  Change
        interface.
        (delete_longjmp_breakpoint): Handle exception breakpoints.
        (mention): Likewise.
        (struct until_break_command_continuation_args) <thread_num>: New
        field.
        (until_break_command_continuation): Call
        delete_longjmp_breakpoint.
        (until_break_command): Support exception breakpoints.
        (delete_command): Likewise.
        (breakpoint_re_set_one): Likewise.
        (breakpoint_re_set): Likewise.
    gdb/testuite
        * gdb.java/jnpe.java: New file.
        * gdb.java/jnpe.exp: New file.
        * gdb.cp/nextoverthrow.exp: New file.
        * gdb.cp/nextoverthrow.cc: New file.

:040000 040000 5eb449c38335ac6b198ccd533359cffc2129893c
a04460741d33198c498f46ceca10a839c8f8dd12 M    gdb
bisect run success

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/12644] GDB steps over function
  2011-04-06 18:03 [Bug gdb/12644] New: GDB steps over function jengelh at medozas dot de
  2011-04-06 18:05 ` [Bug gdb/12644] " jan.kratochvil at redhat dot com
  2011-04-06 18:16 ` jan.kratochvil at redhat dot com
@ 2011-04-06 18:22 ` jan.kratochvil at redhat dot com
  2011-04-07 16:13 ` tromey at redhat dot com
  2011-04-29 17:57 ` jan.kratochvil at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-04-06 18:22 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12644

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware    |tromey at redhat dot com
                   |dot org                     |

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/12644] GDB steps over function
  2011-04-06 18:03 [Bug gdb/12644] New: GDB steps over function jengelh at medozas dot de
                   ` (2 preceding siblings ...)
  2011-04-06 18:22 ` jan.kratochvil at redhat dot com
@ 2011-04-07 16:13 ` tromey at redhat dot com
  2011-04-29 17:57 ` jan.kratochvil at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at redhat dot com @ 2011-04-07 16:13 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12644

--- Comment #2 from Tom Tromey <tromey at redhat dot com> 2011-04-07 16:13:19 UTC ---
I suspect this is a GCC bug.

I ran this with 'set debug infrun 1'.  In the output I see:

infrun: stop_pc = 0x8048474
infrun: stepped into subroutine
infrun: inserting step-resume breakpoint at 0x8048482

This happens when the 'step' enters 'f'.  Then GDB sees that 0x8048474
is the start of 'f', so it sets a step-resume breakpoint at the point
where the prologue ends.

Here is 'f':

(gdb) disas 0x8048482
Dump of assembler code for function f(bool):
   0x08048474 <+0>:    push   %ebp
   0x08048475 <+1>:    mov    %esp,%ebp
   0x08048477 <+3>:    sub    $0x28,%esp
   0x0804847a <+6>:    mov    0x8(%ebp),%eax
   0x0804847d <+9>:    mov    %al,-0xc(%ebp)
   0x08048480 <+12>:    jmp    0x8048483 <f(bool)+15>
   0x08048482 <+14>:    nop
   0x08048483 <+15>:    cmpb   $0x0,-0xc(%ebp)
   0x08048487 <+19>:    jne    0x8048482 <f(bool)+14>
   0x08048489 <+21>:    movl   $0x8048584,(%esp)
   0x08048490 <+28>:    call   0x804839c <puts@plt>
   0x08048495 <+33>:    leave  
   0x08048496 <+34>:    ret    

That is, GCC says that the prologue ends at <f+14>.
But we never actually reach that PC.

Maybe it is a GDB bug somewhere else.
In any case I don't think the next-over-throw patch is to blame.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/12644] GDB steps over function
  2011-04-06 18:03 [Bug gdb/12644] New: GDB steps over function jengelh at medozas dot de
                   ` (3 preceding siblings ...)
  2011-04-07 16:13 ` tromey at redhat dot com
@ 2011-04-29 17:57 ` jan.kratochvil at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-04-29 17:57 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12644

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2011-04-29 17:56:51 UTC ---
(In reply to comment #1)
> 625c318cdc3f4cda81d28a76878827b3930de728 is the first bad commit

I was wrong, the problem is unrelated to this GDB commit.


(In reply to comment #2)
> I suspect this is a GCC bug.

I agree, thanks for the investigation, filed:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48827

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-29 17:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06 18:03 [Bug gdb/12644] New: GDB steps over function jengelh at medozas dot de
2011-04-06 18:05 ` [Bug gdb/12644] " jan.kratochvil at redhat dot com
2011-04-06 18:16 ` jan.kratochvil at redhat dot com
2011-04-06 18:22 ` jan.kratochvil at redhat dot com
2011-04-07 16:13 ` tromey at redhat dot com
2011-04-29 17:57 ` jan.kratochvil at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).