This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/Patch] Call overloaded operators to perform valid Python operations on struct/class values.
- From: Doug Evans <xdje42 at gmail dot com>
- To: Siva Chandra <sivachandra at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Thu, 05 Dec 2013 22:24:23 -0800
- Subject: Re: [RFC/Patch] Call overloaded operators to perform valid Python operations on struct/class values.
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gxk9zcLKQ1Ef2XhgUMCyB8MB1v=6tA4jsfPyEFgxR8bNw at mail dot gmail dot com>
Siva Chandra <sivachandra@google.com> writes:
> Hi,
>
> This is a follow up to this thread:
> https://sourceware.org/ml/gdb/2013-11/msg00101.html
>
> Part of Doug's response there seemed to indicate that calling
> overloaded operators to perform valid Python operations has not yet
> been implemented. The attached patch adds this "feature". I could not
> yet think of a reason as to why adding this could be bad (as in,
> leading to ambiguity or something similar).
>
> ChangeLog
>
> 2013-12-02 Siva Chandra Reddy <sivachandra@google.com>
>
> Call overloaded operators to perform valid Python operations on
> struct/class values.
>
> * 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.
> * gdb.python/py-value-cc.exp: Add new tests.
Hi.
I'm not yet comfortable enough with going this route to approve it.
It feels sexy and all, but it's not clear to me going this path is a net win.
If we could release it as experimental, without any promises to keep it
or change it in incompatible ways, I'd say go for it.
I'm curious what others think.
Nits on the patch itself:
1) In the changelog entry, no blank line here.
> Call overloaded operators to perform valid Python operations on
> struct/class values.
> <<<no blank line here>>>
> * python/py-value.c (valpy_binop): Call value_x_binop for struct
> and class values.
2) NEWS entry and doc required.
I can well imagine that they're coming, pending approval of the patch
thus far. Sorry!
3) gdb code uses tabs for indentation (and then uses spaces after the
needed amount of tabs have been used), and it's a pain when tabbed
code is mixed with non-tabbed code.
4) In the test case, don't make extra changes, or if you do split
them out into a separate patch.