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
- From: Jim Blandy <jimb at red-bean dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sources dot redhat dot com, Andrew STUBBS <andrew dot stubbs at st dot com>
- Date: Mon, 23 Jan 2006 14:29:24 -0800
- Subject: Re: [RFC] Alternate approach to keeping convenience variables
- References: <4381DC75.80800@st.com> <8f2776cb0511212138g2adef40cr1632365c00e3bebc@mail.gmail.com> <43835114.5060401@st.com> <20051209205923.GA21331@nevyn.them.org> <ud5k5e2xe.fsf@gnu.org>
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.