This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

using gdb with target h8300 sim (was Re: possible success with h8300 cross egcs)


Jyrki O Saarinen wrote:
> 
> Hi,
> 
> could you briefly explain the process how the cross-generated code is
> debugged in gdb? Where it is run?

I'm using gdb-4.17 compiled with h8300 support and using
egcs-1.1b h8300 cross compiler to generate h8300-coff format output
with the "-g" debug option.

(if you need my binaries, you can download the tar from
http://www.zanshinsys.com/linux-h8300)

To debug the code with gdb, load the h8300-coff file into gdb
and use the gdb "target" command to set target to "sim".

You should then be able to use gdb's h8 simulator to debug normally.

There are other gdb target options for the h8:
	target hms for remote debugging a target containing
	the hitachi monitor.

	target e7000 for debugging with the hitachi in circuit
	emulator.

I haven't tried remote debugging yet, but I hope to get it
working eventually.  In the mean time, here's a sample gdb session
with the h8 simulator using target sim:

[randall@rsl task]$ h8300-hitachi-hms-gdb
GNU gdb 4.17
Copyright 1998 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=i586-pc-linux-gnu
--target=h8300-hitachi-hms".
(gdb) file dc2.out
Reading symbols from dc2.out...done.
(gdb) target sim
Connected to the simulator.
(gdb) load dc2.out
Loading section .vectors, size 0x36 lma 0x0
Loading section .hditext, size 0x212a lma 0x5d00
Loading section .text, size 0x16ee lma 0x100
Loading section .data, size 0xc lma 0xfd80
Start address 0xfe6
Transfer rate: 115408 bits in <1 sec.
(gdb) list main
60              TIMER_HANDLE    th_doadc;
61              TIMER_HANDLE    th_domonitor;
62
63      ////    BREAK_ALWAYS;
64
65              if (!init())
66                      exit(-1);
67
68      #if TARGET == TARGET_HiVIEW
69              /* Modify the following two lines to enable buffered I/O
*/
(gdb) break 65
Breakpoint 1 at 0xfee: file main.c, line 65.
(gdb) run
Starting program: /home/randall/job/elgar/power10/dc2/src/dc2.out 

Breakpoint 1, main (argc=0, argv=0x0) at main.c:65
65              if (!init())
(gdb) disass main
Dump of assembler code for function main:
0xfe6 <main>:   6d f6             mov.w r6,@-e7
0xfe8 <main+2>: 0d 76             mov.w r7,r6
0xfea <main+4>: 6d f4             mov.w r4,@-e7
0xfec <main+6>: 6d f5             mov.w r5,@-e7
0xfee <main+8>: 5e 00 0e 80       jsr   @0xe80:0
0xff2 <main+12>:        0d 00             mov.w r0,r0
0xff4 <main+14>:        46 08             bne   .+8 (ffe)
0xff6 <main+16>:        79 00 ff ff       mov.w #0xffff,r0
0xffa <main+20>:        5e 00 0e c0       jsr   @0xec0:0
0xffe <main+24>:        79 00 00 32       mov.w #0x32,r0
0x1002 <main+28>:       5e 00 11 cc       jsr   @0x11cc:0
0x1006 <main+32>:       0d 05             mov.w r0,r5
0x1008 <main+34>:       79 00 00 c8       mov.w #0xc8,r0