Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Is that a GDB bug?
@ 2015-10-12 12:46 Nancy
  2015-10-12 13:20 ` Mike Frysinger
  2015-10-12 14:14 ` Pedro Alves
  0 siblings, 2 replies; 7+ messages in thread
From: Nancy @ 2015-10-12 12:46 UTC (permalink / raw)
  To: gdb

Hi,

Why line 5 execute twice?   Is that a GDB bug?

debug.c :
     1    int main()
     2    {
     3        int x;
     4        x=0;
     5        L1: switch(x) { case 0: x=1; goto L1;  case 1: if(x==0)
goto L1; else break; }
     6        x=2;
     7    }

$ gcc -O0 -g debug.c -o debug
$ gdb debug
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
....................
Reading symbols from debug...done.
(gdb) b 5
Breakpoint 1 at 0x80483fa: file debug.c, line 5.
(gdb) r
Starting program: /mnt/hgfs/cygwin/tmp/debug

Breakpoint 1, main () at debug.c:5
5        L1: switch(x) { case 0: x=1; goto L1;  case 1: if(x==0) goto
L1; else break; }
(gdb) n

Breakpoint 1, main () at debug.c:5
5        L1: switch(x) { case 0: x=1; goto L1;  case 1: if(x==0) goto
L1; else break; }
(gdb) n
6        x=2;


-- 
Best Regards,
Yu Rong Tan


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

end of thread, other threads:[~2015-10-12 16:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 12:46 Is that a GDB bug? Nancy
2015-10-12 13:20 ` Mike Frysinger
2015-10-12 13:32   ` Andreas Schwab
2015-10-12 16:39     ` Mike Frysinger
2015-10-12 16:56       ` Simon Marchi
2015-10-12 16:59       ` Andreas Schwab
2015-10-12 14:14 ` Pedro Alves

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