This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 4/4] Handle TYPE_CODE_MEMBERPTR
This patch handles TYPE_CODE_MEMBERPTR and fixes this fail,
FAIL: gdb.cp/member-ptr.exp: print (diamond.*diamond_pfunc_ptr) (20)
gdb:
2012-11-22 Daniel Jacobowitz <dan@codesourcery.com>
* eval.c (evaluate_subexp_standard): Handle
TYPE_CODE_MEMBERPTR.
---
gdb/eval.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index 82ea81b..3c8ec55 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1400,6 +1400,19 @@ evaluate_subexp_standard (struct type *expect_type,
tem = 2;
argvec[1] = arg2;
}
+ else if (TYPE_CODE (type) == TYPE_CODE_MEMBERPTR)
+ {
+ /* Now, convert these values to an address. */
+ arg2 = value_cast (lookup_pointer_type (TYPE_DOMAIN_TYPE (type)),
+ arg2);
+
+ mem_offset = value_as_long (arg1);
+
+ arg1 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
+ value_as_long (arg2) + mem_offset);
+ arg1 = value_ind (arg1);
+ tem = 1;
+ }
else
error (_("Non-pointer-to-member value used in pointer-to-member "
"construct"));
--
1.7.7.6