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: No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer


> From: Pedro Alves <pedro@codesourcery.com>
> Date: Mon, 14 Feb 2011 11:58:02 +0000
> 
> On Monday 14 February 2011 11:56:49, Pedro Alves wrote:
> > Following up on
> > <http://sourceware.org/ml/gdb-patches/2011-02/msg00201.html>.
> > 
> > I've checked in this patch.  We shouldn't be getting
> > NULL values here anymore.  If I missed a case were we do, the
> > offending caller needs to be fixed to not pass it.
> > 
> > Pedro Alves
> > 
> > 2011-02-14  Pedro Alves  <pedro@codesourcery.com>
> > 
> >         * value.c (value_bits_valid, value_bits_synthetic_pointer):
> >         No longer handle NULL values.
> 
> Sigh.
> 
> 2011-02-14  Pedro Alves  <pedro@codesourcery.com>
> 
> 	* value.c (value_bits_valid, value_bits_synthetic_pointer):
> 	No longer handle NULL values.

Would it be a good idea to add a gdb_assert() here to check for a NULL pointer?

> ---
>  gdb/value.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: src/gdb/value.c
> ===================================================================
> --- src.orig/gdb/value.c	2011-02-11 15:53:44.717504003 +0000
> +++ src/gdb/value.c	2011-02-11 15:53:51.457503999 +0000
> @@ -998,7 +998,7 @@ value_entirely_optimized_out (const stru
>  int
>  value_bits_valid (const struct value *value, int offset, int length)
>  {
> -  if (value == NULL || !value->optimized_out)
> +  if (!value->optimized_out)
>      return 1;
>    if (value->lval != lval_computed
>        || !value->location.computed.funcs->check_validity)
> @@ -1011,7 +1011,7 @@ int
>  value_bits_synthetic_pointer (const struct value *value,
>  			      int offset, int length)
>  {
> -  if (value == NULL || value->lval != lval_computed
> +  if (value->lval != lval_computed
>        || !value->location.computed.funcs->check_synthetic_pointer)
>      return 0;
>    return value->location.computed.funcs->check_synthetic_pointer (value,
> 


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