Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Marcel Moolenaar <marcel@cup.hp.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] New port: ia64-*-freebsd
Date: Sun, 24 Jul 2005 21:26:00 -0000	[thread overview]
Message-ID: <20050724212649.GA13210@nevyn.them.org> (raw)
In-Reply-To: <81d1f4d6faa9a09741ad6d68f3c1e5a9@cup.hp.com>

On Fri, Jul 15, 2005 at 11:20:46AM -0700, Marcel Moolenaar wrote:
> On Jul 14, 2005, at 7:16 PM, Daniel Jacobowitz wrote:
> >So, it treats the annex as a memory pointer and returns the contents of
> >memory there.  Why?  And why is this a useful generic implementation?
> 
> Yeah, that's a bit tricky. Here's why:
> 
> The stacked registers that are flushed, live in memory below the
> address pointed to by the BSPSTORE register. The stacked registers
> that are dirty would be flushed to memory between the values of
> BSPSTORE (bottom) and BSP (top) if and when they are being flushed.

Unless there isn't room, right?  That's where I get confused.  How is
the data in the core file mapped onto the memory space?

> I figured that from an API point of view it's safer to access the
> dirty registers by their index or offset relative to BSPSTORE, and
> not by their absolute memory address, because their corresponding
> memory address is unreal. I can change the backing store pointer
> (i.e. BSPSTORE) and then flush the dirty registers. So, tying the
> dirty registers to their would-be memory address seemed "wrong".
> Hence, the offset is the offset relative to BSPSTORE.

Sure... though documentation of this would be good.

> However when the dirty registers need to be accessed as if they
> were flushed, as needs to be done on Linux, then we need to know
> to value of BSPSTORE so that we can map the relative offset to
> an absolute memory location. For this reason I use the annex.
> To support cross-debugging when gdb runs on a 32-bit host, I
> cannot pass BSPSTORE by value (sizeof(void*) < sizeof(CORE_ADDR)).
> So, I pass it by reference. Hence the indirection.

This does not seem like anything that needs or wants a generic
implementation.  I think we will need to arrange for the target to
override and augment the core file operations, so that this can be in
an ia64-specific file - probably, an ia64-linux or ia64-freebsd (it's
not clear to me which from your description) specific file.

> There's just one slight problem: the number of dirty registers is
> variable, but bounded. Unfortunately the upper bound is rather
> high: 16383. This yields a worse-case memory footprint of 128KB :-/
> (8 bytes per register and NaT collection).
> I think that on average the number of dirty registers is something
> like 128. I doesn't really look like a good idea to create the 128KB
> of memory for the worst-case when 1KB would be sufficient on
> avarage.

This I know how to handle; it hasn't been implemented yet, but the
optional/target-available registers interface will allow you to create
the necessary number of dirty registers in the regcache.  I'm not sure
I agree that they belong there, but I don't know enough about it to
judge.

> >>From your description abov it sounds like these ought to be in their
> >own core file note anyway; why have they ended up in "memory"?
> 
> That's currently how Linux works and it's also currently how FreeBSD
> creates the core files. Linux cannot do it any other way, because it's
> all abstracted by the kernel on live processes and if gdb doesn't know
> the difference between flushed and dirty stacked registers, you cannot
> dump the dirty stacked registers to a core file anywhere else then where
> they would be when they were flushed.
> 
> On FreeBSD the note isn't yet created because that requires a bit of
> work and we had the plans to revamp the core file notes anyway (due
> to threading). So, I decided to first get the port contributed and
> then work on how best to deal with the dirty stacked registers. This
> then could be part of a larger (cross-platform) revamp of how FreeBSD
> creates core files, which would also result in a rather large set of
> changes to binutils.
> 
> Anyway: since some targets work with the abstraction, there need to
> be a couple places where accessing dirty registers need to be mapped
> to memory references. This may change in the future.

Except FreeBSD, it sounds like, supports cases where they couldn't be
mapped unambiguously to memory.

I really recommend fixing your notes first and not making GDB support
this scheme.

Anyway, that's enough out of me.  I'll leave the rest to Mark and the
ia64 maintainers.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  reply	other threads:[~2005-07-24 21:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-05 19:52 Marcel Moolenaar
2005-07-06 17:24 ` Followup: " Marcel Moolenaar
2005-07-15  0:01 ` Daniel Jacobowitz
2005-07-15  2:08   ` Marcel Moolenaar
2005-07-15  2:16     ` Daniel Jacobowitz
2005-07-15 18:20       ` Marcel Moolenaar
2005-07-24 21:26         ` Daniel Jacobowitz [this message]
2005-07-25 17:32           ` Marcel Moolenaar
2005-07-25 17:36             ` Daniel Jacobowitz
2005-07-25 17:58               ` Marcel Moolenaar
2005-07-25 19:34                 ` Mark Kettenis
2005-07-25 20:41                   ` Marcel Moolenaar

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=20050724212649.GA13210@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=marcel@cup.hp.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