From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6130 invoked by alias); 14 Feb 2011 11:59:40 -0000 Received: (qmail 6120 invoked by uid 22791); 14 Feb 2011 11:59:39 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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; Mon, 14 Feb 2011 11:59:35 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1EBxPdD005389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Feb 2011 06:59:25 -0500 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1EBxMe3022644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Feb 2011 06:59:24 -0500 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p1EBxMpu010326; Mon, 14 Feb 2011 12:59:22 +0100 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id p1EBxKiw009305; Mon, 14 Feb 2011 12:59:20 +0100 Date: Mon, 14 Feb 2011 11:59:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [unavailable values part 1, 01/17] base support for unavailable value contents Message-ID: <20110214115919.GA2454@host1.dyn.jankratochvil.net> References: <201102071427.55970.pedro@codesourcery.com> <201102101846.38823.pedro@codesourcery.com> <201102101930.26399.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201102101930.26399.pedro@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-02/txt/msg00262.txt.bz2 On Thu, 10 Feb 2011 20:30:26 +0100, Pedro Alves wrote: > +/* Defines an [OFFSET, OFFSET + LENGTH) range. */ > + > +struct range > +{ > + /* Lowest offset in the range. */ > + int offset; > + > + /* Length of the range. */ > + int length; > +}; I would find [LOW, HIGH) fields more readable as the code now still calculates offset + length back and forth all over the code. FYI, not trying to require it, though. > +/* Returns true if RANGES contains any range that overlaps [OFFSET, > + OFFSET+LENGTH). */ > + > +static int > +ranges_contain_p (VEC(range_s) *ranges, int offset, int length) Couldn't even this function stick with the `overlap' term? `contain' associates to me: Returns true if each byte of [OFFSET, OFFSET+LENGTH) is overlapping with any range in the RANGES list. (My English association may not be right, though.) > @@ -206,6 +310,11 @@ struct value > + /* Unavailable ranges in CONTENTS. We mark unavailable ranges, > + rather than available, since the common and default case is for a > + value to be available. This is filled in at value read time. */ > + VEC(range_s) *unavailable; Was there considered the opposite way to have a list of available ranges? Besides cleaning up the inversion code implemented by this patchset in read_value_memory it would also enable storing discontiguous memory with a value. Currently if you store inferior C++ object into a $convenience_variable you cannot do much with it as it can no longer read the virtual method table - besides it may no longer exist in the inferior the current code will not even try to read it from the inferior. I faced it also with archer-jankratochvil-vla - if you have a very large inferior array printing only some slices/subsets of it - you still have to store for $convenience_variable the whole range between first byte and last byte accessed, despite most of the ranges in between get never accessed. You will mostly print some slices/subsets because the whole array is too large. So I was considering to turn value->contents into some discontiguous ranges and this patch could also benefit from it. > }; > > +int > +value_bytes_available (const struct value *value, int offset, int length) ctags will never find a comment defined in a .h file. I would prefer at least a stub comment: /* Function comment present at the declaration. */ Many legacy functions just do not have any comment so one just does not search more for a comment when there isn't any shown on the ctags-jump. > + i = VEC_lower_bound (range_s, value->unavailable, &newr, range_lessthan); > + if (i > 0) > + { > + struct range *bef = VEC_index (range_s, value->unavailable, i - i); While this patch revisiou fixed two bugs it has introduced a new bug - "i - i" -> "i - 1". Thanks, Jan