From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17351 invoked by alias); 4 Jul 2013 16:09:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 17336 invoked by uid 89); 4 Jul 2013 16:09:30 -0000 X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 04 Jul 2013 16:09:29 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r64G9SnM003713 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Jul 2013 12:09:28 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r64G9R3a011036 for ; Thu, 4 Jul 2013 12:09:28 -0400 Subject: [COMMIT PATCH] value_bits_valid: Fix latent bug. To: gdb-patches@sourceware.org From: Pedro Alves Date: Thu, 04 Jul 2013 16:09:00 -0000 Message-ID: <20130704160927.11801.10290.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00174.txt.bz2 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 * 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); }