From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28563 invoked by alias); 25 Oct 2009 02:03:46 -0000 Received: (qmail 28303 invoked by uid 22791); 25 Oct 2009 02:03:44 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 25 Oct 2009 02:03:39 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 8E8E820019; Sat, 24 Oct 2009 19:03:38 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost3.vmware.com (Postfix) with ESMTP id 7E214CD9A5; Sat, 24 Oct 2009 19:03:38 -0700 (PDT) Message-ID: <4AE3B051.1000303@vmware.com> Date: Sun, 25 Oct 2009 02:03:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Doug Evans CC: "gdb-patches@sourceware.org" Subject: Re: Seems like a bug in target_read_stack / dcache_xfer_memory? 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00619.txt.bz2 Doug Evans wrote: > On 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. dcache returns zero, >>>>> and memory_xfer_partial bails out instead of trying the >>>>> next target down the target stack. >>>> Hi. If 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. Thanks, 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-2f56f7474cf60c6a5879ba6d8a4e4d034e6d0c8e > > Thanks for the testcase. > You may be right about needing to test for "res == 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. Thanks for the fix. It handles the case I was concerned with. > 2009-10-23 Doug Evans > > * record.c (record_core_xfer_partial): Pass correct offset to > record_beneath_to_xfer_partial. > > Index: record.c > =================================================================== > 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 >= p->addr) > { > struct record_core_buf_entry *entry; > + ULONGEST sec_offset; > > if (offset >= p->endaddr) > continue; > @@ -1636,7 +1637,7 @@ record_core_xfer_partial (struct target_ > if (offset + len > p->endaddr) > len = p->endaddr - offset; > > - offset -= p->addr; > + sec_offset = 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 = entry; > } > > - memcpy (entry->buf + offset, writebuf, (size_t) len); > + 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;