Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Jim Blandy <jimb@red-bean.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Andrew STUBBS <andrew.stubbs@st.com>,
	gdb-patches@sources.redhat.com
Subject: Re: [PATCH] keep-variable command
Date: Thu, 17 Nov 2005 09:56:00 -0000	[thread overview]
Message-ID: <20051117035532.GD3057@nevyn.them.org> (raw)
In-Reply-To: <8f2776cb0511161528y372fde8cuaa7ddecf863f277a@mail.gmail.com>

On Wed, Nov 16, 2005 at 03:28:27PM -0800, Jim Blandy wrote:
> On 11/16/05, Andrew STUBBS <andrew.stubbs@st.com> wrote:
> > I feel certain that there is something somebody will not like about this
> > implementation, but I hope we can sort it out.
> 
> How did you know?  :)

I haven't even looked at the implementation yet; I'd like to talk about
the concept first.

For one thing, why is this a command at all?  If we support keeping
convenience variables across symbol file reloads, then why not do it by
default for all convenience variables?  I doubt having them disappear
has ever been considered a feature.

> It wouldn't, necessarily; certainly GDB still knows the meaning of
> 'int' given only the current architecture and the current language.  I
> don't see any reason we couldn't keep a convenience variable if all
> its types belonged to objfiles (according to type->objfile) that we
> were going to keep around.

This is a bit complicated by the fact that the objfile may define a
type named "int", so some care is in order...

> I believe if you say "set var $foo = 1", then $foo's type is one of
> the builtin type objects, whose objfile is NULL.  There's no reason to
> throw away convenience variables all of whose types were like this.

If true, this does improve things a bit.  Of course, pointers are just
as much of a problem.

> - Converting types to strings needs to be done in a
>   language-independent manner.  It's a shame that types don't seem to
>   point to a language.  But it would be better to use LA_PRINT_TYPE
>   than to build the name by hand.

Alternatively, we could add code to duplicate the types recursively
onto a convenience variable obstack.  GDB doesn't have much of a notion
of "type compatibility".  It might not work 100% right for things like
C++ operator overloading, but for that we'd need to do type merging
anyway.

> - Types can be local to some scope.  Even if you print out a type's
>   name, how can you discover what scope to re-parse it in?  Right now
>   you're just getting whatever happens to be in
>   expression_context_block, right?

This is a pre-existing disaster zone.  We have similar problems for
resetting breakpoints, IIRC (or else will eventually).

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  reply	other threads:[~2005-11-17  3:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-16 15:54 Andrew STUBBS
2005-11-16 20:26 ` Eli Zaretskii
2005-11-17  1:07   ` Jim Blandy
2005-11-17  9:56     ` Daniel Jacobowitz [this message]
2005-11-17 15:07       ` Andrew STUBBS
2005-11-17 12:42     ` Andrew STUBBS
2005-11-17 12:26   ` Andrew STUBBS
2005-11-17 19:33     ` Eli Zaretskii
2005-11-17 19:36       ` Daniel Jacobowitz

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=20051117035532.GD3057@nevyn.them.org \
    --to=drow@false.org \
    --cc=andrew.stubbs@st.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@red-bean.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