From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42513 invoked by alias); 12 Oct 2015 12:46:04 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 42503 invoked by uid 89); 12 Oct 2015 12:46:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f52.google.com Received: from mail-qg0-f52.google.com (HELO mail-qg0-f52.google.com) (209.85.192.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 12 Oct 2015 12:46:02 +0000 Received: by qgez77 with SMTP id z77so119307746qge.1 for ; Mon, 12 Oct 2015 05:46:00 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.140.100.182 with SMTP id s51mr30486604qge.25.1444653960489; Mon, 12 Oct 2015 05:46:00 -0700 (PDT) Received: by 10.55.168.196 with HTTP; Mon, 12 Oct 2015 05:46:00 -0700 (PDT) Date: Mon, 12 Oct 2015 12:46:00 -0000 Message-ID: Subject: Is that a GDB bug? From: Nancy To: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00052.txt.bz2 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