From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24916 invoked by alias); 26 Oct 2009 08:25:48 -0000 Received: (qmail 24848 invoked by uid 22791); 26 Oct 2009 08:25:47 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f203.google.com (HELO mail-px0-f203.google.com) (209.85.216.203) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Oct 2009 08:25:42 +0000 Received: by pxi41 with SMTP id 41so2467786pxi.24 for ; Mon, 26 Oct 2009 01:25:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.249.6 with SMTP id w6mr1097095wfh.346.1256545541086; Mon, 26 Oct 2009 01:25:41 -0700 (PDT) In-Reply-To: References: <4ADB9759.7060305@vmware.com> <4ADCA53C.2080703@vmware.com> <20091019183724.GA17923@caradoc.them.org> <4ADCBF6B.9050309@vmware.com> <20091019212817.GB3401@caradoc.them.org> <4ADCDBB7.2050500@vmware.com> <4AE09CA9.2060401@vmware.com> <4AE0B881.4040809@vmware.com> From: Hui Zhu Date: Mon, 26 Oct 2009 08:25:00 -0000 Message-ID: Subject: Re: Seems like a bug in target_read_stack / dcache_xfer_memory? To: Doug Evans Cc: Michael Snyder , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2009-10/txt/msg00640.txt.bz2 Thanks Doug. Hui On Sat, Oct 24, 2009 at 01:18, Doug Evans wrote: > =A0On Thu, Oct 22, 2009 at 12:54 PM, Michael Snyder = wrote: >> Michael Snyder wrote: >>> >>> Doug Evans wrote: >>>> >>>> On Mon, Oct 19, 2009 at 2:35 PM, Michael Snyder >>>> wrote: >>>>> >>>>> Anyway, yes, that's what it does. =A0dcache returns zero, >>>>> and memory_xfer_partial bails out instead of trying the >>>>> next target down the target stack. >>>> >>>> Hi. =A0If it will help I'll play with your testcase tomorrow. >>>> I'll also volunteer to make a pass through the code and add some >>>> comments. >>>> [I mention that just in case you or someone is already in the process >>>> of doing that.] >>> >>> Sure it will help. =A0Thanks, Doug. >> >> And the test case is in the repo now -- solib-precsave.exp. >> How to run tests: >> http://www.sourceware.org/gdb/wiki/ProcessRecord#head-2f56f7474cf60c6a58= 79ba6d8a4e4d034e6d0c8e > > Thanks for the testcase. > You may be right about needing to test for "res =3D=3D 0" but I'm less > sure now, so I'm going to leave it as is, at least for now. > dcache calls target_read (TARGET_OBJECT_RAW_MEMORY) which should DTRT. > And in fact it does with this patch. :-) > Checked in. > > 2009-10-23 =A0Doug Evans =A0 > > =A0 =A0 =A0 =A0* record.c (record_core_xfer_partial): Pass correct offset= to > =A0 =A0 =A0 =A0record_beneath_to_xfer_partial. > > Index: record.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/record.c,v > retrieving revision 1.33 > diff -u -p -r1.33 record.c > --- record.c =A0 =A023 Oct 2009 16:11:37 -0000 =A0 =A0 =A01.33 > +++ record.c =A0 =A023 Oct 2009 17:07:08 -0000 > @@ -1629,6 +1629,7 @@ record_core_xfer_partial (struct target_ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (offset >=3D p->addr) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct record_core_buf_entry *entr= y; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ULONGEST sec_offset; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (offset >=3D p->endaddr) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0continue; > @@ -1636,7 +1637,7 @@ record_core_xfer_partial (struct target_ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (offset + len > p->endaddr) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0len =3D p->endaddr - offset; > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 offset -=3D p->addr; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sec_offset =3D offset - p->addr; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Read readbuf or write writebuf = p, offset, len. =A0*/ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Check flags. =A0*/ > @@ -1673,7 +1674,8 @@ record_core_xfer_partial (struct target_ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0record_core_buf_li= st =3D entry; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0memcpy (entry->buf + off= set, writebuf, (size_t) len); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0memcpy (entry->buf + sec= _offset, writebuf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (size_t) le= n); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > @@ -1683,7 +1685,8 @@ record_core_xfer_partial (struct target_ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ob= ject, annex, readbuf, writebuf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0of= fset, len); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 memcpy (readbuf, entry->buf= + offset, (size_t) len); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 memcpy (readbuf, entry->buf= + sec_offset, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(size_t) len= ); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return len; >