From: Simon Marchi <simon.marchi@ericsson.com>
To: Jan Vrany <jan.vrany@fit.cvut.cz>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFC 2/2] gdb/mi: add new async events =target-connected and =target-disconnected
Date: Thu, 18 Oct 2018 01:31:00 -0000 [thread overview]
Message-ID: <771a41a2-15e9-e8a6-ef66-767d4277a08d@ericsson.com> (raw)
In-Reply-To: <20181014125534.11724-3-jan.vrany@fit.cvut.cz>
On 2018-10-14 8:55 a.m., Jan Vrany wrote:
> Whenever a target is connected or disconnected, emit new asynchronous
> event =target-connected and =target-disconnected. Events report
> both short name and full name of connected or disconnected target.
> In addition, =target-connected report a set of target features.
>
> This allows frontends to keep track of current target and its features
> regardless whether target is changed explicitly by MI -target-select
> command, CLI target command or implicitly by native target auto-connect.
Thanks, I like the idea. A non-RFC version of this would require corresponding
tests to be accepted.
> @@ -1271,6 +1275,73 @@ mi_user_selected_context_changed (user_selected_what selection)
> }
> }
>
> +static void
> +mi_target_connected (struct target_ops *target)
> +{
> + SWITCH_THRU_ALL_UIS ()
> + {
> + struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
> + struct ui_out *mi_uiout;
> +
> + if (mi == NULL)
> + continue;
> +
> + mi_uiout = top_level_interpreter ()->interp_ui_out ();
> +
> + target_terminal::scoped_restore_terminal_state term_state;
> + target_terminal::ours_for_output ();
> +
> + fprintf_unfiltered (mi->event_channel,"target-connected");
> +
> + mi_uiout->redirect (mi->event_channel);
> +
> + mi_uiout->field_string ("type", target->shortname());
> + mi_uiout->field_string ("name", target->longname());
> +
> + {
> + ui_out_emit_list list_emitter (mi_uiout, "features");
> +
> + if (mi_async_p ())
> + mi_uiout->field_string (NULL, "async");
> + if (target_can_execute_reverse)
> + mi_uiout->field_string (NULL, "reverse");
> + }
> +
> + mi_uiout->redirect (NULL);
> +
> + gdb_flush (mi->event_channel);
> + }
> +}
I think there is a (kind of corner-case, but still) bug with using
mi_async_p and target_can_execute_reverse. Here are some CLI commands
I type in a "gdb -i mi", and the corresponding
=target-connected/disconnected event:
set mi-async on
file test
=target-connected,type="exec",name="Local exec file",features=[]
start
=target-connected,type="native",name="Native process",features=["async"]
record
=target-connected,type="record-full",name="Process record and replay target",features=["async","reverse"]
file
=target-disonnected,type="exec",name="Local exec file"
file /bin/ls
=target-connected,type="exec",name="Local exec file",features=["async","reverse"]
That last event says the exec target supports async and reverse, which is wrong.
So you would need to write an equivalent of mi_async_p/target_can_execute_reverse
to which you can pass a target_ops*, it should not be too hard.
Simon
next prev parent reply other threads:[~2018-10-18 1:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-14 12:55 [RFC 0/2] " Jan Vrany
2018-10-14 12:56 ` [RFC 1/2] gdb: add new observables target_connected and target_disconnected Jan Vrany
2018-10-14 12:56 ` [RFC 2/2] gdb/mi: add new async events =target-connected and =target-disconnected Jan Vrany
2018-10-14 15:02 ` Eli Zaretskii
2018-10-18 1:31 ` Simon Marchi [this message]
2018-11-22 14:20 ` Jan Vrany
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=771a41a2-15e9-e8a6-ef66-767d4277a08d@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.vrany@fit.cvut.cz \
/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).