From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: Mathew Yeates <mat.yeates@gmail.com>
Cc: Michael Snyder <msnyder@vmware.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: doing a comparison in python
Date: Tue, 17 Aug 2010 01:40:00 -0000 [thread overview]
Message-ID: <1282009231.2624.37.camel@hactar> (raw)
In-Reply-To: <AANLkTinSOGrmXgX9g_GDQtw9Bd_D4BLfBR2-HtjTF6Gy@mail.gmail.com>
On Mon, 2010-08-16 at 17:34 -0700, Mathew Yeates wrote:
> On Mon, Aug 16, 2010 at 5:26 PM, Michael Snyder <msnyder@vmware.com> wrote:
> > Mathew Yeates wrote:
> >> I am debugging fortran code and I want to see if an interior value is
> >> equal to .FALSE.
> >> I know how to get the value with parse_and_eval but what do I do with it?
> >
> > Can we assume this value is an integer?
> > Then you should be able to do something like this:
> >
> > long foo = value_as_long (parse_and_eval (my_value));
> >
> > if (foo == 0)
> > [...];
>
> no. it's a logical. Either .TRUE. or .FALSE.
GDB values in Python scripts can be directly compared with Python's
native types, so you can just say:
foo = gdb.parse_and_eval ("foo")
if foo == True:
print 'hooray'
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center
next prev parent reply other threads:[~2010-08-17 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 0:19 Mathew Yeates
2010-08-17 0:26 ` Michael Snyder
2010-08-17 0:35 ` Mathew Yeates
2010-08-17 1:40 ` Thiago Jung Bauermann [this message]
2010-08-17 10:59 ` Paul Koning
2010-08-17 16:24 ` Tom Tromey
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=1282009231.2624.37.camel@hactar \
--to=bauerman@br.ibm.com \
--cc=gdb@sourceware.org \
--cc=mat.yeates@gmail.com \
--cc=msnyder@vmware.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