This is the mail archive of the
mailing list for the GDB project.
Re: Binary operations on struct/class values in GDB Python
- From: Doug Evans <xdje42 at gmail dot com>
- To: Siva Chandra <sivachandra at google dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 28 Nov 2013 09:36:55 -0800
- Subject: Re: Binary operations on struct/class values in GDB Python
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gyNz69k=wtRPsCODTSCGB4LamH_aeX1eXpfkfukUf_KOA at mail dot gmail dot com>
On Wed, Nov 27, 2013 at 4:10 PM, Siva Chandra <email@example.com> wrote:
> Under the section "Python API => Values from Inferior" in the GDB
> manual, we have this:
> "Inferior values that are simple scalars can be used directly in
> Python expressions that are valid for the value's data type."
> Why are binary operations, which are syntactically correct in Python
> as well, restricted to only simple scalars (and pointers)? Couldn't
> the Python side call the overloaded operators for structs/classes if
> they exist?
> I am discounting the '' operator as that has a completely different
> meaning for gdb.Value objects.
As in most things here, we do things a bit at a time.
Just because something is "restricted" today doesn't necessarily mean
it will be restricted tomorrow.
It's often the case that no one has put in the time to champion the
feature and then implement it.
It's easy to do for scalars and pointers at least in part because the
mixing of the languages is relatively intuitive, it's a useful
feature, and it's easy to implement.