From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9073 invoked by alias); 11 Jul 2013 14:35:16 -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 9064 invoked by uid 89); 11 Jul 2013 14:35:16 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from mms2.broadcom.com (HELO mms2.broadcom.com) (216.31.210.18) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Jul 2013 14:35:15 +0000 Received: from [10.9.208.53] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Thu, 11 Jul 2013 07:29:11 -0700 X-Server-Uuid: 4500596E-606A-40F9-852D-14843D8201B2 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Thu, 11 Jul 2013 07:35:07 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.438.0; Thu, 11 Jul 2013 07:35:07 -0700 Received: from [10.177.73.66] (unknown [10.177.73.66]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 534A0F2D7B for ; Thu, 11 Jul 2013 07:35:06 -0700 (PDT) Message-ID: <51DEC299.8040109@broadcom.com> Date: Thu, 11 Jul 2013 14:35:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [PATCH] [2/2] Don't raise an error for optimized out sub-fields. Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00317.txt.bz2 When performing a lazy fetch of a sub-bitfield, we raise an error if the bits have been optimized-out from the parent value. This is odd, as in most other cases we report the value as "". This patch marks the result of the lazy fetch as optimized out, and then returns rather than raising an error. No regressions, and the one test I see that hits this now seems more consistent. OK to apply? Thanks, Andrew gdb/ChangeLog 2013-07-11 Andrew Burgess * value.c (value_fetch_lazy): Mark optimized out values as such rather than raising an error. gdb/testsuite/ChangeLog 2013-07-11 Andrew Burgess * gdb.dwarf2/pieces-optimized-out.exp: Expect "" rather than an error. diff --git a/gdb/value.c b/gdb/value.c index 8e0f8c4..8d635c7 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3439,9 +3439,8 @@ value_fetch_lazy (struct value *val) if (!value_bits_valid (parent, TARGET_CHAR_BIT * offset + value_bitpos (val), value_bitsize (val))) - error (_("value has been optimized out")); - - if (!unpack_value_bits_as_long (value_type (val), + set_value_optimized_out (val, 1); + else if (!unpack_value_bits_as_long (value_type (val), value_contents_for_printing (parent), offset, value_bitpos (val), diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp index 2e4d028..8376235 100644 --- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp @@ -44,6 +44,6 @@ gdb_test "p s" \ "print s" gdb_test "p s.a" " = 5" "print s.a" gdb_test "p s.b" " = " "print s.b" -gdb_test "p s.c" "value has been optimized out" "print s.c" -gdb_test "p s.d" "value has been optimized out" "print s.d" +gdb_test "p s.c" " = " "print s.c" +gdb_test "p s.d" " = " "print s.d"