Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Siva Chandra <sivachandra@google.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	gdb-patches <gdb-patches@sourceware.org>,
		Tom Tromey <tromey@redhat.com>
Subject: Re: [RFC/Patch v4] Call overloaded operators to perform valid Python operations on struct/class values.
Date: Fri, 07 Feb 2014 06:53:00 -0000	[thread overview]
Message-ID: <CADPb22SRo__Pa0BR+H5n+K6XyS93Z8s11ndY9YzGVNhNm8A1_w@mail.gmail.com> (raw)
In-Reply-To: <CAGyQ6gzw6mtACKk3L13ULQMa8EB8=939nP5R82HO6gcXTMXijw@mail.gmail.com>

On Sun, Feb 2, 2014 at 12:06 PM, Siva Chandra <sivachandra@google.com> wrote:
> On Sat, Jan 25, 2014 at 10:45 AM, Doug Evans <dje@google.com> wrote:
>> IWBN if the docs listed exactly which operations are supported.
>
> I have added it now in the attached patch. Eli should probably take
> another look.
>
>> [I realize this patch relies on the user-defined method patch, so it
>> can't go in just yet.]
>
> Are you referring to the debug methods patch? If yes, I do think this
> patch relies on that patch. This is an independent feature which would
> make writing debug methods simpler (IMO).
>
> 2014-02-02  Siva Chandra Reddy  <sivachandra@google.com>
>
>         Call overloaded operators to perform valid Python operations on
>         struct/class values.
>         * NEWS (Python Scripting): Add entry for this new feature.
>         * python/py-value.c (valpy_binop): Call value_x_binop for struct
>         and class values.
>
>         testsuite/
>         * gdb.python/py-value-cc.cc: Improve test case to enable testing
>         operations on gdb.Value objects.
>         * gdb.python/py-value-cc.exp: Add new test to test operations on
>         gdb.Value objects.
>
>         doc/
>         * gdb.texinfo (Values From Inferior): Add description about
>         performing valid Python operations on gdb.Value objects.

Hi.

The patch is fine with me.

I put in some time to play with the patch.
One thing I wondered about is what happens if the user does string1 + string2?
We do leak memory.  That's not a problem with this patch of course,
though by making this scriptable the problem gets worse.
I filed https://sourceware.org/bugzilla/show_bug.cgi?id=16537

btw, Just writing this down since it's on my mind:
If anything needs to be done it should be addressed in a separate
patch.  And maybe leaving things as-is is ok, and just a doc addition
is all that's needed. Anyways, hand called functions (which includes
c++ operators) run the inferior (setting aside using debug methods).
The more we make it easy to invoke c++ operators the more users are
going to run into the issues of hand called functions (e.g. what if
they have a breakpoint set that the c++ operator happens to trip?).


  parent reply	other threads:[~2014-02-07  6:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02 20:06 Siva Chandra
2014-02-02 20:59 ` Eli Zaretskii
2014-02-02 21:03   ` Eli Zaretskii
2014-02-07  6:53 ` Doug Evans [this message]
2014-02-20  0:04   ` Siva Chandra

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=CADPb22SRo__Pa0BR+H5n+K6XyS93Z8s11ndY9YzGVNhNm8A1_w@mail.gmail.com \
    --to=dje@google.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.com \
    --cc=tromey@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