Re: [RFC] Alternate approach to keeping convenience variables

Jim Blandy
2006-01-24T18:41:01Z

On 1/24/06, Andrew STUBBS <andrew.stubbs@st.com> wrote:
> Jim Blandy wrote:
> > The $trace_frame variable is set to -1 when GDB starts, which
> > indicates that there's no trace frame selected. I think it would be a
> > little more helpful for the variables to always exist: you can write
> > user-defined commands that give a reasonable error message, for
> > example. GDB doesn't have any way (?) to check whether a convenience
> > variable has been initialized yet.
>
> A newly created convenience variable has the value 'void'. (A variable
> is created the first time it is referenced, even as an rvalue.)
> Therefore, if it is 'void' it can be considered uninitialised.

Right, but there's no way to test for that in the scripting language.
Your 'init-if-undefined' command has to be a primitive, implemented in
C. My argument was that having the variables always be present is
more convenient for user-defined commands.