From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 4/4] Handle TYPE_CODE_MEMBERPTR
Date: Thu, 22 Nov 2012 07:33:00 -0000 [thread overview]
Message-ID: <1353569539-744-5-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1353569539-744-1-git-send-email-yao@codesourcery.com>
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
next prev parent reply other threads:[~2012-11-22 7:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 7:32 [PATCH 0/4] Fix member pointer bugs Yao Qi
2012-11-22 7:32 ` [PATCH 1/4] testcase - pointer to member function Yao Qi
2012-11-26 16:32 ` Tom Tromey
2012-11-22 7:33 ` Yao Qi [this message]
2012-11-22 8:07 ` [PATCH 4/4] Handle TYPE_CODE_MEMBERPTR Yao Qi
2012-11-26 16:42 ` Tom Tromey
2012-11-22 7:33 ` [PATCH 2/4] factor code Yao Qi
2012-11-22 7:33 ` [PATCH 3/4] Use TYPE_TARGET_TYPE Yao Qi
2012-11-26 16:41 ` Tom Tromey
2012-11-27 8:03 ` [committed]: [PATCH 0/4] Fix member pointer bugs Yao Qi
2012-11-28 14:47 ` Tom Tromey
2012-11-28 15:14 ` Yao Qi
2012-11-28 16:37 ` Tom Tromey
2012-11-29 7:46 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353569539-744-5-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox