From: Christophe Demarey <Christophe.Demarey@inria.fr>
To: gdb@sourceware.org
Subject: test availability of variables in context from user command
Date: Fri, 23 Feb 2007 17:37:00 -0000 [thread overview]
Message-ID: <45DF0F48.60507@inria.fr> (raw)
Hello,
I want to check the availability of a variable (var1 for instance) in
the context from an user command but I don't find any way to do this.
Here is a (dummy) example of what I want to do :
void func1(void)
{
int var2 = 2;
...
}
int main(int argc, char **argv)
{
int var1 = 1;
...
func1();
}
My gdb command:
define myfunc
if defined(var1)
$res = $var1
else
$res = $var2
end
...
end
If I break into main, res should be equals to 1, else res should be
equals to 2.
Is there a way to do this with gdb?
Thanks,
Christophe.
next reply other threads:[~2007-02-23 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-23 17:37 Christophe Demarey [this message]
2007-02-23 18:16 ` Rob Quill
2007-02-23 19:56 ` Christophe Demarey
2007-02-23 19:50 ` Daniel Jacobowitz
2007-02-24 8:24 ` Michael Snyder
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=45DF0F48.60507@inria.fr \
--to=christophe.demarey@inria.fr \
--cc=gdb@sourceware.org \
/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