From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10815 invoked by alias); 30 Oct 2014 18:37:40 -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 10791 invoked by uid 48); 30 Oct 2014 18:37:40 -0000 From: "brobecker at gnat dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/17525] target-async: breakpoint commands not executed when program run from -x script Date: Thu, 30 Oct 2014 18:37: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: brobecker at gnat 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-q4/txt/msg00166.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17525 --- Comment #1 from Joel Brobecker --- The script works fine when sourced from the GDB prompt, Eg: (gdb) source cmds.gdb [program runs to completion after hitting breakpoints 20 times] It also works when the script is piped to GDB's stdin: % cat cmds.gdb | gdb I think the difference is that the script is then executed as part of GDB's global main loop, which calls bpstat_do_actions at the end of each command's execution, whereas "-x cmds.gdb" just results in source_script being called. The latter ends up executing the "run" command from our script, with the associated call to bpstat_do_actions, which explains why the commands-list gets executed once, but then that's it. Adding bogus commands such as... echo echo echo echo ... each cause additional commands to be executed which themselves trigger bpstat_do_actions to be executed, thus each giving us back one of the missing iterations. But what we need is to be able to loop-until-we're-done after having sourced the script. One thing thats' interesting which might indicate that I'm missing something is the fact that after the debugger stops (too early), my prompt is not the one I would expect (through .gdbinit). At this point, if: - I press ctrl-d, then my normal prompt appears; - I type "bogus" as a command, GDB does: (gdb) bogus Undefined command: "bogus". Try "help". - I type a valid command, the command gets executed, and my program then resumes once: (gdb) print 1 $1 = 1 Breakpoint 1, increment (i=7) at foo.c:4 4 return i + 1; I have clearly missed something. -- You are receiving this mail because: You are on the CC list for the bug.