From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: Re: =frame-selected MI notification
Date: Fri, 28 Aug 2009 06:44:00 -0000 [thread overview]
Message-ID: <h77sng$i8o$1@ger.gmane.org> (raw)
In-Reply-To: <m3k50pq8vl.fsf@fleche.redhat.com>
Tom Tromey wrote:
>>>>>> "Dmitry" == Dmitry Dzhus <dima@sphinx.net.ru> writes:
>
> Dmitry> Nick Roberts once posted a patch which implements both =thread-selected
> Dmitry> and =frame-selected via observers:
> Dmitry> http://sourceware.org/ml/gdb-patches/2008-04/msg00377.html.
>
> I didn't see any discussion of this patch in the archives.
> Was it just forgotten?
>
> In general I think that it makes sense to have MI notifications for
> state changes caused by CLI commands.
>
> Dmitry> Current implementation of =thread-selected in mi-main.c uses a
> Dmitry> different approach, comparing current thread ID before and after
> Dmitry> executing a command in `mi_execute_command` function. My patch
> Dmitry> does the same for frame level. I don't know how is it
> Dmitry> technically better. I think it would be nice if somebody
> Dmitry> reviewed Nick's patch once again or at least accepted the one
> Dmitry> proposed by me.
>
> I tend to prefer Nick's approach. I like the use of observers.
I'll review this patch later, but I wanted to clarify this point. The current
codebase emits =thread-selected already, and it does not use observers,
by design. The reason is that MI frontend is not actually interested in
changes in GDB's current thread. The design I am pushing for is that
frontend maintains the current thread and frame (possibly, different for different
main window, even) and uses --thread and --frame options to MI commands to
obtain necessary information in the context of the desired thread.
The only thing frontend might want to know from GDB is that a CLI command
has explicitly asked to change thread or frame -- in which case frontend
might want to switch its own current thread or frame. To reiterate,
frontend does not care about thread or frame switches that GDB might
do internally.
It was decided that the easiest way to detect such explicit request
from the user is to note that thread has changed after an MI command
was executed. It seems reasonable to apply the same logic to frame.
Furthermore, I do not think that observers for either thread or frame
changes is good idea, design wise. The fact that gdb has current thread
or current frame at the code level, is, IMNSHO, a design bug. Global
variables are generally bad, and those two are certainly not exception.
It's better not to make situation worse by adding new mechanism based
on that design bug.
- Volodya
next prev parent reply other threads:[~2009-08-28 6:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-27 17:01 Dmitry Dzhus
2009-08-27 20:54 ` Tom Tromey
2009-08-28 6:44 ` Vladimir Prus [this message]
2009-08-29 5:40 ` Nick Roberts
2009-08-29 7:53 ` Vladimir Prus
2009-08-31 23:11 ` Tom Tromey
2009-09-01 15:13 ` Dmitry Dzhus
2009-08-31 23:19 ` Tom Tromey
2009-09-01 5:35 ` Vladimir Prus
2009-09-02 19:35 ` Tom Tromey
2009-09-01 18:54 ` Dmitry Dzhus
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='h77sng$i8o$1@ger.gmane.org' \
--to=vladimir@codesourcery.com \
--cc=gdb-patches@sources.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