Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Michael Snyder <msnyder@redhat.com>
Cc: GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [rfa] Restore "trust-readonly-section"
Date: Sat, 28 May 2005 22:55:00 -0000	[thread overview]
Message-ID: <20050528221753.GB22435@nevyn.them.org> (raw)
In-Reply-To: <42927D75.4050009@redhat.com>

On Mon, May 23, 2005 at 06:03:49PM -0700, Michael Snyder wrote:
> I suppose you're right -- but I'm bewildered by the number of
> possible entry points and paths thru this code.  In theory
> I think I could get away with just covering three points:
> target_read_memory, target_read_partial, and target_read_memory_partial,
> were it not for the fact that do_xfer_memory is also an entry point.

Yes, there really are too many.  I hope that some day soon, we can
reduce the total number.

> do_xfer_memory seems to only be called from dcache.c --
> but it's extern, so nothing prevents others from calling it.
> 
> And dcache_xfer_memory is extern too, so one can get in thru there
> (although again, no one currently does AFAICT).
> 
> >The code might be simpler if you push the trust_readonly check inside
> >target_read_trusted.  Also, could you name that something involving
> >memory?
> 
> OK -- how about the attached, which includes four entry points?

This looks much nicer to me.  Thaks for revising!  One style concern;
I'd be happier if you avoided assignments in if statement.  But I'm not
much bothered about it either way.

> +   /* Honor "trust-readonly-sections" if set.  */
> +   if ((ret = target_read_memory_trusted (memaddr, myaddr, len)) > 0)
> +     return (ret != len);
> + 

This could be:
  if (target_read_memory_trusted (memaddr, myaddr, len) == len)
    return 0;

If it fails, might as well fall through.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


  reply	other threads:[~2005-05-28 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13  6:29 Michael Snyder
2005-05-13 11:41 ` Michael Snyder
2005-05-15 17:25   ` Daniel Jacobowitz
2005-05-24  2:03     ` Michael Snyder
2005-05-28 22:55       ` Daniel Jacobowitz [this message]
2005-06-11 15:26       ` Mark Kettenis

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=20050528221753.GB22435@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@redhat.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