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: Siva Chandra <sivachandra at google dot com>
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, gdb-patches <gdb-patches at sourceware dot org>
- Date: Thu, 19 Dec 2013 09:50:04 -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> <m31u1q1oq0 dot fsf at sspiff dot org> <871u1j2ldi dot fsf at fleche dot redhat dot com> <CAP9bCMSPpz8px2ZFvRroHcNP8PWWQV39P7GmXCmj+fdSR7NT2Q at mail dot gmail dot com> <CAGyQ6gzYE_NthBxc17VPxjgtYSqTW3HGhPVp8qvk=Nye27G8hg at mail dot gmail dot com> <CAP9bCMTthY1oJN-res0Cegd_YrMqW77ZehMjnzK+Y9681Of5bQ at mail dot gmail dot com> <CAGyQ6gy9E3J8mbG0xKTTwH8=MYG2naeBhMtwmNb5f=m9Xsmufg at mail dot gmail dot com> <CAP9bCMTcTRTR7QUQqJXY5qAk28q3nABSh0DEJyMKOB65wf71jA at mail dot gmail dot com>
dje> smart_ptr = gdb.parse_and_eval ("my_smart_ptr");
dje> dereferenced_smart_ptr = gdb.parse_and_eval("*%V" % smart_ptr)
siva> Should work. May be the '%' syntax would not (I am not sure). But, we
siva> could consider other alternatives [Replace occurrences of $1, $2, etc
siva> for example].
siva> Is this an exhaustive solution or a cool fallback option when no other
siva> Pythonic way works
dje> Both?
dje> [Not sure I understand the question.]
I do think it is exhaustive. But, somehow [only a subjective feeling],
seems like a fallback option. For example, it makes simple things
(like, val1 + val2) more verbose and less readable. It is something
which one could fallback to if they want to do non-Python operations.