From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29530 invoked by alias); 24 Jul 2014 18:58:01 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 29015 invoked by uid 48); 24 Jul 2014 18:58:01 -0000 From: "eager at eagercon dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/17198] Batch cmd file abandoned when breakpoint hit Date: Thu, 24 Jul 2014 18:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eager at eagercon dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q3/txt/msg00148.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17198 --- Comment #1 from eager at eagercon dot com --- I noticed some unexpected behavior with a batch command file which calls a target function and encounters a breakpoint. The batch command file is abandoned, rather than continuing to be executed following the breakpoint. $ cat t.c #include void foo (int a) { printf ("a = %d\n", a); } void main (void) { foo (123); } $cat gdb.cmd b main b foo run call foo(234) p a c $ gdb -x gdb.cmd t ... Breakpoint 1 at 0x400551: file t.c, line 7. Breakpoint 2 at 0x400537: file t.c, line 3. Breakpoint 1, main () at t.c:7 7 foo (123); Breakpoint 2, foo (a=234) at t.c:3 3 printf ("a = %d\n", a); gdb.cmd:4: Error in sourced command file: The program being debugged stopped while in a function called from GDB. Evaluation of the expression containing the function (foo) will be abandoned. When the function is done executing, GDB will silently stop. (gdb) The breakpoint during the target function call apparently causes gdb to decide that there is an error in the batch file which it abandons. Subsequent commands in the batch file are ignored. It doesn't seem to matter whether the target generates an interrupt from a breakpoint or a SEGV. If run with --batch --command instead of -x, gdb terminates rather than generating the CLI prompt, but does not execute the remaining commands. Being able to include commands in a batch command file which are executed after a brakepoint is hit is useful in a couple cases. The first is to create a script which demonstrates a gdb bug. Second is for automated testing. -- You are receiving this mail because: You are on the CC list for the bug.