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: [commit] Fix a C++ segfault


Hello Daniel,

> 2006-07-20  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* eval.c (evaluate_struct_tuple): Skip static fields.

I don't know C++ too much - how often is this likely to occur?
Would this be a safe patch for the branch?

Thanks!

> Index: eval.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/eval.c,v
> retrieving revision 1.61
> diff -u -p -r1.61 eval.c
> --- eval.c	18 Feb 2006 20:47:54 -0000	1.61
> +++ eval.c	20 Jul 2006 22:36:01 -0000
> @@ -283,6 +283,10 @@ evaluate_struct_tuple (struct value *str
>  	      if (variantno < 0)
>  		{
>  		  fieldno++;
> +		  /* Skip static fields.  */
> +		  while (fieldno < TYPE_NFIELDS (struct_type)
> +			 && TYPE_FIELD_STATIC_KIND (struct_type, fieldno))
> +		    fieldno++;
>  		  subfieldno = fieldno;
>  		  if (fieldno >= TYPE_NFIELDS (struct_type))
>  		    error (_("too many initializers"));

-- 
Joel


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