This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/798: H8/300 simulator problem
- From: ysato at users dot sourceforge dot jp
- To: gdb-gnats at sources dot redhat dot com
- Date: 18 Oct 2002 04:37:14 -0000
- Subject: gdb/798: H8/300 simulator problem
- Reply-to: ysato at users dot sourceforge dot jp
>Number: 798
>Category: gdb
>Synopsis: H8/300 simulator problem
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 17 21:38:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: ysato@users.sourceforge.jp
>Release: gdb-5.2.1
>Organization:
>Environment:
linux-2.2.21
glibc-2.1.3
>Description:
A result with real CPU is different from a result with sim when I executed the following order.
mov.b rN[hl],@-erN
mov.w rN,@-erN
mov.l erN,@-erN
The value that did decrement is written in in real CPU.
A value before doing decrement is written in in sim.
I was able to revise it with this patch.
diff -Nru gdb-5.2.1/sim/h8300/compile.c gdb-5.2.1.h8sim/sim/h8300/compile.c
--- gdb-5.2.1/sim/h8300/compile.c Fri May 17 22:24:13 2002
+++ gdb-5.2.1.h8sim/sim/h8300/compile.c Fri Oct 18 12:56:11 2002
@@ -1066,12 +1066,21 @@
case O (O_MOV_TO_MEM, SB):
res = GET_B_REG (code->src.reg);
+ if ((code->dst.type == X (OP_DEC, SB)) &&
+ (code->src.reg == code->dst.reg))
+ res -= 1;
goto log8;
case O (O_MOV_TO_MEM, SW):
res = GET_W_REG (code->src.reg);
+ if ((code->dst.type == X (OP_DEC, SW)) &&
+ (code->src.reg == code->dst.reg))
+ res -= 2;
goto log16;
case O (O_MOV_TO_MEM, SL):
res = GET_L_REG (code->src.reg);
+ if ((code->dst.type == X (OP_DEC, SL)) &&
+ (code->src.reg == code->dst.reg))
+ res -= 4;
goto log32;
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: