Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: Rob Quill <rob.quill@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: GDB Script predefined variables
Date: Tue, 14 Nov 2006 17:00:00 -0000	[thread overview]
Message-ID: <4559F636.6030605@st.com> (raw)
In-Reply-To: <baf6008d0611140248o13d1dce7gf43d734b2d13c674@mail.gmail.com>

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


      reply	other threads:[~2006-11-14 17:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-14 10:48 Rob Quill
2006-11-14 17:00 ` Andrew STUBBS [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4559F636.6030605@st.com \
    --to=andrew.stubbs@st.com \
    --cc=gdb@sourceware.org \
    --cc=rob.quill@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox