aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-value-cc.cc
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2013-12-02 06:45:09 -0800
committerSiva Chandra <sivachandra@chromium.org>2014-02-19 15:47:45 -0800
commitf7bd0f7854f2fd0dfeddafd073b007d91bea79e8 (patch)
tree38d3ca9d46e619b3f4a371a0b50158563a3af60d /gdb/testsuite/gdb.python/py-value-cc.cc
parent649ebbcaef0f8e58146e62be0d3f22da5f82446c (diff)
downloadgdb-f7bd0f7854f2fd0dfeddafd073b007d91bea79e8.zip
gdb-f7bd0f7854f2fd0dfeddafd073b007d91bea79e8.tar.gz
gdb-f7bd0f7854f2fd0dfeddafd073b007d91bea79e8.tar.bz2
Call overloaded operators to perform operations on gdb.Value objects.
* NEWS: Add entry for the 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/ * python.texi (Values From Inferior): Add description about the new feature.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-value-cc.cc')
-rw-r--r--gdb/testsuite/gdb.python/py-value-cc.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc
index ace957a..7ea4f5d 100644
--- a/gdb/testsuite/gdb.python/py-value-cc.cc
+++ b/gdb/testsuite/gdb.python/py-value-cc.cc
@@ -17,9 +17,18 @@
class A {
public:
+ int operator+ (const int a1);
+
+ public:
int a;
};
+int
+A::operator+ (const int a1)
+{
+ return a + a1;
+}
+
union U {
int a;
char c;
@@ -88,5 +97,7 @@ main ()
{
A obj;
+ obj.a = 5;
+
return func (obj);
}