This is the mail archive of the
mailing list for the GDB project.
Re: GDB Script predefined variables
Rob Quill wrote:
I was wondering what predefined variables, if any, there are in GDB,
that can be used when writing a GDB script. Specifically, I want the
script to be able to test when the program has finished executing, but
any other predefined variables would also be useful, if there is a
list somewhere or someone knows them all.
To show all GDB variables, predefined or otherwise:
(gdb) show conv
For your specific needs, there is a variable '$_exitcode' defined after
the program exits (it does not exist before).
If you try to test a GDB convenience variable before it exists, GDB
will create it for you, but it does not initialise it (the value will be
'void'). I'm not sure it is an official feature, but the following
if $_exitcode == (void)0
echo program not finished\n
The value of the void is not significant - it is just to make the