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


> > 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.
> 
> Would you mind explaining this change a little more; perhaps using
> some example code would help me understand why we want to resolve
> dynamic types in this case (and also only in this case)?

I see. It took me a while to understand what you are saying, but
I do, now. It's one of these situations where it's almost a shame
that some case branches return, while others don't, and fallback
on something that happens to take care of dynamicity. Oh well, I have
no better proposal at the moment, so the current approach is fine
with me.

Question for you:  Shouldn't we be doing the same for LOC_CONST?

Thank you,

> >  gdb/findvar.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/gdb/findvar.c b/gdb/findvar.c
> > index ec6afd6..a543dc4 100644
> > --- a/gdb/findvar.c
> > +++ b/gdb/findvar.c
> > @@ -468,6 +468,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

-- 
Joel


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