Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: "Agovic, Sanimir" <sanimir.agovic@intel.com>
Cc: "tromey@redhat.com" <tromey@redhat.com>,
	"palves@redhat.com" <palves@redhat.com>,
		"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"Boell, Keven" <keven.boell@intel.com>
Subject: Re: [PATCH v3 05/13] vla: update type from newly created value
Date: Mon, 16 Dec 2013 17:58:00 -0000	[thread overview]
Message-ID: <CAP9bCMTNFQHvtM_ZVUaExGJG=dQzp0eJhsxxF9P6yfQLaD2VGA@mail.gmail.com> (raw)
In-Reply-To: <0377C58828D86C4588AEEC42FC3B85A7176C9FF5@IRSMSX105.ger.corp.intel.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.


  reply	other threads:[~2013-12-16 17:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 14:20 [PATCH v3 00/13] C99 variable length array support Sanimir Agovic
2013-12-04 14:20 ` [PATCH v3 02/13] type: add c99 " Sanimir Agovic
2013-12-04 14:20 ` [PATCH v3 01/13] vla: introduce new bound type abstraction adapt uses Sanimir Agovic
2013-12-04 14:21 ` [PATCH v3 06/13] vla: print "dynamic length" for unresolved dynamic bounds Sanimir Agovic
2013-12-04 14:21 ` [PATCH v3 07/13] vla: support for DW_AT_count Sanimir Agovic
2013-12-04 14:21 ` [PATCH v3 03/13] vla: enable sizeof operator to work with variable length arrays Sanimir Agovic
2013-12-04 14:21 ` [PATCH v3 08/13] vla: resolve dynamic bounds if value contents is a constant byte-sequence Sanimir Agovic
2013-12-04 14:21 ` [PATCH v3 12/13] test: basic c99 vla tests for C primitives Sanimir Agovic
2013-12-04 14:21 ` [PATCH v3 04/13] vla: enable sizeof operator for indirection Sanimir Agovic
2013-12-04 14:22 ` [PATCH v3 10/13] test: multi-dimensional c99 vla Sanimir Agovic
2013-12-04 14:22 ` [PATCH v3 09/13] test: cover subranges with present DW_AT_count attribute Sanimir Agovic
2013-12-04 14:22 ` [PATCH v3 06/13] vla: print "variable length" for unresolved dynamic bounds Sanimir Agovic
2013-12-04 14:22 ` [PATCH v3 11/13] test: evaluate pointers to C99 vla correctly Sanimir Agovic
2013-12-04 14:23 ` [PATCH v3 05/13] vla: update type from newly created value Sanimir Agovic
2013-12-06  7:36   ` Doug Evans
2013-12-16 15:21     ` Agovic, Sanimir
2013-12-16 17:58       ` Doug Evans [this message]
2013-12-04 14:23 ` [PATCH v3 13/13] test: add mi vla test Sanimir Agovic
2014-01-15 11:41 ` [PATCH v3 00/13] C99 variable length array support Joel Brobecker
2014-01-15 16:15   ` Tom Tromey
2014-01-15 17:54     ` Joel Brobecker
2014-01-15 18:00       ` Tom Tromey
2014-01-16 17:00   ` Agovic, Sanimir
2014-01-16 17:30     ` Tom Tromey
2014-01-17  2:23       ` Joel Brobecker

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='CAP9bCMTNFQHvtM_ZVUaExGJG=dQzp0eJhsxxF9P6yfQLaD2VGA@mail.gmail.com' \
    --to=xdje42@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keven.boell@intel.com \
    --cc=palves@redhat.com \
    --cc=sanimir.agovic@intel.com \
    --cc=tromey@redhat.com \
    /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