From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19867 invoked by alias); 9 Jun 2010 18:44:11 -0000 Received: (qmail 19719 invoked by uid 22791); 9 Jun 2010 18:44:09 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Jun 2010 18:44:02 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o59Ii0pU024186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Jun 2010 14:44:01 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o59IhvDW013718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 Jun 2010 14:44:00 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o59Ihv7n023843; Wed, 9 Jun 2010 20:43:57 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o59Ihv7d023838; Wed, 9 Jun 2010 20:43:57 +0200 Date: Wed, 09 Jun 2010 18:44:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFC: optimized-out pieces Message-ID: <20100609184356.GA23679@host0.dyn.jankratochvil.net> References: <20100607223524.GA2897@host0.dyn.jankratochvil.net> <20100608184224.GA6814@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-IsSubscribed: yes 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 X-SW-Source: 2010-06/txt/msg00238.txt.bz2 > +static int > +check_pieced_value_validity (const struct value *value, int bit_offset, > + int bit_length) > +{ > + struct piece_closure *c > + = (struct piece_closure *) value_computed_closure (value); > + int i; > + > + bit_offset += 8 * value_offset (value); I miss some `value_bitpos (value)' possibility here. > + for (i = 0; i < c->n_pieces && bit_length > 0; i++) > + { > + struct dwarf_expr_piece *p = &c->pieces[i]; > + size_t this_size_bits = p->size; > + > + if (bit_offset > 0) > + { > + if (bit_offset >= this_size_bits) > + { > + bit_offset -= this_size_bits; > + continue; > + } > + > + bit_length -= bit_offset; Here should be `bit_length -= this_size_bits - bit_offset'. If we heve: this_size_bits = 8 bit_offset = 7 bit_length = 2 then your code does bit_length -= 7; bit_length = -5; while for the next piece it should be: bit_length -= 1; bit_length = 1; > + bit_offset = 0; > + } > + else > + bit_length -= this_size_bits; > + > + if (p->location == DWARF_VALUE_OPTIMIZED_OUT) > + return 0; > + } > + > + return 1; > +} Thanks, Jan