Using Simulator from within GDB

Nitin Gupta
2001-04-20T14:39:00Z

I am trying to use a simulator from within gdb 5.0. I am using m32r as
my processor's "skin" and using it I have generated files from CGEN,
giving it the m32r.cpu and m32r.opc files. I have also ported ld, gas,
simulator and also tested that, by writing a sample assembly code for my
processor and ran it on simulator after generating a.out from gas, and
ld.

Now when I am trying to use my ported simulator from within gdb5.0 (also
built for my processor) I am getting a warning that little endian file
does not match big endian target
I think my problem is that I don't know, how to talk to the simulator
from within debugger. The only information I found is at
http://sources.redhat.com/psim/manaul , which is quite obsolete.
This is my gdb session after I invoke gdb with my simulator as an input.

% m32r-elf-gdb m32r-elf-run
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=m32r-elf"...
warning: little endian file does not match big endian target.

(gdb) target sim
Target (LITTLE_ENDIAN) and configured (BIG_ENDIAN) byte order in
conflict
Target (BIG_ENDIAN) and specified (LITTLE_ENDIAN) byte order in conflict

Connected to the simulator.
(gdb) load
Loading section .interp, size 0x13 lma 0x80480f4
Loading section .note.ABI-tag, size 0x20 lma 0x8048108
Loading section .hash, size 0x270 lma 0x8048128
Loading section .dynsym, size 0x570 lma 0x8048398
Loading section .dynstr, size 0x32a lma 0x8048908
Loading section .gnu.version, size 0xae lma 0x8048c32
Loading section .gnu.version_r, size 0x30 lma 0x8048ce0
Loading section .rel.got, size 0x8 lma 0x8048d10
Loading section .rel.bss, size 0x38 lma 0x8048d18
Loading section .rel.plt, size 0x270 lma 0x8048d50
Loading section .init, size 0x2f lma 0x8048fc0
Loading section .plt, size 0x4f0 lma 0x8048ff0
Loading section .text, size 0x54d34 lma 0x80494e0
Loading section .fini, size 0x1a lma 0x809e214
Loading section .rodata, size 0x1b819 lma 0x809e240
Loading section .data, size 0x1654 lma 0x80baa60
Loading section .eh_frame, size 0x4 lma 0x80bc0b4
Loading section .ctors, size 0x8 lma 0x80bc0b8
Loading section .dtors, size 0x8 lma 0x80bc0c0
Loading section .got, size 0x148 lma 0x80bc0c8
Loading section .dynamic, size 0xa8 lma 0x80bc210
Start address 0x80494e0
Transfer rate: 3771720 bits in <1 sec.
(gdb) break main
Cannot access memory at address 0x80495ec

I will appreciate if some one can tell me, How can I debug an a.out
running
on my simulator, while I am using my gdb. Or direct me to some source
code
or manual, where I can get some direction.

Thanks,
Nitin

Nitin Gupta
nitin@mobilygen.com