Re: [RFC] Alternate approach to keeping convenience variables

Jim Blandy
2006-01-23T22:29:29Z

On 12/10/05, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Fri, 9 Dec 2005 15:59:23 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: Jim Blandy <jimb@red-bean.com>, gdb-patches@sources.redhat.com
> >
> > The tracepoint.c change is necessary for default.exp. To see why, try
> > this:
> > $ gdb
> > (gdb) show convenience
> > $trace_frame = -1
> > $tpnum = 0
> >
> > vs.
> > $ gdb /bin/ls
> > (gdb) show convenience
> > No debugger convenience variables now defined.
> > Convenience variables have names starting with "$";
> > use "set" as in "set $foo = 5" to define them.
> >
> > If you want the inconsistency resolve the other way round, please
> > holler.
>
> I understand that, with your change, GDB will behave as in the second
> example, even if no executable file was loaded yet, yes? If so, I'm
> for this change: I think GDB shouldn't show tracepoint-related
> variables unless tracepoints are actually being used.

[leaving lots of context in, since it's been a while]

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.