From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13356 invoked by alias); 23 Oct 2009 17:18:41 -0000 Received: (qmail 13344 invoked by uid 22791); 23 Oct 2009 17:18:37 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Oct 2009 17:18:31 +0000 Received: from spaceape13.eur.corp.google.com (spaceape13.eur.corp.google.com [172.28.16.147]) by smtp-out.google.com with ESMTP id n9NHISom020983 for ; Fri, 23 Oct 2009 18:18:28 +0100 Received: from ey-out-1920.google.com (eyh3.prod.google.com [10.208.8.3]) by spaceape13.eur.corp.google.com with ESMTP id n9NHIPmm008299 for ; Fri, 23 Oct 2009 10:18:26 -0700 Received: by ey-out-1920.google.com with SMTP id 3so10315793eyh.34 for ; Fri, 23 Oct 2009 10:18:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.86.80 with SMTP id v58mr3791812wee.40.1256318305468; Fri, 23 Oct 2009 10:18:25 -0700 (PDT) In-Reply-To: <4AE0B881.4040809@vmware.com> References: <4ADB9759.7060305@vmware.com> <20091018225134.GA30546@caradoc.them.org> <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> Date: Fri, 23 Oct 2009 17:18:00 -0000 Message-ID: Subject: Re: Seems like a bug in target_read_stack / dcache_xfer_memory? From: Doug Evans To: Michael Snyder Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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/msg00598.txt.bz2 On Thu, Oct 22, 2009 at 12:54 PM, Michael Snyder wrot= e: > 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-2f56f7474cf60c6a587= 9ba6d8a4e4d034e6d0c8e 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 Doug Evans * record.c (record_core_xfer_partial): Pass correct offset to record_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 23 Oct 2009 16:11:37 -0000 1.33 +++ record.c 23 Oct 2009 17:07:08 -0000 @@ -1629,6 +1629,7 @@ record_core_xfer_partial (struct target_ if (offset >=3D p->addr) { struct record_core_buf_entry *entry; + ULONGEST sec_offset; if (offset >=3D p->endaddr) continue; @@ -1636,7 +1637,7 @@ record_core_xfer_partial (struct target_ if (offset + len > p->endaddr) len =3D p->endaddr - offset; - offset -=3D p->addr; + sec_offset =3D offset - p->addr; /* Read readbuf or write writebuf p, offset, len. */ /* Check flags. */ @@ -1673,7 +1674,8 @@ record_core_xfer_partial (struct target_ record_core_buf_list =3D entry; } - memcpy (entry->buf + offset, writebuf, (size_t) le= n); + memcpy (entry->buf + sec_offset, writebuf, + (size_t) len); } else { @@ -1683,7 +1685,8 @@ record_core_xfer_partial (struct target_ object, annex, readbuf, writebuf, offset, len); - memcpy (readbuf, entry->buf + offset, (size_t) len); + memcpy (readbuf, entry->buf + sec_offset, + (size_t) len); } return len;