* No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer @ 2011-02-14 11:56 Pedro Alves 2011-02-14 11:58 ` Pedro Alves 0 siblings, 1 reply; 5+ messages in thread From: Pedro Alves @ 2011-02-14 11:56 UTC (permalink / raw) To: gdb-patches 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer 2011-02-14 11:56 No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer Pedro Alves @ 2011-02-14 11:58 ` Pedro Alves 2011-02-14 15:17 ` Mark Kettenis 0 siblings, 1 reply; 5+ messages in thread From: Pedro Alves @ 2011-02-14 11:58 UTC (permalink / raw) To: gdb-patches 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. --- 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, ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer 2011-02-14 11:58 ` Pedro Alves @ 2011-02-14 15:17 ` Mark Kettenis 2011-02-14 15:29 ` Pedro Alves 0 siblings, 1 reply; 5+ messages in thread From: Mark Kettenis @ 2011-02-14 15:17 UTC (permalink / raw) To: pedro; +Cc: gdb-patches > 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, > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer 2011-02-14 15:17 ` Mark Kettenis @ 2011-02-14 15:29 ` Pedro Alves 2011-02-14 16:00 ` Mark Kettenis 0 siblings, 1 reply; 5+ messages in thread From: Pedro Alves @ 2011-02-14 15:29 UTC (permalink / raw) To: Mark Kettenis; +Cc: gdb-patches On Monday 14 February 2011 14:50:23, Mark Kettenis wrote: > > 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? I considered it, but then didn't add it. None of the other value_ functions does that before dereferencing the value. There aren't many places these functions are called, and, I still plan on putting an assertion like that in a few more central places, near the roots of the val_print & co call chains, which should cover this as well. -- Pedro Alves ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer 2011-02-14 15:29 ` Pedro Alves @ 2011-02-14 16:00 ` Mark Kettenis 0 siblings, 0 replies; 5+ messages in thread From: Mark Kettenis @ 2011-02-14 16:00 UTC (permalink / raw) To: pedro; +Cc: mark.kettenis, gdb-patches > From: Pedro Alves <pedro@codesourcery.com> > Date: Mon, 14 Feb 2011 15:19:39 +0000 > > On Monday 14 February 2011 14:50:23, Mark Kettenis wrote: > > > 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? > > I considered it, but then didn't add it. None of the > other value_ functions does that before dereferencing > the value. There aren't many places these functions are > called, and, I still plan on putting an assertion like > that in a few more central places, near the roots of > the val_print & co call chains, which should cover > this as well. Fair enough. Diff looks reasonable to me. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-14 15:29 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-02-14 11:56 No longer accept NULL values in value_bits_valid and value_bits_synthetic_pointer Pedro Alves 2011-02-14 11:58 ` Pedro Alves 2011-02-14 15:17 ` Mark Kettenis 2011-02-14 15:29 ` Pedro Alves 2011-02-14 16:00 ` Mark Kettenis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox