This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 05/13] vla: update type from newly created value
- From: Doug Evans <xdje42 at gmail dot com>
- To: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- Cc: "tromey at redhat dot com" <tromey at redhat dot com>, "palves at redhat dot com" <palves at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, "Boell, Keven" <keven dot boell at intel dot com>
- Date: Mon, 16 Dec 2013 09:58:46 -0800
- Subject: Re: [PATCH v3 05/13] vla: update type from newly created value
- Authentication-results: sourceware.org; auth=none
- References: <1386166785-28037-1-git-send-email-sanimir dot agovic at intel dot com> <1386166785-28037-6-git-send-email-sanimir dot agovic at intel dot com> <m3k3fizb1t dot fsf at sspiff dot org> <0377C58828D86C4588AEEC42FC3B85A7176C9FF5 at IRSMSX105 dot ger dot corp dot intel dot com>
On Mon, Dec 16, 2013 at 7:20 AM, Agovic, Sanimir
<sanimir.agovic@intel.com> wrote:
>> -----Original Message-----
>> From: Doug Evans [mailto:xdje42@gmail.com]
>> Sent: Friday, December 06, 2013 08:36 AM
>> To: Agovic, Sanimir
>> Cc: tromey@redhat.com; palves@redhat.com; xdje42@gmail.com; gdb-patches@sourceware.org;
>> Boell, Keven
>> Subject: Re: [PATCH v3 05/13] vla: update type from newly created value
>>
>> > * ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
>>
>> Hi. Can you add a comment to each of the functions that
>> require this, saying something like "You must do <this> after calling me."
>> value_at, value_from_contents_and_address, others?
>>
> Thanks Doug, below is the diff being part of v4. Please let me know it is OK.
>
> diff --git a/gdb/valops.c b/gdb/valops.c
> index ec2f1f6..1bccacc 100644
> --- a/gdb/valops.c
> +++ b/gdb/valops.c
> @@ -904,7 +904,9 @@ value_one (struct type *type)
> return val;
> }
>
> -/* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */
> +/* Helper function for value_at, value_at_lazy, and value_at_lazy_stack.
> + The type of the created value may differ from the passed type TYPE.
> + Make sure to retrieve values new type after this call. */
>
> static struct value *
> get_value_at (struct type *type, CORE_ADDR addr, int lazy)
> @@ -929,7 +931,9 @@ get_value_at (struct type *type, CORE_ADDR addr, int lazy)
> value_at_lazy instead. value_at_lazy simply records the address of
> the data and sets the lazy-evaluation-required flag. The lazy flag
> is tested in the value_contents macro, which is used if and when
> - the contents are actually required.
> + the contents are actually required. The type of the created value
> + may differ from the passed type TYPE. Make sure to retrieve values
> + new type after this call.
>
> Note: value_at does *NOT* handle embedded offsets; perform such
> adjustments before or after calling it. */
> diff --git a/gdb/value.c b/gdb/value.c
> index f1cf4dd..3f445f8 100644
> --- a/gdb/value.c
> +++ b/gdb/value.c
> @@ -3193,7 +3193,8 @@ value_from_pointer (struct type *type, CORE_ADDR addr)
>
> /* Create a value of type TYPE whose contents come from VALADDR, if it
> is non-null, and whose memory address (in the inferior) is
> - ADDRESS. */
> + ADDRESS. The type of the created value may differ from the passed
> + type TYPE. Make sure to retrieve values new type after this call. */
>
> struct value *
> value_from_contents_and_address (struct type *type,
Thanks! Looks ok to me.