h8300 simulator crahes in gdb

Nitin Gupta, Noida niting@noida.hcltech.com
Wed Aug 14 02:26:00 GMT 2002


Hi,
	When debugging (h8300-elf-gdb) with sim as target,
	the simulator does SIGTRAP while executing function
	_exit(). However no problem occurs when the program is
	run on the simulator (h8300-elf-run) outside gdb.
	i.e.
	$ h8300-elf-run a.out

	Hello World

	I'm using h8300-elf build of following
	gcc 3.1.1
	binutils 2.12.
	newlib 1.10
	gdb 5.2

	and the hello world test program
	$ cat test.c
	main()
	{
		printf("Hello World\n");
	}
	$ h8300-elf-gcc -mh -g test.c

	I reached the point by setting breakpoint
	at main and single stepping thereafter. The
	crash occurs while executing line no 14 of 
	newlib/libc/sys/h8300hms/_exit.c  which is
	
	asm("mov.w %0,r0\n\tsleep" : : "r" (rc2) : "r0");
	The program receives SIGTRAP at this line. It
	hangs (or sleeps) if I do next after this.

	Also I'm using h8300-elf build, I'm not sure why
	a file in directory h8300hms is getting linked.
	Is that a problem?
	This problem is occurs with all any test cases
	compiled with h8300-elf-gcc for any h8300 target.

Thanks and Regards,
Nitin.
PS: more info:
	debug_line disassembly of 
	newlib-objs/h8300-elf/h8300h/newlib/libc/sys/h8300hms/_exit.o
	 Line Number Statements:
		  Extended opcode 2: set Address to 0x0
		  Special opcode 21: advance Address by 0 to 0x0 and Line by
11 to 12
		  Extended opcode 2: set Address to 0x8
		  Special opcode 11: advance Address by 0 to 0x8 and Line by
1 to 13
		  Extended opcode 2: set Address to 0xc
		  Special opcode 11: advance Address by 0 to 0xc and Line by
1 to 14
		  Extended opcode 2: set Address to 0x10
		  Special opcode 11: advance Address by 0 to 0x10 and Line
by 1 to 15
		  Extended opcode 2: set Address to 0x16
		  Special opcode 15: advance Address by 0 to 0x16 and Line
by 5 to 20
		  Extended opcode 2: set Address to 0x1e
		  Special opcode 11: advance Address by 0 to 0x1e and Line
by 1 to 21
		  Extended opcode 2: set Address to 0x22
		  Special opcode 11: advance Address by 0 to 0x22 and Line
by 1 to 22
		  Extended opcode 2: set Address to 0x26
		  Special opcode 11: advance Address by 0 to 0x26 and Line
by 1 to 23
		  Extended opcode 2: set Address to 0x2c
		  Extended opcode 1: End of Sequence
		disassembly dump :
		00000000 <__exit>:
		   0:   01 00 6d f6     01 00 6d f6       mov.l er6,@-er7
		   4:   0f f6           0f f6             mov.l er7,er6
		   6:   0d 02           0d 02             mov.w r0,r2

		00000008 <.LM2>:
		   8:   0c a2           0c a2             mov.b r2l,r2h
		   a:   18 aa           18 aa             sub.b r2l,r2l

		0000000c <.LM3>:
		   c:   0d 20           0d 20             mov.w r2,r0
		   e:   01 80           01 80             sleep

		00000010 <.LM4>:
		  10:   01 00 6d 76     01 00 6d 76       mov.l @er7+,er6
		  14:   54 70           54 70             rts

		00000016 <___exit>:
		  16:   01 00 6d f6     01 00 6d f6       mov.l er6,@-er7
		  1a:   0f f6           0f f6             mov.l er7,er6
		  1c:   0d 02           0d 02             mov.w r0,r2

		0000001e <.LM6>:
		  1e:   0c a2           0c a2             mov.b r2l,r2h
		  20:   18 aa           18 aa             sub.b r2l,r2l

		00000022 <.LM7>:
		  22:   0d 20           0d 20             mov.w r2,r0
		  24:   01 80           01 80             sleep

		00000026 <.LM8>:
		  26:   01 00 6d 76     01 00 6d 76       mov.l @er7+,er6
		  2a:   54 70           54 70             rts





More information about the Gdb mailing list