This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/Patch v4] Call overloaded operators to perform valid Python operations on struct/class values.


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?).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]