About using GDB with target ARM simulator

Kai Ruottu karuottu@freenet.hut.fi
Sat Apr 1 00:00:00 GMT 2000


"Lim, Sung-taek" wrote:
> 
> I've built crossgcc for target arm-linux and gdb for target arm-elf. (couldn't match
> the two targets for some reasons but i thought it wouldn't matter. I couldn't find
> any difference between them. Is there any difference?)

 The arm-elf is for embedded ARM with perhaps no opsys. Although the use for arm-linux
may be 'embedded', it really is a 'system' target...

> I tried a simple example for debugging with gdb target as simulator and gdb ignores
> the breakpoints as follows.

 It is quite unclear (for me too) what is the board/monitor-environment the arm-simulator,
which is included with GDB, really simulates. But surely it isn't Linux/ARM.

> $ arm-linux-gcc -g foo.c -o foo
> $ arm-elf-gdb
> GNU gdb 4.18

 I could guess the current GDB snapshots having some fixes for ARM, but 4.18 can be ok...

> (gdb) target sim
> Connected to the simulator.
> (gdb) load foo
> Loading section .interp, size 0x27 vma 0x20000f4
> Loading section .note.ABI-tag, size 0x20 vma 0x2000120
> Loading section .hash, size 0x24 vma 0x2000140
> Loading section .dynsym, size 0x40 vma 0x2000164
> Loading section .dynstr, size 0x3c vma 0x20001a4
> Loading section .gnu.version, size 0x8 vma 0x20001e0
> Loading section .gnu.version_r, size 0x20 vma 0x20001e8
> Loading section .rel.plt, size 0x10 vma 0x2000208
> Loading section .init, size 0x18 vma 0x2000218
> Loading section .plt, size 0x30 vma 0x2000230
> Loading section .text, size 0x350 vma 0x2000260
> Loading section .fini, size 0x14 vma 0x20005b0
> Loading section .rodata, size 0x4 vma 0x20005c4
> Loading section .data, size 0xc vma 0x20085c8
> Loading section .ctors, size 0x8 vma 0x20085d4
> Loading section .dtors, size 0x8 vma 0x20085dc
> Loading section .got, size 0x14 vma 0x20085e4
> Loading section .dynamic, size 0x88 vma 0x20085f8
> Start address 0x2000260
> Transfer rate: 11320 bits in <1 sec.

 This really seems to be a dynamically linked Linux-executable, a pure statically linked
'arm-elf' executable doesn't have this many sections:

(gdb) target sim
Connected to the simulator.

(gdb) load
Loading section .text, size 0x82d0 vma 0x8000
Loading section .rodata, size 0x6e4 vma 0x102d0
Loading section .data, size 0x378 vma 0x10ab4
Loading section .ctors, size 0x8 vma 0x10e2c
Loading section .dtors, size 0x8 vma 0x10e34
Start address 0x800c
Transfer rate: 289248 bits in <1 sec.

> (gdb) run
> Starting program: /home/totohero/test/foo
> 
> Program exited with code 074.
> (gdb) quit

 Building a "--host=i686-pc-linux-gnu --target=arm-linux-gnu" from the current GDB
snapshots could succeed. Expecting the target being supported in gdb-4.18.1 (almost
one year old) may be vain.

 As discussed in the 'embedded-powerpc-linux' thread, the 'right' way could be to build
a remote-GDB to run on the host machine (i686-pc-linux-gnu) and a GDB-server to run
on the target machine (arm-linux-gnu).

 Of course extending the simulator in GDB to simulate Linux/ARM (for running static
binaries) could be nice (I repeat this wish for PowerPC/Linux and 'psim' -- there is
already some support).

Cheers, Kai



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list