From: Vladimir Prus <vladimir@codesourcery.com>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: =frame-selected MI notification
Date: Sat, 29 Aug 2009 07:53:00 -0000 [thread overview]
Message-ID: <200908291137.05884.vladimir@codesourcery.com> (raw)
In-Reply-To: <19096.47503.226488.945344@totara.tehura.co.nz>
On Saturday 29 August 2009 Nick Roberts wrote:
> > 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.
>
> I think Emacs, and other frontends that have a console, will always be
> interested in the current thread/selected frame. The behaviour of CLI
> commands like up, down, print etc depend on it.
It seems to me that if frontend has thread 3, frame 2 presently selected
in UI, then "print" in CLI should print the value of expression in thread
3, frame 3. To that end, frontend should emit the following command:
-interpreter-exec --thread 3 --frame 3 console "print whatever"
It does not seem like frontend need to know the value of the 'inferior_ptid' variable
in GDB source code to do that?
As I understand from talks with Dmitry on IRC, emacs already uses --thread and
--frame options as appropriate, so everything should just work. And, I also
assume that Emacs works just fine with the patch he posted.
> Of course, if GDB emits a notification then the frontend can always choose to
> ignore it.
How? GDB does not say if notification is emitted as result of internal thread
switch, or not, so frontend would need to consult an oracle to ignore notification.
> If GDB doesn't emit a notification then the frontend has to send
> an extra command to get the information it needs after after every user
> command.
>
> It's not only thread and frame changes that could be emitted as notifications.
> Setting, deleting, disabling breakpoints with CLI commands could also emit
> notifications. This would save having to send -break-list after every user
> command.
I think breakpoints are very different matter. Breakpoint table is an inherent
global property of debug session. You cannot sensibly have different breakpoint
tables in different IDE windows, or use different breakpoint tables for
different -exec-continue commands. Therefore, notifying a frontend about any
change to breakpoint table is uncontroversial change. We even have an
observer already -- breakpoints_changed -- that can be hooked to MI.
> > 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.
>
> I think it would be hard to write a large C program with no global variables
> but, in any case, the concept of current thread/selected frame seems to be a
> great convenience when using GDB from the command line.
It is convenient for command line GDB usage. This, however, does not mean that
global variable that affects all of gdb makes sense.
- Volodya
next prev parent reply other threads:[~2009-08-29 7:37 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
2009-08-29 5:40 ` Nick Roberts
2009-08-29 7:53 ` Vladimir Prus [this message]
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=200908291137.05884.vladimir@codesourcery.com \
--to=vladimir@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
--cc=nickrob@snap.net.nz \
/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