From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Maxime Coste <frrrwww@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] Add a select_frame_reason enum parameter to select_frame
Date: Mon, 06 May 2013 16:54:00 -0000 [thread overview]
Message-ID: <5187E029.8070008@redhat.com> (raw)
In-Reply-To: <87r4htxeth.fsf@fleche.redhat.com>
On 04/29/2013 09:27 PM, Tom Tromey wrote:
>>>>>> "Maxime" == Maxime Coste <frrrwww@gmail.com> writes:
>
> Maxime> select_frame calls specify if the frame is selected due to
> Maxime> a breakpoint/signal (REASON_STOP), a user command (REASON_USER)
> Maxime> or just as an implementation detail (REASON_IMPL_DETAIL) which
> Maxime> should restore the previous frame once finished.
>
> I don't mind this approach but I would like to hear from other
> maintainers.
I'm not sure I like the approach.
I couldn't find any use for the REASON_STOP/REASON_USER
distinction in the series. If there's a rationale for it,
it'd be good to hear it, otherwise it just looks like over engineering.
The (fi != selected_frame) check in the REASON_STOP
looks suspicious. Was the intent to prevent a notification
if the program stopped in the same function it was stopped
before it was resumed?
IMO, it'd be better to leave select_frame unaware of why it's being
called, and just add a wrapper for user visible frame selection.
It feels like different conceptual levels to me. IOW, something like:
void
select_user_frame (struct frame_info *fi)
{
int changed = (fi != selected_frame);
select_frame (fi);
if (changed)
observer_notify_frame_changed (fi);
}
But,
note that in non-stop mode, e.g., thread #2 may be running while
you inspect thread #1. If thread #2 stops for any reason, say, a breakpoint,
GDB switches temporarily to thread #2 to handle the event, and then that ends
up calling normal_stop and select_frame. The patch makes that a
user visible frame change. But, what happens is that GDB immediately
afterwards changes back to thread #1 (and its frame), using a cleanup, giving
the illusion that thread #1 was selected the whole time. This frame restore
is an IMPL_DETAIL select_frame in this approach, so I think the frame
change observer (python, in this case) ends up confused.
Another problematic case I can think of off hand, is around
errors. Say, the target is running, and while handling an
event, we error out, and normal_stop isn't reached.
I'm wondering whether we really need to call the frame change
observers for stops. We have stop notifications/observers in
both Python and MI, so it seems to be a script/frontend can
already get the info it needs from those.
If we limit frame change notifications to user frame changes
(CLI up/down/frame and MI equivalents), then these issues
with stops would be non-issues by design...
--
Pedro Alves
next prev parent reply other threads:[~2013-05-06 16:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 21:07 Add a python event registry for selected frame changes Maxime Coste
2013-04-26 21:09 ` [PATCH 1/3] Add a select_frame_reason enum parameter to select_frame Maxime Coste
2013-04-30 11:05 ` Tom Tromey
2013-04-30 11:53 ` Joel Brobecker
2013-05-06 16:54 ` Pedro Alves [this message]
2013-05-10 19:50 ` Tom Tromey
2013-05-14 13:23 ` Maxime Coste
2013-04-26 21:10 ` [PATCH 2/3] Add a frame_changed observer Maxime Coste
2013-04-30 10:51 ` Tom Tromey
2013-04-27 7:55 ` [PATCH 3/3] Add a gdb.events.frame_change event registry Maxime Coste
2013-04-30 11:07 ` Tom Tromey
2013-04-30 11:09 ` Tom Tromey
2013-04-30 10:53 ` Add a python event registry for selected frame changes Tom Tromey
2013-04-30 23:29 ` Maxime Coste
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=5187E029.8070008@redhat.com \
--to=palves@redhat.com \
--cc=frrrwww@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@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