From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Bail out of processing stop if hook-stop resumes target / changes context
Date: Tue, 25 Aug 2015 15:48:00 -0000 [thread overview]
Message-ID: <55DC8E2C.6010308@redhat.com> (raw)
In-Reply-To: <86zj1n1ycy.fsf@gmail.com>
On 08/19/2015 09:22 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
> Hi Pedro,
>
>> - if (stop_command)
>> - catch_errors (hook_stop_stub, stop_command,
>> - "Error while running hook_stop:\n", RETURN_MASK_ALL);
>> + if (stop_command != NULL)
>> + {
>> + struct stop_context *saved_context = save_stop_context ();
>> + struct cleanup *old_chain
>> + = make_cleanup (release_stop_context_cleanup, saved_context);
>> +
>> + catch_errors (hook_stop_stub, stop_command,
>> + "Error while running hook_stop:\n", RETURN_MASK_ALL);
>> +
>> + /* If the stop hook resumes the target, then there's no point in
>> + trying to notify about the previous stop; its context is
>> + gone. Likewise if the command switches thread or inferior --
>> + the observers would print a stop for the wrong
>> + thread/inferior. */
>> + if (stop_context_changed (saved_context))
>> + {
>> + do_cleanups (old_chain);
>> + return 1;
>> + }
>> + do_cleanups (old_chain);
>> + }
>
> I am wondering why don't we let interpreter in async to execute
> stop_command, and we simply return here. In this way, we don't have to
> know whether stop_command resumes the target or switches the thread.
> Once there is no event from event loop, the target really stops and
> hook-stop is already executed.
Not sure I understood the suggestion -- I don't see how that would end
up being different. If the hook-stop does "continue&", then we still need
to know that the target was resumed. Likewise if the hook-stop just
does "thread N" and thus switches to another thread -- there's no
execution involved in that case so seems to me interpreter async/sync
makes no difference.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-08-25 15:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 18:33 Pedro Alves
2015-08-19 8:22 ` Yao Qi
2015-08-25 15:48 ` Pedro Alves [this message]
2015-08-27 13:35 ` Yao Qi
2015-09-09 19:21 ` Pedro Alves
2015-09-11 14:56 ` Yao Qi
2015-09-14 14:50 ` 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=55DC8E2C.6010308@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.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).