Re: Understanding GDB frames

Ross Morley
2007-05-22T08:40:32Z

Daniel Jacobowitz wrote:

>On Tue, May 22, 2007 at 02:05:35PM +1200, Nick Roberts wrote:
>
>
>>As watchpoints? I don't think so. A closer analogy to variable objects
>>is the "display" command. There, GDB allows expressions to come back into
>>scope.
>>
>>
>
>I don't think that allowing varobjs to come back into scope this way
>is really useful.
>
>
I agree, since there's no way of knowing it's really the same variable.
Using a C language definition of scope (and most languages are similar)
a variable with the same name in a different scope is a different variable.

>There's a different sort of scope that does make sense - a varobj
>might come in and out of lexical scope while its frame is live, due to
>optimization. But once the frame has gone we should recreate the
>varobjs, or else we should associate them with the function instead of
>the frame.
>
>
Associating them with the function has problems with recursion. It seems to
me the ideal is to recreate vars that have gone out of scope (they really
are new vars). Use of a scope breakpoint can better detect that than the
current methods. However, are there implementation or performance issues?

Ross