public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 9/9] enable target-async
Date: Fri, 15 Nov 2013 00:45:00 -0000	[thread overview]
Message-ID: <87li0qve9y.fsf@fleche.redhat.com> (raw)
In-Reply-To: <52828856.9070904@redhat.com> (Pedro Alves's message of "Tue, 12	Nov 2013 19:58:14 +0000")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> static int
>> mi_interpreter_prompt_p (void *data)
>> {

Pedro> Looks quite odd for a predicate function to actually have
Pedro> side effects.  I guess this is the hack you mentioned?
Pedro> I think this is missing a comment explaining what is
Pedro> going on.  It's not obvious at all to me.

Yeah, this is the biggest hack.
I will try to comment it some more.

The fundamental issue here I ran into is that MI is very odd about when
it prints a prompt.  So, the hacks are needed to keep the behavior
consistent -- even though, IMNSHO, the behavior doesn't actually make
any sense.

I don't even see why MI needs a prompt, but of course that can't be
addressed until someone wants to roll out MI3.

>> cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");
>> -      if (target_can_async_p ())
>> +      if (mi_target_can_async_p ())
>> ui_out_field_string (uiout, NULL, "async");
>> if (target_can_execute_reverse)
>> ui_out_field_string (uiout, NULL, "reverse");

Pedro> Hmm, not sure this is right.  This supposedly returns the set of
Pedro> supported features.  But mi_target_can_async_p returns false
Pedro> until the frontend enables target-async.  So this change creates
Pedro> a sort of chicken and egg situation.

That is what I thought, too, but IIRC if one changes this, then a test
will fail.

Also it is consistent with what gdb does today:

    (gdb) 
    -list-target-features
    ^done,features=[]
    (gdb) 
    set target-async on
    &"set target-async on\n"
    ^done
    (gdb) 
    -list-target-features
    ^done,features=["async"]
    (gdb) 

Strange but true.  Actually I think this is symptomatic of the general
issue where MI paid attention to "set target-async", whereas I think in
a clean design it would not.

>> -# so the stop reason is printed into MI uiout an.
>> -if {$async} {
>> -    set reason "end-stepping-range"
>> -} else {
>> -    set reason ""
>> -}
>> +set reason "end-stepping-range"

Pedro> I'm a little confused by this one.  Isn't it still necessary
Pedro> for targets that don't do async?

Not sure if you remember the story.

When I started this project I was working under the belief that "set
target-async" was a "please enable a feature" sort of option -- that is,
it ought to have no user visible effect other than making the "&"
feature available; and as such I could simply enable it always, fix the
test suite failures, and deprecate the option.

However, it turns out that this model did not fit the reality.  MI used
the target-async setting not just to put the target into async mode and
to enable the "&" feature, but also to change its output style in
various spots.

There's a thread you can dig up where Marc Khouzam says they changed
Eclipse to disable target-async explicitly, just to work around the
oddities that ensued.


For this test case the check may in fact be irrelevant, since we aren't
enabling target-async.  However if that is so, we might as well drop it
anyway on account of clarity.

Or maybe this is intended to support running the test suite with some
pre-canned MI sequence to enable target async.  I would guess nobody
ever does this, since I think when I tried something like this (naively
setting target_async_permitted = 1), stuff broke all over.  Which is
apparently intentional.

Tom

  reply	other threads:[~2013-11-14 21:56 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 17:59 [PATCH v4 0/9] enable target-async by default Tom Tromey
2013-10-22 17:59 ` [PATCH v4 1/9] fix latent bugs in ui-out.c Tom Tromey
2013-10-28 15:20   ` Pedro Alves
2013-10-28 17:36     ` Tom Tromey
2013-10-22 17:59 ` [PATCH v4 3/9] add target method delegation Tom Tromey
2013-10-28 16:05   ` Pedro Alves
2013-10-28 17:51     ` Tom Tromey
2013-10-28 17:53       ` Tom Tromey
2013-10-29 20:55         ` Tom Tromey
2013-11-08 17:44           ` Pedro Alves
2013-12-11 22:03             ` Tom Tromey
2013-12-12  2:46               ` Tom Tromey
2013-12-13 22:07                 ` Tom Tromey
2013-12-16 13:07                   ` Pedro Alves
2013-12-16 21:21                     ` Tom Tromey
2013-12-17 16:17                       ` Pedro Alves
2013-12-18 18:29                         ` Tom Tromey
2013-12-18 22:06                           ` Tom Tromey
2013-12-19 16:03                             ` Pedro Alves
2013-12-19 16:15                               ` Tom Tromey
2013-12-20 19:24                                 ` Tom Tromey
2013-11-08 16:34       ` Pedro Alves
2013-10-22 17:59 ` [PATCH v4 4/9] PR gdb/13860: make -interpreter-exec console "list" behave more like "list" Tom Tromey
2013-10-22 17:59 ` [PATCH v4 2/9] add "this" pointers to more target APIs Tom Tromey
2013-10-28 16:04   ` Pedro Alves
2013-10-28 16:37     ` Tom Tromey
2013-10-28 16:44       ` Pedro Alves
2013-10-28 16:52         ` Tom Tromey
2013-11-08 18:04           ` Pedro Alves
2013-11-08 21:53             ` Tom Tromey
2013-11-09  3:35               ` Pedro Alves
2013-12-06 17:40                 ` Tom Tromey
2013-12-06 18:35                   ` Pedro Alves
2013-12-06 18:23                 ` Tom Tromey
2013-12-06 19:06                   ` Pedro Alves
2013-10-22 17:59 ` [PATCH v4 5/9] PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output Tom Tromey
2013-10-22 18:11 ` [PATCH v4 8/9] fix py-finish-breakpoint.exp with always-async Tom Tromey
2013-11-11 19:51   ` Pedro Alves
2013-12-09 17:53     ` Tom Tromey
2013-10-22 18:26 ` [PATCH v4 9/9] enable target-async Tom Tromey
2013-10-22 20:15   ` Eli Zaretskii
2013-11-11 19:54   ` Pedro Alves
2013-11-12 20:53   ` Pedro Alves
2013-11-15  0:45     ` Tom Tromey [this message]
2013-11-18 15:42       ` Pedro Alves
2013-12-06 20:44         ` Tom Tromey
2013-12-09 12:01           ` Pedro Alves
2013-12-09 15:57             ` Tom Tromey
2014-02-21 20:23               ` Tom Tromey
2014-02-24 17:38           ` Tom Tromey
2013-10-22 18:26 ` [PATCH v4 6/9] PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode Tom Tromey
2013-10-22 19:00 ` [PATCH v4 7/9] make dprintf.exp pass in always-async mode Tom Tromey
2013-11-12  0:05   ` 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=87li0qve9y.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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).