This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Alternate approach to keeping convenience variables
On Tue, Jan 24, 2006 at 10:40:58AM -0800, Jim Blandy wrote:
> 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.
Andrew's point is that such a primitive was recently committed :-)
--
Daniel Jacobowitz
CodeSourcery