Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Single stepping a simple C-program, but...
@ 2008-05-19 20:19 Peter Toft
  2008-05-19 20:39 ` Daniel Jacobowitz
  2008-05-19 20:48 ` Pedro Alves
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Toft @ 2008-05-19 20:19 UTC (permalink / raw)
  To: gdb

Hi guys

I was a bit surprised today with GDB, and I hope one of you can explain it 
to me. Take a look at http://pastebin.org/37117
Press download and save as my_program.c
$ gcc -g my_program.c
$ gdb ./a.out
(gdb) br 7
Breakpoint 1 at 0x804838c: file my_program.c, line 7.
(gdb) r
Starting program: /home/pto/c/a.out

Breakpoint 1, main () at my_program.c:7
7	  if ((ii>3) || (ii<1))
(gdb) s
8	    printf("hej A\n");
(gdb) s
hej A
7	  if ((ii>3) || (ii<1))     <----------- WHY!!!!??
(gdb) s
12	  return 0;

-------

Why does the second "step" i.e. "s" take me BACK to line 7 after I 
have been in line 8????


Best

-- 
Peter Toft, Ph.D. [pto@linuxbog.dk] http://petertoft.dk


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

end of thread, other threads:[~2008-05-20 18:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-19 20:19 Single stepping a simple C-program, but Peter Toft
2008-05-19 20:39 ` Daniel Jacobowitz
2008-05-20  7:19   ` Peter Toft
2008-05-19 20:48 ` Pedro Alves
2008-05-19 22:39   ` Pedro Alves
2008-05-20  7:11     ` Peter Toft
2008-05-20 11:05       ` Pedro Alves
2008-05-20 18:33     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox