public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Robert Rossi <bob@brasko.net>
Cc: GDB Development <gdb@sourceware.org>
Subject: Re: gdb/mi, new-ui. the console and determining when GDB is ready for the next command
Date: Tue, 05 Nov 2019 14:06:00 -0000	[thread overview]
Message-ID: <e2e44a56-4bd6-e5f1-9201-a9fa45ac8ef0@redhat.com> (raw)
In-Reply-To: <CA+L9JkjNN6WS-Uone-sWPOt_9WxCJ3bY0rBzpo66ZzkhVqt+SA@mail.gmail.com>

On 11/2/19 10:35 AM, Robert Rossi wrote:
> Huh. Here is my setup.
> 
> $ gdb --version
> GNU gdb (GDB) 8.3.1
> 
> On terminal one with gdb I have,
>   $ gdb  -q -ex "new-ui mi /dev/pts/11" ./test_main
>   Reading symbols from ./test_main...
>   New UI allocated
>   (gdb)
> Terminal 2 shows
>   $ tty
>   /dev/pts/13
>   $ sleep 1000
>   =thread-group-added,id="i1"
>   (gdb) <--- Good
> 
> So far everything is good. Now in terminal one I make a breakpoint.
> 
> Terminal 1 shows
>   (gdb) b main
>   Breakpoint 1 at 0x4006c0: file test.cpp, line 42.
>   (gdb)
> Terminal 2 shows
>   (gdb)
> 
> =breakpoint-created,bkpt={number="1",type="breakpoint",...,original-location="main"}
> <--- No GDB prompt
> 
> However it has no gdb prompt.

A gdb prompt indicates that GDB is ready to accept commands
again.

Here you have an asynchronous notification, which can appear
at any time.  GDB never stopped accepting commands since that
initial prompt.  So no new prompt.

> Now, if I run the program,
> 
> Terminal 1 shows,
>   (gdb) r
>   Starting program:.../test_main
> 
>   Breakpoint 1, main (argc=1, argv=0x7fffffffdea8) at test.cpp:42
>   42      {
>   (gdb)
> Terminal 2 shows
>   =thread-group-started,id="i1",pid="25913"
>   =thread-created,id="1",group-id="i1"
>   =library-loaded,id=...
>   =library-loaded,id="/lib/x86_6....
>   ~"\n"
>   ~"Breakpoint 1, main (argc=1, argv=0x7fffffffdea8) at test.cpp:42\n"
>   ~"42\t{\n"
>   *stopped,reason="breakpoint-hit",...stopped-threads="all",core="0"
>   <-- No GDB prompt
> 
> In this case also there is no gdb prompt.

Same thing here.  These are all asynchronous notifications.  GDB
is accepting MI commands before and after all these notifications,
even if the CLI channel isn't.  E.g., if you run a program that
doesn't hit a breakpoint, you'll get on the CLI:

(gdb) r
Starting program: /tmp/infinite-loop
iter 1
iter 2
iter 3
iter 4
...

while on the MI channel you get:

...
*running,thread-id="all"

and you can still issue commands there, while the program
is running:

 -data-evaluate-expression 1
 ^done,value="1"
 (gdb) 


> 
> Is this expected behavior or an oversight?
> 
It's expected.

Thanks,
Pedro Alves

  parent reply	other threads:[~2019-11-05 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 23:15 Robert Rossi
2019-10-25  9:58 ` Robert Rossi
2019-10-29 13:21 ` Pedro Alves
2019-11-02 10:35   ` Robert Rossi
2019-11-02 17:39     ` Jonah Graham
2019-11-05 14:06     ` Pedro Alves [this message]
2020-04-11 12:12       ` Bob Rossi
2020-04-11 14:09         ` Pedro Alves

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=e2e44a56-4bd6-e5f1-9201-a9fa45ac8ef0@redhat.com \
    --to=palves@redhat.com \
    --cc=bob@brasko.net \
    --cc=gdb@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).