Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [COMMIT PATCH] value_bits_valid: Fix latent bug.
@ 2013-07-04 16:09 Pedro Alves
  2013-07-05 14:42 ` Andrew Burgess
  0 siblings, 1 reply; 9+ messages in thread
From: Pedro Alves @ 2013-07-04 16:09 UTC (permalink / raw)
  To: gdb-patches

Doing something else, I factored out the bits of the value_bits_valid
function that actually handle the check_validity hook, and
surprisingly found out that the result was misbehaving.  Turns out
value_bits_valid has a latent bug.  If the value is not lval_computed,
or doesn't have a check_validity hook, then we should assume the value
is entirely valid, not invalid.  This is currently masked by the
value->optimized_out check -- I ran the testsuite with a gdb_assert(0)
inserted in place of that return being touched by the patch, and it
never triggers.

Tested on x86_64 Fedora 17.

gdb/
2013-07-04  Pedro Alves  <palves@redhat.com>

	* value.c (value_bits_valid): If the value is not lval_computed,
	or doesn't have a check_validity hook, assume the value is entirely
	valid.
---
 gdb/value.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/value.c b/gdb/value.c
index ce4b13a..353f62a 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1086,7 +1086,7 @@ value_bits_valid (const struct value *value, int offset, int length)
     return 1;
   if (value->lval != lval_computed
       || !value->location.computed.funcs->check_validity)
-    return 0;
+    return 1;
   return value->location.computed.funcs->check_validity (value, offset,
 							 length);
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-07-24 20:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 16:09 [COMMIT PATCH] value_bits_valid: Fix latent bug Pedro Alves
2013-07-05 14:42 ` Andrew Burgess
2013-07-05 15:06   ` Pedro Alves
2013-07-05 15:20     ` Andrew Burgess
2013-07-05 18:21       ` Pedro Alves
2013-07-08 10:22         ` Andrew Burgess
2013-07-09  9:54           ` Regression for implptr.exp and pieces.exp [Re: [COMMIT PATCH] value_bits_valid: Fix latent bug.] Jan Kratochvil
2013-07-09 14:16             ` Andrew Burgess
2013-07-24 20:10               ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox