This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 06/10] vla: update type from newly created value
- From: Sanimir Agovic <sanimir dot agovic at intel dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 21 Oct 2013 16:40:20 +0200
- Subject: [PATCH 06/10] vla: update type from newly created value
- Authentication-results: sourceware.org; auth=none
- References: <1382366424-21010-1-git-send-email-sanimir dot agovic at intel dot com>
Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.
2013-10-18 Sanimir Agovic <sanimir.agovic@intel.com>
Keven Boell <keven.boell@intel.com>
* valops.c (value_ind): Re-fetch type from value.
* value.c (coerce_ref): Re-fetch type from value.
Change-Id: Ice9ae63215f637c4b99babf0f108e7b5b58988cd
---
gdb/valops.c | 1 +
gdb/value.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gdb/valops.c b/gdb/valops.c
index 15fd7c3..6706d9f 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1610,6 +1610,7 @@ value_ind (struct value *arg1)
(value_as_address (arg1)
- value_pointed_to_offset (arg1)));
+ enc_type = value_type (arg2);
return readjust_indirect_value_type (arg2, enc_type, base_type, arg1);
}
diff --git a/gdb/value.c b/gdb/value.c
index b9266db..ce778ea 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3360,6 +3360,7 @@ coerce_ref (struct value *arg)
retval = value_at_lazy (enc_type,
unpack_pointer (value_type (arg),
value_contents (arg)));
+ enc_type = value_type (retval);
return readjust_indirect_value_type (retval, enc_type,
value_type_arg_tmp, arg);
}
--
1.7.0.7