Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: twall@oculustech.com
Cc: gdb@sources.redhat.com
Subject: Re: Address generation question
Date: Tue, 05 Feb 2002 20:01:00 -0000	[thread overview]
Message-ID: <3C60A8F4.94FEE847@redhat.com> (raw)
In-Reply-To: <3C5FEAA4.4E46F7C9@oculustech.com>

Timothy Wall wrote:
> 
> I'm working on support for a DSP that has a dual addressing architecture (actually quite common in DSPs).  That in itself is not too big a problem, since GDB's CORE_ADDR can be made sufficiently large to include flags to indicate a particulare address bus.  The issue I'm working on is that one bus addresses by octet, while another addresses by 16-bit word.  When generating a new address from a base and an octet count, 0x1000 + 2 octets in the first case results in 0x1002, while in the second it results in 0x1001.   (At one time it was suggested to represent the second address as 0x2002, effectively directly mapping all octets, but while this makes easy integration into GDB, it's really ugly to use in practice, requiring the programmer to translate the addresses back to what they "really" are).
> 
> I'd like to know if anyone knows of any structures already built into GDB that might be suited to handling this arrangement.  I haven't found any, so I figured I'd simply build on some previous DSP work I've done which allows GDB to handle architectures with non-octet bytes (i.e., the least addressible unit on the target system is something other than 8 bits).
> 
> My proposed solution is to encapsulate the address generation bits into a macro, ADDR_OFFSET(a,b), where 'a' is the starting CORE_ADDR and 'b' is the octet offset count.  The result of this macro is assigned to the new address.  This makes it relatively easy to generate an offset appropriate to the addressing bus represenged in 'a'.  I'm not sure yet if there are places where intermediate values need to be saved which might lose the initial address context, though.

Use gdbarch_pointer_to_address and gdbarch_address_to_pointer.
Internally GDB can be made to store addresses as normal byte pointers, 
while externally they will be in the target format.  This is normal for
debugging harvard architectures.


      parent reply	other threads:[~2002-02-06  4:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-05  6:22 Timothy Wall
2002-02-05  7:58 ` Andrew Cagney
2002-02-05 20:01 ` Michael Snyder [this message]

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=3C60A8F4.94FEE847@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=twall@oculustech.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