public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "brobecker at gnat dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-17525-4717-BM4Cumpkok@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-17525-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=17525

--- Comment #1 from Joel Brobecker <brobecker at gnat dot com> ---
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.


  reply	other threads:[~2014-10-30 18:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 18:23 [Bug gdb/17525] New: " brobecker at gnat dot com
2014-10-30 18:37 ` brobecker at gnat dot com [this message]
2015-01-13 17:57 ` [Bug gdb/17525] " palves at redhat dot com
2015-01-13 19:01 ` palves at redhat dot com
2015-01-13 21:03 ` dje at google dot com
2015-01-14 12:38 ` cvs-commit at gcc dot gnu.org
2015-01-14 12:43 ` cvs-commit at gcc dot gnu.org
2015-01-14 13:18 ` cvs-commit at gcc dot gnu.org
2015-01-14 13:48 ` palves at redhat dot com
2021-11-08  8:28 ` richardshodges7 at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17525-4717-BM4Cumpkok@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).