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 v6 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence


> A variable location might be a constant value and therefore no inferior memory
> access is needed to read the content. In this case try to resolve the type
> bounds.
> 
> 2013-11-26  Sanimir Agovic  <sanimir.agovic@intel.com>
>             Keven Boell  <keven.boell@intel.com>
> 
> 	* findvar.c (default_read_var_value): Resolve dynamic bounds if location
> 	points to a constant blob.

Approved, but you forgot one little request of mine... See below:

> Signed-off-by: Sanimir Agovic <sanimir.agovic@intel.com>
> ---
>  gdb/findvar.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/findvar.c b/gdb/findvar.c
> index ec6afd6..d54637c 100644
> --- a/gdb/findvar.c
> +++ b/gdb/findvar.c
> @@ -441,7 +441,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
>    switch (SYMBOL_CLASS (var))
>      {
>      case LOC_CONST:
> -      /* Put the constant back in target format.  */
> +      if (is_dynamic_type (type))
> +	/* Value is a constant byte-sequence and needs no memory access.  */
> +	type = resolve_dynamic_type (type, /* Unused address.  */ 0);
> +      /* Put the constant back in target format. */

Joel: Although not required by C, we prefer in the GDB project to still
Joel: use curly braces around the if block. The reason is that the comment
Joel: visually looks like a statement, so it looks like the if block as
Joel: more than one statement, hence the use of curly braces...

Same below.

>        v = allocate_value (type);
>        store_signed_integer (value_contents_raw (v), TYPE_LENGTH (type),
>  			    gdbarch_byte_order (get_type_arch (type)),
> @@ -468,6 +471,9 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
>        return v;
>  
>      case LOC_CONST_BYTES:
> +      if (is_dynamic_type (type))
> +	/* Value is a constant byte-sequence and needs no memory access.  */
> +	type = resolve_dynamic_type (type, /* Unused address.  */ 0);
>        v = allocate_value (type);
>        memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var),
>  	      TYPE_LENGTH (type));
> -- 
> 1.8.4.2

-- 
Joel


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