This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/4] Handle TYPE_CODE_MEMBERPTR


On 11/22/2012 03:32 PM, Yao Qi wrote:
> +	      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)),

These two lines are too long.  Fixed in the updated patch.

-- 
Yao (éå)

gdb:

2012-11-22  Daniel Jacobowitz  <dan@codesourcery.com>

	* eval.c (evaluate_subexp_standard): Handle
	TYPE_CODE_MEMBERPTR.
---
 gdb/eval.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/gdb/eval.c b/gdb/eval.c
index 82ea81b..55582e0 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1400,6 +1400,21 @@ evaluate_subexp_standard (struct type *expect_type,
 	      tem = 2;
 	      argvec[1] = arg2;
 	    }
+	  else if (TYPE_CODE (type) == TYPE_CODE_MEMBERPTR)
+	    {
+	      struct type *type_ptr
+		= lookup_pointer_type (TYPE_DOMAIN_TYPE (type));
+
+	      /* Now, convert these values to an address.  */
+	      arg2 = value_cast (type_ptr, arg2);
+
+	      mem_offset = value_as_long (arg1);
+
+	      arg1 = value_from_pointer (type_ptr,
+					 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]