public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/15360] New: can't step into function
@ 2013-04-11 23:49 dje at google dot com
  2013-04-11 23:56 ` [Bug breakpoints/15360] " dje at google dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dje at google dot com @ 2013-04-11 23:49 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 15360
           Summary: can't step into function
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dje@google.com
    Classification: Unclassified


Compiling this with -g, stepping into "function" doesn't work.

(gdb) start
Temporary breakpoint 1 at 0x400508: file foo.c, line 23.
Starting program: /home/dje/src/play/a.out

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe848) at foo.c:23
23        function();
(gdb) s
[Inferior 1 (process 19896) exited normally]
(gdb) 

struct foo
{
  int i;
  ~foo(){return;};
};


int function()
{
  do{
    int i = 0;
    int j = i + 4;
    foo bar;
    if(0)
      {
        continue;
      }
    return 1;
  }while(1);
}
int main (int argc, char* argv[])
{
  function();
  return 0;
}

-- 
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] 7+ messages in thread

* [Bug breakpoints/15360] can't step into function
  2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
@ 2013-04-11 23:56 ` dje at google dot com
  2013-04-12  8:52 ` palves at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dje at google dot com @ 2013-04-11 23:56 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from dje at google dot com 2013-04-11 23:56:44 UTC ---
gdb is putting the step-resume bkpt at the wrong place.

(gdb) disas function
Dump of assembler code for function function():
   0x00000000004004b4 <+0>:     push   %rbp
   0x00000000004004b5 <+1>:     mov    %rsp,%rbp
   0x00000000004004b8 <+4>:     push   %r12
   0x00000000004004ba <+6>:     push   %rbx
   0x00000000004004bb <+7>:     sub    $0x10,%rsp
   0x00000000004004bf <+11>:    jmp    0x4004c2 <function()+14>
   0x00000000004004c1 <+13>:    nop
   0x00000000004004c2 <+14>:    movl   $0x0,-0x18(%rbp)
   0x00000000004004c9 <+21>:    mov    -0x18(%rbp),%eax
   0x00000000004004cc <+24>:    add    $0x4,%eax
   0x00000000004004cf <+27>:    mov    %eax,-0x14(%rbp)
   0x00000000004004d2 <+30>:    mov    $0x1,%r12d
   0x00000000004004d8 <+36>:    mov    $0x1,%ebx
   0x00000000004004dd <+41>:    lea    -0x20(%rbp),%rax
   0x00000000004004e1 <+45>:    mov    %rax,%rdi
   0x00000000004004e4 <+48>:    callq  0x400514 <foo::~foo()>
   0x00000000004004e9 <+53>:    test   %ebx,%ebx
   0x00000000004004eb <+55>:    je     0x4004c1 <function()+13>
   0x00000000004004ed <+57>:    mov    %r12d,%eax
   0x00000000004004f0 <+60>:    add    $0x10,%rsp
   0x00000000004004f4 <+64>:    pop    %rbx
   0x00000000004004f5 <+65>:    pop    %r12
   0x00000000004004f7 <+67>:    pop    %rbp
   0x00000000004004f8 <+68>:    retq
End of assembler dump.
...
Temporary breakpoint 2, main (argc=1, argv=0x7fffffffe848) at foo.c:23
23        function();
(gdb) s
infrun: clear_proceed_status_thread (process 20005)
infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1)
infrun: resume (step=1, signal=0), trap_expected=0, current thread [process
20005] at 0x400508
infrun: wait_for_inferior ()
infrun: target_wait (-1, status) =
infrun:   20005 [process 20005],
infrun:   status->kind = stopped, signal = SIGTRAP
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4004b4
infrun: stepped into subroutine
infrun: inserting step-resume breakpoint at 0x4004c1
infrun: resume (step=0, signal=0), trap_expected=0, current thread [process
20005] at 0x4004b4
infrun: prepare_to_wait
infrun: target_wait (-1, status) =
infrun:   20005 [process 20005],
infrun:   status->kind = exited, status = 0
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_EXITED
[Inferior 1 (process 20005) exited normally]
infrun: stop_stepping

-- 
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] 7+ messages in thread

* [Bug breakpoints/15360] can't step into function
  2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
  2013-04-11 23:56 ` [Bug breakpoints/15360] " dje at google dot com
@ 2013-04-12  8:52 ` palves at redhat dot com
  2013-04-12 17:59 ` tromey at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-04-12  8:52 UTC (permalink / raw)
  To: gdb-prs

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

Pedro Alves <palves at redhat dot com> changed:

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

--- Comment #2 from Pedro Alves <palves at redhat dot com> 2013-04-12 08:52:17 UTC ---
A simpler reproducer:

 (gdb) b function
 Breakpoint 1 at 0x400569: file pr15360.c, line 9.
 (gdb) r
 ...
 ...exited normally.

GDB wants to put the breakpoint after the prologue of 'function', but:

(gdb) disassemble /m function
Dump of assembler code for function function():
8       {
   0x000000000040055c <+0>:     push   %rbp
   0x000000000040055d <+1>:     mov    %rsp,%rbp
   0x0000000000400560 <+4>:     push   %r12
   0x0000000000400562 <+6>:     push   %rbx
   0x0000000000400563 <+7>:     sub    $0x10,%rsp
   0x0000000000400567 <+11>:    jmp    0x40056a <function()+14>

9         do{
   0x0000000000400569 <+13>:    nop

10          int i = 0;
   0x000000000040056a <+14>:    movl   $0x0,-0x14(%rbp)

-- 
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] 7+ messages in thread

* [Bug breakpoints/15360] can't step into function
  2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
  2013-04-11 23:56 ` [Bug breakpoints/15360] " dje at google dot com
  2013-04-12  8:52 ` palves at redhat dot com
@ 2013-04-12 17:59 ` tromey at redhat dot com
  2013-04-12 18:16 ` palves at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2013-04-12 17:59 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

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

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2013-04-12 17:59:53 UTC ---
I think bug #12257 is related.
I think I tested changing the code mentioned there,
but I don't recall the results.

-- 
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] 7+ messages in thread

* [Bug breakpoints/15360] can't step into function
  2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
                   ` (2 preceding siblings ...)
  2013-04-12 17:59 ` tromey at redhat dot com
@ 2013-04-12 18:16 ` palves at redhat dot com
  2013-04-12 18:26 ` palves at redhat dot com
  2024-01-08 16:49 ` ssbssa at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-04-12 18:16 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Pedro Alves <palves at redhat dot com> 2013-04-12 18:16:00 UTC ---
Note that changing the code mentioned there wouldn't fix the simpler "b; run"
reproducer above.

-- 
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] 7+ messages in thread

* [Bug breakpoints/15360] can't step into function
  2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
                   ` (3 preceding siblings ...)
  2013-04-12 18:16 ` palves at redhat dot com
@ 2013-04-12 18:26 ` palves at redhat dot com
  2024-01-08 16:49 ` ssbssa at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-04-12 18:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Pedro Alves <palves at redhat dot com> 2013-04-12 18:26:38 UTC ---
I noticed Jan added a similar reproducer to

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52160

IMO, this is a GCC bug.

-- 
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] 7+ messages in thread

* [Bug breakpoints/15360] can't step into function
  2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
                   ` (4 preceding siblings ...)
  2013-04-12 18:26 ` palves at redhat dot com
@ 2024-01-08 16:49 ` ssbssa at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-08 16:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15360

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bkorb at gnu dot org

--- Comment #6 from Hannes Domani <ssbssa at sourceware dot org> ---
*** Bug 15784 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-01-08 16:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 23:49 [Bug breakpoints/15360] New: can't step into function dje at google dot com
2013-04-11 23:56 ` [Bug breakpoints/15360] " dje at google dot com
2013-04-12  8:52 ` palves at redhat dot com
2013-04-12 17:59 ` tromey at redhat dot com
2013-04-12 18:16 ` palves at redhat dot com
2013-04-12 18:26 ` palves at redhat dot com
2024-01-08 16:49 ` ssbssa at sourceware dot org

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).