* GDB Script predefined variables
@ 2006-11-14 10:48 Rob Quill
2006-11-14 17:00 ` Andrew STUBBS
0 siblings, 1 reply; 2+ messages in thread
From: Rob Quill @ 2006-11-14 10:48 UTC (permalink / raw)
To: gdb
Hi,
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.
Thanks for your time.
Rob
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: GDB Script predefined variables
2006-11-14 10:48 GDB Script predefined variables Rob Quill
@ 2006-11-14 17:00 ` Andrew STUBBS
0 siblings, 0 replies; 2+ messages in thread
From: Andrew STUBBS @ 2006-11-14 17:00 UTC (permalink / raw)
To: Rob Quill; +Cc: gdb
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
comparison works:
if $_exitcode == (void)0
echo program not finished\n
end
The value of the void is not significant - it is just to make the
expression valid.
HTH
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-14 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14 10:48 GDB Script predefined variables Rob Quill
2006-11-14 17:00 ` Andrew STUBBS
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox