Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: "Theodore A. Roth" <troth@verinet.com>
Cc: Daniel Jacobowitz <drow@mvista.com>, gdb@sources.redhat.com
Subject: Re: gdb support for Atmel AVR
Date: Fri, 08 Feb 2002 14:56:00 -0000	[thread overview]
Message-ID: <3C6457A8.4090801@cygnus.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0202081432540.30447-100000@bozoland.mynet>

> On Fri, 8 Feb 2002, Daniel Jacobowitz wrote:
> 
> :)I really do not think that TARGET_REMOTE_ADDR_BIT should be
> :)necessary... in what way was TARGET_ADDR_BIT/TARGET_POINTER_BIT
> :)inadequate?  Do you have different sized code and data pointers?
> 
> Code and data pointers are both 16-bit. The problem is we use some of the
> bits 31-16 to flag whether gdb is asking for code (flash) or data (sram)
> space.  Using "remote_address_size = TARGET_ADDR_BIT;" in remote.c causes
> gdb to mask off the upper 16 bits thus removing the flag. Without the
> flag, the target will always think it is accessing code space.


TARGET_ADDR_BIT is the number of significant bits in a CORE_ADDR.  For 
your target that is 32.  The remote protocol will use those 32 bits when 
  requesting raw memory.

Separatly, you've got 16 bit pointers you need TARGET_PTR_BIT=16.  GDB 
uses the functions pointer_to_address() and address_to_pointer() when 
converting a C code/data pointer to/from a CORE_ADDR.

BTW, the d10v is even more fun.  Data pointers are 16 bits and point to 
an 8 bit byte.  Code pointers are also 16 bits but point to a 16 bit 
word.  Consequently some shifting also occures when converting to/from 
CORE_ADDRS.  This all works with out cpu specific changes to core GDB.


> Basically, I've tricked gdb into storing ptrs and addresses into 32 bit
> numbers while it still thinks that they are both 16 bits. I need all 32
> bits sent to the target, but when gdb issues an 'm' packet for say a
> struct, it must request the right number of bytes from the remote target. 


The d10v was doing something like that but has since been fixed.


> I got burned by this when I set remoteaddresssize to 32. Gdb would ask for 
> 4 bytes at some address and then dereference the return value thinking the 
> value was a ptr. Needless to say, the 32 ptr pointed to the wrong data.


I'd try the above.

enjoy,
Andrew





  parent reply	other threads:[~2002-02-08 22:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-07 11:53 Theodore A. Roth
2002-02-08  8:33 ` Andrew Cagney
2002-02-08  9:53   ` Theodore A. Roth
2002-02-08 11:20     ` Daniel Jacobowitz
2002-02-08 14:19       ` Theodore A. Roth
2002-02-08 14:29         ` Daniel Jacobowitz
2002-02-08 14:56         ` Andrew Cagney [this message]
2002-02-08 15:10           ` Theodore A. Roth
2002-02-10 10:27           ` Theodore A. Roth
2002-02-10 10:38             ` Andrew Cagney
2002-02-08 12:49     ` Andrew Cagney
2002-02-11 14:18   ` Theodore A. Roth

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=3C6457A8.4090801@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=troth@verinet.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