From: Paul Koning <paul_koning@dell.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: Mathew Yeates <mat.yeates@gmail.com>,
Michael Snyder <msnyder@vmware.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: doing a comparison in python
Date: Tue, 17 Aug 2010 10:59:00 -0000 [thread overview]
Message-ID: <BD2C3ADB-A30C-4FCA-95C6-ACEC341C3E96@dell.com> (raw)
In-Reply-To: <1282009231.2624.37.camel@hactar>
On Aug 16, 2010, at 9:40 PM, Thiago Jung Bauermann wrote:
> 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'
> --
That's a bit redundant, just as it would be in C. I would write:
foo = gdb.parse_and_eval ("foo")
if foo:
print 'hooray'
--
paul
next prev parent reply other threads:[~2010-08-17 10:59 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
2010-08-17 10:59 ` Paul Koning [this message]
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=BD2C3ADB-A30C-4FCA-95C6-ACEC341C3E96@dell.com \
--to=paul_koning@dell.com \
--cc=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