[haiku-bugs] [Haiku] #6751: gdb won't single step

  • From: "grahamh" <trac@xxxxxxxxxxxx>
  • Date: Mon, 25 Oct 2010 22:01:25 -0000

#6751: gdb won't single step
-----------------------------------------------+------------------------
   Reporter:  grahamh                          |       Owner:  nobody
       Type:  bug                              |      Status:  new
   Priority:  normal                           |   Milestone:  R1
  Component:  Applications/Command Line Tools  |     Version:  R1/alpha2
   Keywords:                                   |  Blocked By:
Has a Patch:  0                                |    Platform:  x86
   Blocking:                                   |
-----------------------------------------------+------------------------
 == Description ==

 The normal installed version of GDB doesn't seem to be able to single step
 through a C program. I am a bit dubious that this isn't "just me", as it's
 a pretty glaringly obvious problem. But I have reproduced it on physical
 hardware (Pentium III) and on VMWare, with GCC2 and GCC4, and with R1a2,
 R1 nightly and a gdb built locally from source.

 == How to reproduce ==

 {{{
 /data/j> uname -a
 Haiku shredder 1 r39138 Oct 25 2010 07:43:53 BePC Haiku

 # compile a simple test program

 /data/j> cat test.c
 #include <stdio.h>
 int main(int argc, char** argv) {
         int a, b, c;
         a = 1;
         b = a * 2;
         c = b * a * 4;
         printf("c = %d\n", c);
         return 0;
 }
 /data/j> gcc -g -O0 -o test test.c

 # this is using the default compiler on a GCC2 hybrid, but
 # the same thing happens if we switch to GCC4 (or even
 # my experimental build of tcc)

 /data/j> setgcc
 Current GCC: x86/gcc2

 # feed it to the debugger

 /data/j> gdb test
 GNU gdb 6.3
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i586-pc-haiku"...

 # run to the first line

 (gdb) start
 Breakpoint 1 at 0x857: file test.c, line 4.
 Starting program: /data/j/test
 Breakpoint 1 at 0x200857: file test.c, line 4.
 main (argc=1, argv=0x7ffef538) at test.c:4
 4               a = 1;

 # now try to single step

 (gdb) step
 0x0029acca in fstat@@LIBROOT_1_ALPHA1 () from /boot/system/lib/libroot.so

 # we have skipped several lines and stopped somewhere deep in printf()

 (gdb) bt
 #0  0x0029acca in fstat@@LIBROOT_1_ALPHA1 () from
 /boot/system/lib/libroot.so
 #1  0x002546e6 in _IO_file_stat () from /boot/system/lib/libroot.so
 #2  0x00253761 in _IO_file_doallocate () from /boot/system/lib/libroot.so
 #3  0x00255cc7 in _IO_doallocbuf () from /boot/system/lib/libroot.so
 #4  0x00253f6b in _IO_new_file_overflow () from
 /boot/system/lib/libroot.so
 #5  0x00254884 in _IO_new_file_xsputn () from /boot/system/lib/libroot.so
 #6  0x0026ceb4 in vfprintf () from /boot/system/lib/libroot.so
 #7  0x0026890c in printf () from /boot/system/lib/libroot.so
 #8  0x0020088f in main (argc=1, argv=0x7ffef538) at test.c:7
 (gdb)
 }}}

 For reference, here's the same thing done on Mac OS X 10.4

 {{{
 Breakpoint 1, main (argc=1, argv=0xbffffc70) at test.c:4
 4         a = 1;
 (gdb) step
 5         b = a * 2;
 (gdb) step
 6         c = b * a * 4;
 (gdb) step
 7         printf("c = %d", c);
 (gdb) step
 8         return 0;
 }}}

 Back on Haiku, another favourite response to "step" or "next" is:
 {{{
 0xffff0114 in ?? ()
 }}}

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6751>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: