public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Targets with non-byte-addressable memory
@ 2005-09-23  8:59 Vladimir Prus
  2005-09-23 17:12 ` Dave Korn
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Prus @ 2005-09-23  8:59 UTC (permalink / raw)
  To: gdb


Hello!

Does anybody has experience of porting gdb to a target where memory is not
byte-addressable. That is, if you read 0x80000007 you get 4 bytes and if
you read 0x80000008 you get another 4 bytes.

The source has TARGET_CHAR_BIT macro, but no target under "config" makes use
of them which makes me suspect that setting it won't do any good. In fact,
after setting it to 32, I get compile error in ax-gdb.c:

        case 8 / TARGET_CHAR_BIT:
          ax_simple (ax, aop_ref8);
          break;
        case 16 / TARGET_CHAR_BIT:
          ax_simple (ax, aop_ref16);
          break;
        case 32 / TARGET_CHAR_BIT:
          ax_simple (ax, aop_ref32);
          break;
        case 64 / TARGET_CHAR_BIT:
          ax_simple (ax, aop_ref64);

as both 8/32 and 16/32 give 0, and I get duplicate case label.

So, any easy way for me?

- Volodya






^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Targets with non-byte-addressable memory
  2005-09-23  8:59 Targets with non-byte-addressable memory Vladimir Prus
@ 2005-09-23 17:12 ` Dave Korn
  2005-09-26  6:13   ` Vladimir Prus
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Korn @ 2005-09-23 17:12 UTC (permalink / raw)
  To: 'Vladimir Prus', gdb

----Original Message----
>From: Vladimir Prus
>Sent: 23 September 2005 09:56

> Hello!
> 
> Does anybody has experience of porting gdb to a target where memory is not
> byte-addressable. That is, if you read 0x80000007 you get 4 bytes and if
> you read 0x80000008 you get another 4 bytes.
> 
> The source has TARGET_CHAR_BIT macro, but no target under "config" makes
> use of them which makes me suspect that setting it won't do any good. In
> fact, after setting it to 32, I get compile error in ax-gdb.c:
> 
>         case 8 / TARGET_CHAR_BIT:
>           ax_simple (ax, aop_ref8);
>           break;
>         case 16 / TARGET_CHAR_BIT:
>           ax_simple (ax, aop_ref16);
>           break;
>         case 32 / TARGET_CHAR_BIT:
>           ax_simple (ax, aop_ref32);
>           break;
>         case 64 / TARGET_CHAR_BIT:
>           ax_simple (ax, aop_ref64);
> 
> as both 8/32 and 16/32 give 0, and I get duplicate case label.


  Changing TARGET_CHAR_BIT is the wrong way to go.  Basically, IIUIC, you
shouldn't need to do anything at all for native debugging, and for remote
debugging, you'll have to take care of it in the stub/server.



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Targets with non-byte-addressable memory
  2005-09-23 17:12 ` Dave Korn
@ 2005-09-26  6:13   ` Vladimir Prus
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Prus @ 2005-09-26  6:13 UTC (permalink / raw)
  To: gdb

Dave Korn wrote:


>> Does anybody has experience of porting gdb to a target where memory is
>> not byte-addressable. That is, if you read 0x80000007 you get 4 bytes and
>> if you read 0x80000008 you get another 4 bytes.
>> 
>> The source has TARGET_CHAR_BIT macro, but no target under "config" makes
>> use of them which makes me suspect that setting it won't do any good. 
> 
>   Changing TARGET_CHAR_BIT is the wrong way to go.  Basically, IIUIC, you
> shouldn't need to do anything at all for native debugging, and for remote
> debugging, you'll have to take care of it in the stub/server.


Hi Dave,
in my case it's remote debugging. Unfortunately, I don't know what
stub/server can do. Just a couple of cases.

1. When printing memory, say "x/2w 0x80000007", gdb first sends
   "fetch 4 bytes at 0x80000007" request and then sends
   "fetch 4 bytes at 0x8000000b" request. The address in second request
   should be 0x80000008 and I don't see any way how server can affect this.
   It's asked for 4 bytes, it returns 4 bytes and that's all.

2. Likewise, when printing arrays, gdb increments address by size of array
element in bytes, not in words. Again, server returns exactly what's asked
for.

I've temporary "fixed" those problems by sticking "/4" in code but that's no
good. (And note that I had to change two different code parts to handles
case 1 and case 2).

Maybe, there's some way that stub/server can handle this that I don't know? 
Or there's some other configuration variable? And what does TARGET_CHAR_BIT
do?

Thanks,
Volodya
   



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-26  6:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23  8:59 Targets with non-byte-addressable memory Vladimir Prus
2005-09-23 17:12 ` Dave Korn
2005-09-26  6:13   ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).