From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12987 invoked by alias); 24 Jun 2003 23:02:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22770 invoked from network); 24 Jun 2003 22:06:15 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 24 Jun 2003 22:06:15 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h5OM6FH15410 for ; Tue, 24 Jun 2003 18:06:15 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h5OM6FI21292 for ; Tue, 24 Jun 2003 18:06:15 -0400 Received: from localhost.localdomain (vpn50-14.rdu.redhat.com [172.16.50.14]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h5OM6D201976; Tue, 24 Jun 2003 18:06:14 -0400 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h5OM69N22090; Tue, 24 Jun 2003 15:06:09 -0700 Date: Tue, 24 Jun 2003 23:02:00 -0000 From: Kevin Buettner Message-Id: <1030624220608.ZM22089@localhost.localdomain> In-Reply-To: Andrew Cagney "[commit] Allow cached cooked reads" (Jun 16, 9:22am) References: <3EEDC499.4010209@redhat.com> To: Andrew Cagney , gdb-patches@sources.redhat.com Subject: Re: [commit] Allow cached cooked reads MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-06/txt/msg00760.txt.bz2 On Jun 16, 9:22am, Andrew Cagney wrote: > Just stumbled across this. When trying to save cooked registers the > regcache was triggering an assertion failure instead of ignoring a bogus > request. > > 2003-06-16 Andrew Cagney > > * regcache.c (do_cooked_read): Do not use register_valid_p. > > Index: regcache.c > =================================================================== > RCS file: /cvs/src/src/gdb/regcache.c,v > retrieving revision 1.87 > diff -u -r1.87 regcache.c > --- regcache.c 9 Jun 2003 01:02:06 -0000 1.87 > +++ regcache.c 16 Jun 2003 13:18:46 -0000 > @@ -423,8 +423,7 @@ > do_cooked_read (void *src, int regnum, void *buf) > { > struct regcache *regcache = src; > - if (!regcache_valid_p (regcache, regnum) > - && regcache->readonly_p) > + if (!regcache->register_valid_p[regnum] && regcache->readonly_p) > /* Don't even think about fetching a register from a read-only > cache when the register isn't yet valid. There isn't a target > from which the register value can be fetched. */ Which assertion was failing? The check for regcache != NULL or the bounds check? I'm wondering if the new code above should include some bounds checks. Alternately, go back to using regcache_valid_p() and weaken the assertions in regcache_valid_p() somewhat. E.g, perhaps rewrite regcache_valid_p() from: int regcache_valid_p (struct regcache *regcache, int regnum) { gdb_assert (regcache != NULL); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); return regcache->register_valid_p[regnum]; } to: int regcache_valid_p (struct regcache *regcache, int regnum) { gdb_assert (regcache != NULL); gdb_assert (regnum >= 0); return regnum < regcache->descr->nr_raw_registers) && regcache->register_valid_p[regnum]; } Kevin