Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: Ross Morley <ross@tensilica.com>
Cc: Maxim Grigoriev <maxim@tensilica.com>,
	 gdb@sourceware.org, 	  Marc Gauthier <marc@tensilica.com>,
		  Pete MacLiesh <pmac@tensilica.com>
Subject: Re: Understanding GDB frames
Date: Thu, 24 May 2007 21:56:00 -0000	[thread overview]
Message-ID: <m3sl9lhomg.fsf@codesourcery.com> (raw)
In-Reply-To: <4654E93A.7090801@tensilica.com> (Ross Morley's message of "Wed, 23 May 2007 18:24:10 -0700")

Ross Morley <ross@tensilica.com> writes:
>>> But what we do need is to clarify our semantics so
>>>
>>>> that front ends know what to expect.  Should varobjs be destroyed when
>>>> we leave and re-enter a function?  If the answer is "maybe", then that
>>>> is confusing enough to deserve some more explanation :-)
>>>
>>>  
>>>
>> seems to be an unambiguous "no".
>>
>> This begs the question: when should GDB destroy a varobj?
>
> I need to revisit this. It's not clear that GDB destroys a varobj
> at all unless the GUI tells it to. It seems GDB tells the GUI the
> varobj went out of scope, and the GUI then doesn't update it. The
> GUI's concept of scope is different than the language concept. A
> var is considered in_scope if an instance of its function exists in
> the stack frame (*). So perhaps GDB should not say it's not in_scope
> if any instance of it still exists, even if it's a different instance
> than when the varobj was created. That is, the frame ID should not
> determine whether a varobj is in_scope for MI. A mere search of the
> frame stack for any frame with the same entrypoint (same function)
> should indicate in_scope.
>
> (*) Before GDB 6 and the new frame ID, it seems varobj.c looked
>    for the frame address still being in the stack. So it may be
>    that MI considers a var "in scope" if its function is still
>    on the stack at the same level, but not if it's at a different
>    level. This seems less ideal for the GUI but is what GDB achieves
>    when frame ID uses only stack ptr and PC at function entry.
>
> To avoid possibly breaking assumptions made by MI clients, it might
> be best to simply require that a gdbarch compute frame IDs based
> only on frame location in stack(s) and function entrypoint (and
> explicitly NOT try to make frame ID represent a unique instantiation
> of a function). This requires no change to generic GDB. If GUI people
> think it would provide better behavior and can ensure their GUIs don't
> rely on the present behavior, GDB could in future relax its in_scope
> determination for MI vars.

Well, GDB uses frame IDs itself in many different ways, not just for
MI.  Frame IDs are the only thing in GDB that can represent a frame
from one program pause to the next.  So they're used to implement
'next', 'finish', and so on.  For those purposes, frame IDs need to be
as precise as is practical.  If we could, we'd give every frame ever
pushed a unique ID.  We need to work out how to get the behavior GUIs
want from varobjs in terms of those ideal frame IDs.

Varobjs are really just little bits of GUI state living inside of GDB,
for speed.  GDB's job is to keep the GUI up to date on how the GUI's
varobjs relate to the program's current state.  I don't think GDB
should ever delete a varobj itself, except perhaps by prior
arrangement with the GUI, for the GUI's convenience.

I'd expect the most common use is for varobjs to correspond to GUI
expression/variable displays, where the user adds and removes entries.
In this use case, having GDB ever delete varobjs is just a pain: the
GUI wants them to stick around until some instance of the variable
comes back into scope.  It's unclear what should happen as the program
runs and as the user selects different frames; I have some questions
about that that I'll post separately.


      reply	other threads:[~2007-05-24 21:56 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 22:24 Maxim Grigoriev
2007-05-21 23:28 ` Ross Morley
2007-05-22  2:05   ` Nick Roberts
2007-05-22  2:31     ` Daniel Jacobowitz
2007-05-22  2:51       ` Nick Roberts
2007-05-22 10:58         ` Daniel Jacobowitz
2007-05-22  8:40       ` Ross Morley
2007-05-22 16:10         ` Marc Gauthier
2007-05-22 16:36           ` Daniel Jacobowitz
2007-05-22 18:14             ` Vladimir Prus
2007-05-22 18:33             ` Jim Ingham
2007-05-22 18:36               ` Daniel Jacobowitz
2007-05-23 21:45                 ` Jim Blandy
2007-05-22 17:20           ` Ross Morley
2007-05-22 20:24           ` Nick Roberts
2007-05-22 21:12             ` Maxim Grigoriev
2007-05-22  1:40 ` Joel Brobecker
2007-05-22  2:29 ` Daniel Jacobowitz
2007-05-22 18:37 ` Jim Blandy
2007-05-22 19:17   ` Maxim Grigoriev
2007-05-22 20:25     ` Nick Roberts
2007-05-22 20:33       ` Ross Morley
2007-05-22 20:45       ` Maxim Grigoriev
2007-05-22 21:26         ` Nick Roberts
2007-05-23  7:00           ` Eli Zaretskii
2007-05-23 10:48             ` Daniel Jacobowitz
2007-05-23 12:44               ` Eli Zaretskii
2007-05-22 23:56     ` Jim Blandy
2007-05-23  1:01       ` Maxim Grigoriev
2007-05-23  2:24         ` Daniel Jacobowitz
2007-05-23 16:37           ` Maxim Grigoriev
2007-05-23  0:05     ` Jim Blandy
2007-05-23  0:17       ` Daniel Jacobowitz
2007-05-23  0:17       ` Ross Morley
2007-05-23  0:32         ` Jim Blandy
2007-05-23  2:24           ` Ross Morley
2007-05-23 21:52             ` Jim Blandy
2007-05-24  0:05               ` Ross Morley
2007-05-24  1:24                 ` Ross Morley
2007-05-24 21:56                   ` Jim Blandy [this message]

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=m3sl9lhomg.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=gdb@sourceware.org \
    --cc=marc@tensilica.com \
    --cc=maxim@tensilica.com \
    --cc=pmac@tensilica.com \
    --cc=ross@tensilica.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