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: [committed]: [PATCH 0/4] Fix member pointer bugs


On 11/29/2012 12:37 AM, Tom Tromey wrote:
> index 55582e0..faad9e3 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -1410,7 +1410,7 @@ evaluate_subexp_standard (struct type *expect_type,
>   
>   	      mem_offset = value_as_long (arg1);
>   
> -	      arg1 = value_from_pointer (type_ptr,
> +	      arg1 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
>   					 value_as_long (arg2) + mem_offset);
>   	      arg1 = value_ind (arg1);
>   	      tem = 1;

TYPE_TARGET_TYPE (type) was used in my first post, but it was replaced
by TYPE_DOMAIN_TYPE (type) by mistake in my follow-up patch, which is
to shorten the line.  I didn't run regression test again after the change.
Thanks for pointing this out.

The patch below is the same to yours, but shorten the line by defining a
new local variable.  Regression tested on x86_64-linux.  Committed.

-- 
Yao (éå)

gdb:

2012-11-29  Yao Qi  <yao@codesourcery.com>
	    Tom Tromey  <tromey@redhat.com>

	* eval.c (evaluate_subexp_standard): Get the correct pointer
	type for TYPE_CODE_MEMBERPTR.
---
 gdb/eval.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/gdb/eval.c b/gdb/eval.c
index 55582e0..7d48d7e 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1404,13 +1404,15 @@ evaluate_subexp_standard (struct type *expect_type,
 	    {
 	      struct type *type_ptr
 		= lookup_pointer_type (TYPE_DOMAIN_TYPE (type));
+	      struct type *target_type_ptr
+		= lookup_pointer_type (TYPE_TARGET_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,
+	      arg1 = value_from_pointer (target_type_ptr,
 					 value_as_long (arg2) + mem_offset);
 	      arg1 = value_ind (arg1);
 	      tem = 1;
-- 
1.7.7.6


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