Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: vladimir@codesourcery.com, eliz@gnu.org, gdb-patches@sources.redhat.com
Subject: Re: Flash support part 1: memory maps
Date: Tue, 01 Aug 2006 00:53:00 -0000	[thread overview]
Message-ID: <20060801005333.GB24099@nevyn.them.org> (raw)
In-Reply-To: <200607312208.k6VM82PM012536@elgar.sibelius.xs4all.nl>

I'll let Vlad answer most of this, but there's one bit I'm responsible
for, so I'll give it a shot :-)

On Tue, Aug 01, 2006 at 12:08:02AM +0200, Mark Kettenis wrote:
> I'm still not sure how this fits in.  Certainly if my target already
> provides a memory map in a nice data structure I'm not supposed to
> convert that into XML am I?  I should be able to just implement
> to_memory_map and convert it directly into a VEC(memory_region).

Right.  You wouldn't have to implement TARGET_OBJECT_MEMORY_MAP at all
in that case.  I wrestled with this a while for self-describing
targets.

We needed a way for users to specify the memory maps: both by hand, as
final end users, and automatically, as remote stub developers.  We want
to use the same format for both of those, so there needs to be a single
defined format to write these things in.  We picked XML, so there's a
DTD (Document Type Description) and you can automatically validate
maps, et cetera.  Then there's another format for GDB to work with
internally, as a C data structure.

The C data structure doesn't lend itself to the to_xfer_partial
interface well at all; there's memory allocation issues, for instance.
Rather than pass the binary data around through to_xfer_partial, or
invent yet another mechanism for reading special data from the target,
I ended up passing it through what has now become target_read_alloc.
This spared me having to deal with things like packet size limits
and partial transfers.

So what I ended up with was a standard implementation of
to_available_features (similar role to to_memory_map here).  That lives
in some code which isn't specific to the remote backend, but the
remote backend chooses to use it to implement
remote_ops.to_available_features.  Other backends might choose to do
that too, and provide XML, or implement to_available_features
directly.

It is a little twisty and redundant, but I couldn't see a better way.
If you do, I'm all ears :-)

> You really don't have to say things twice ;-).

I bet SVK has this bug too... when you do "svn diff | patch -p0 -R" it
leaves empty files by default because it doesn't bother to fill out
enough of the diff header :-(

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-08-01  0:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-20  9:41 Vladimir Prus
2006-07-20 19:32 ` Eli Zaretskii
2006-07-21 11:35   ` Vladimir Prus
2006-07-21 15:20     ` Eli Zaretskii
2006-07-31 13:00       ` Vladimir Prus
2006-07-31 13:20         ` Vladimir Prus
2006-07-31 22:09           ` Mark Kettenis
2006-08-01  0:53             ` Daniel Jacobowitz [this message]
2006-08-01  5:11             ` Vladimir Prus
2006-08-16 20:05 ` Daniel Jacobowitz
2006-09-21 13:56   ` Daniel Jacobowitz

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=20060801005333.GB24099@nevyn.them.org \
    --to=drow@false.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    --cc=vladimir@codesourcery.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