From: Doug Evans <dje@google.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: Michael Snyder <msnyder@vmware.com>,
Marc Khouzam <marc.khouzam@ericsson.com>,
"gdb@sourceware.org" <gdb@sourceware.org>,
Greg Law <glaw@undo-software.com>,
Hui Zhu <teawater@gmail.com>,
gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: PRecord sets memory even when it says it did not
Date: Mon, 14 Sep 2009 19:04:00 -0000 [thread overview]
Message-ID: <e394668d0909141204k5ebb4481uacbd70b67b5e6161@mail.gmail.com> (raw)
In-Reply-To: <200909141936.10390.pedro@codesourcery.com>
On Mon, Sep 14, 2009 at 11:36 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> Hmmm. On a less quicker look, how about if we get rid of the
> dcache_xfer_memory and dcache_update calls in memory_xfer_partial,
>
> (excuse the pseudo-patch-written-in-email)
>
> target.c:memory_xfer_partial
>
> - inf = find_inferior_pid (ptid_get_pid (inferior_ptid));
> -
> - if (inf != NULL
> - && (region->attrib.cache
> - || (stack_cache_enabled_p && object == TARGET_OBJECT_STACK_MEMORY)))
> - {
> - if (readbuf != NULL)
> - res = dcache_xfer_memory (ops, target_dcache, memaddr, readbuf,
> - reg_len, 0);
> - else
> - /* FIXME drow/2006-08-09: If we're going to preserve const
> - correctness dcache_xfer_memory should take readbuf and
> - writebuf. */
> - res = dcache_xfer_memory (ops, target_dcache, memaddr,
> - (void *) writebuf,
> - reg_len, 1);
> - if (res <= 0)
> - return -1;
> - else
> - {
> - if (readbuf && !show_memory_breakpoints)
> - breakpoint_restore_shadows (readbuf, memaddr, reg_len);
> - return res;
> - }
> - }
> -
> - /* Make sure the cache gets updated no matter what - if we are writing
> - to the stack, even if this write is not tagged as such, we still need
> - to update the cache. */
> -
> - if (inf != NULL
> - && readbuf == NULL
> - && !region->attrib.cache
> - && stack_cache_enabled_p
> - && object != TARGET_OBJECT_STACK_MEMORY)
> - {
> - dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len);
> - }
>
>
> and replaced this call below, something like so:
>
> do
> {
> - res = ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
> - readbuf, writebuf, memaddr, reg_len);
> + res = dcache_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
> + readbuf, writebuf, memaddr, reg_len);
>
>
> if (res > 0)
> break;
>
> /* We want to continue past core files to executables, but not
> past a running target's memory. */
> if (ops->to_has_all_memory (ops))
> break;
>
> ops = ops->beneath;
> }
> while (ops != NULL);
>
> ... by a dcache_xfer_memory call, but tweak its interface to pass it
> the object type? Things would be tidier and dcache_xfer_memory
> would then handle all this dcache updating/invalidating itself.
>
> On the plus side, when the dcache is in effect, with that change,
> we'd again walk the whole target stack, which isn't true currently
> (and looks like a possible design flaw).
OTOH, its nice having memory_xfer_partial do the region attribute processing.
It seems like what's needed is to move
/* Make sure the cache gets updated no matter what - if we are
writing
to the stack, even if this write is not tagged as such, we still
need
to update the cache. */
if (inf != NULL
&& readbuf == NULL
&& !region->attrib.cache
&& stack_cache_enabled_p
&& object != TARGET_OBJECT_STACK_MEMORY)
{
dcache_update (target_dcache, memaddr, (void *) writebuf, reg_len);
}
to after the call
res = ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
readbuf, writebuf, memaddr, reg_len);
predicated on res > 0.
[dcache.c does the write first, and then updates the cache if it
succeeded, we just need to do that here too, methinks]
next prev parent reply other threads:[~2009-09-14 19:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <F7CE05678329534C957159168FA70DEC5153600749@EUSAACMS0703.eamcs.ericsson.se>
2009-09-14 4:40 ` Hui Zhu
2009-09-14 13:52 ` Marc Khouzam
2009-09-14 17:17 ` Michael Snyder
2009-09-14 17:21 ` Marc Khouzam
2009-09-14 17:26 ` Michael Snyder
2009-09-14 15:53 ` Daniel Jacobowitz
2009-09-14 16:15 ` Hui Zhu
2009-09-14 17:10 ` Marc Khouzam
2009-09-14 17:10 ` Greg Law
2009-09-14 17:19 ` Marc Khouzam
2009-09-14 17:50 ` Pedro Alves
2009-09-14 17:54 ` Marc Khouzam
2009-09-14 18:00 ` Michael Snyder
2009-09-14 18:01 ` Pedro Alves
2009-09-14 18:02 ` Michael Snyder
2009-09-14 18:15 ` Pedro Alves
2009-09-14 18:21 ` Michael Snyder
2009-09-14 18:36 ` Pedro Alves
2009-09-14 19:04 ` Doug Evans [this message]
2009-09-14 19:08 ` Michael Snyder
2009-09-14 20:36 ` Pedro Alves
2009-09-14 21:08 ` Doug Evans
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=e394668d0909141204k5ebb4481uacbd70b67b5e6161@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=gdb@sourceware.org \
--cc=glaw@undo-software.com \
--cc=marc.khouzam@ericsson.com \
--cc=msnyder@vmware.com \
--cc=pedro@codesourcery.com \
--cc=teawater@gmail.com \
/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