From: Michael Snyder <msnyder@vmware.com>
To: Doug Evans <dje@google.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Seems like a bug in target_read_stack / dcache_xfer_memory?
Date: Sun, 25 Oct 2009 02:03:00 -0000 [thread overview]
Message-ID: <4AE3B051.1000303@vmware.com> (raw)
In-Reply-To: <e394668d0910231018s1afac1e7ic1194c914368e2e2@mail.gmail.com>
Doug Evans wrote:
> On Thu, Oct 22, 2009 at 12:54 PM, Michael Snyder <msnyder@vmware.com> wrote:
>> Michael Snyder wrote:
>>> Doug Evans wrote:
>>>> On Mon, Oct 19, 2009 at 2:35 PM, Michael Snyder <msnyder@vmware.com>
>>>> 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 <dje@google.com>
>
> * 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;
next prev parent reply other threads:[~2009-10-25 2:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-18 22:37 Michael Snyder
2009-10-18 22:51 ` drow
2009-10-19 17:49 ` Michael Snyder
2009-10-19 18:37 ` Daniel Jacobowitz
2009-10-19 19:41 ` Michael Snyder
2009-10-19 21:28 ` Daniel Jacobowitz
2009-10-19 21:42 ` Michael Snyder
2009-10-22 2:46 ` Doug Evans
2009-10-22 18:02 ` Michael Snyder
2009-10-22 20:01 ` Michael Snyder
2009-10-23 17:18 ` Doug Evans
2009-10-25 2:03 ` Michael Snyder [this message]
2009-10-26 8:25 ` Hui Zhu
2009-10-19 4:46 ` Hui Zhu
2009-10-19 18:02 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AE3B051.1000303@vmware.com \
--to=msnyder@vmware.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox