This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [commit] Fix a C++ segfault
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 20 Jul 2006 17:27:57 -0700
- Subject: Re: [commit] Fix a C++ segfault
- References: <20060720225443.GA31345@nevyn.them.org>
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