This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PRecord sets memory even when it says it did not
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <pedro at codesourcery dot com>
- Cc: Michael Snyder <msnyder at vmware dot com>, Marc Khouzam <marc dot khouzam at ericsson dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>, Greg Law <glaw at undo-software dot com>, Hui Zhu <teawater at gmail dot com>, gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Mon, 14 Sep 2009 14:07:56 -0700
- Subject: Re: PRecord sets memory even when it says it did not
- References: <F7CE05678329534C957159168FA70DEC5153600749@EUSAACMS0703.eamcs.ericsson.se> <200909141936.10390.pedro@codesourcery.com> <e394668d0909141204k5ebb4481uacbd70b67b5e6161@mail.gmail.com> <200909142135.58989.pedro@codesourcery.com>
On Mon, Sep 14, 2009 at 1:35 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> There's one wrinkly corner case not being handled. ?If the to_xfer_partial
> routine throws an error, say a ptrace error of some kind (usually
> perror_with_name), the ops target may still have succeeded in writing a
> part of that partial transfer, but, the matching caches lines aren't
> being invalidated/committed. ?This is fine if we assume that errors
> are only thrown before attempting any transfer at all, but that is not
> reality. ?E.g., when xfering [1000, 2000) in a single go, that may
> fail half way, say, at 1500 with a hard thrown error. ?Only thing 100%
> safe to in these cases is to just flush the whole cache area that was
> attempted to be written, or perhaps simpler, the whole cache. ?Not
> something you'd see hapenning every day, but still something
> to consider at some point.
I would have thought that this case would be handled by returning the
amount actually written instead of throwing an error (and that not
doing so is a bug, regardless of the needs of dcache).
A single ptrace call won't fail leaving behind a partial write, but I
can imagine a sequence of ptrace writes ultimately failing.