From: Daniel Jacobowitz <drow@false.org>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa] expose gdb values to python, mark II
Date: Tue, 14 Oct 2008 12:35:00 -0000 [thread overview]
Message-ID: <20081014123440.GA7842@caradoc.them.org> (raw)
In-Reply-To: <gc8q9k$74e$2@ger.gmane.org>
On Sat, Oct 04, 2008 at 07:22:09PM -0300, Thiago Jung Bauermann wrote:
> +Inferior values that are simple scalars can be used directly in
> +Python expressions that are valid for the value's data type Here's
> +an example for an integer or floating-point value @code{some_val}:
Typo (missing period).
This only works for scalars (now including pointers), right? Do you
have to call overloaded operators explicitly?
> +/* Returns a value object which is the sum of this value with the given
> + integer argument. */
> +static PyObject *
> +valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
The comment is not accurate, this is more than sum.
> +{
> + long l;
> + double d;
> + struct value *res_val = NULL; /* Initialize to appease gcc warning. */
> + struct value *other_val;
> + value_object *self_value;
> + volatile struct gdb_exception except;
> +
> + /* If the gdb.Value object is the second operand, then it will be passed
> + to us as the OTHER argument, and SELF will be an entirely different
> + kind of object, altogether. Swap them to avoid surprises. */
> + if (!PyObject_TypeCheck (self, &value_object_type))
> + {
> + PyObject *tmp;
> +
> + tmp = self;
> + self = other;
> + other = tmp;
> + }
And since it's more than sum.... what about "1 - foo"?
Otherwise, OK.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-10-14 12:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-04 22:23 Thiago Jung Bauermann
2008-10-14 1:14 ` Thiago Jung Bauermann
2008-10-14 12:35 ` Daniel Jacobowitz [this message]
2008-10-16 4:14 ` Thiago Jung Bauermann
2008-10-16 12:36 ` Daniel Jacobowitz
2008-10-16 18:02 ` Thiago Jung Bauermann
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=20081014123440.GA7842@caradoc.them.org \
--to=drow@false.org \
--cc=bauerman@br.ibm.com \
--cc=gdb-patches@sources.redhat.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