aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2015-04-25 07:04:40 -0700
committerSiva Chandra <sivachandra@chromium.org>2015-05-09 17:30:35 -0700
commit4c082a81dfebcca45e4ee8cb90490ab733b8e017 (patch)
tree824873fd9d879d57492bde01f990cc36f0f454dd /gdb/value.c
parent10a52f094ebbbed3f9d1b28a2ded94e43d500133 (diff)
downloadgdb-4c082a81dfebcca45e4ee8cb90490ab733b8e017.zip
gdb-4c082a81dfebcca45e4ee8cb90490ab733b8e017.tar.gz
gdb-4c082a81dfebcca45e4ee8cb90490ab733b8e017.tar.bz2
[Python] Add methods reference_value and const_value to gdb.Value.
gdb/ChangeLog: * NEWS (Python Scripting): Mention the new gdb.Value methods. * python/py-value.c (valpy_reference_value): New function. (valpy_const_value): Likewise. (value_object_methods): Add new methods. * value.c (make_cv_value): New function. * value.h (make_cv_value): Declare. gdb/doc/ChangeLog: * python.texi (Values From Inferior): Add descriptions of new methods gdb.Value.reference_value and gdb.Value.const_value. gdb/testsuite/ChangeLog: * gdb.python/py-xmethods.cc: Enhance test case. * gdb.python/py-xmethods.exp: New tests. * gdb.python/py-xmethods.py (A_indexoper): New xmethod worker function. (B_indexoper): Likewise. (global_dm_list) : Add new xmethod worker functions.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 2b32881..86d7d00 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1704,6 +1704,27 @@ value_copy (struct value *arg)
return val;
}
+/* Return a "const" and/or "volatile" qualified version of the value V.
+ If CNST is true, then the returned value will be qualified with
+ "const".
+ if VOLTL is true, then the returned value will be qualified with
+ "volatile". */
+
+struct value *
+make_cv_value (int cnst, int voltl, struct value *v)
+{
+ struct type *val_type = value_type (v);
+ struct type *enclosing_type = value_enclosing_type (v);
+ struct value *cv_val = value_copy (v);
+
+ deprecated_set_value_type (cv_val,
+ make_cv_type (cnst, voltl, val_type, NULL));
+ set_value_enclosing_type (cv_val,
+ make_cv_type (cnst, voltl, enclosing_type, NULL));
+
+ return cv_val;
+}
+
/* Return a version of ARG that is non-lvalue. */
struct value *