aboutsummaryrefslogtreecommitdiff
path: root/sim/tic80
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>1998-02-17 19:38:48 +0000
committerMichael Meissner <gnu@the-meissners.org>1998-02-17 19:38:48 +0000
commit9902213101350fc9ad9386879e28aee7895feae8 (patch)
treec273d25dfc4a116629124885e7b73c1605d63ccb /sim/tic80
parent5290378abc09ab96d8a25be05c07bcfc1b23caab (diff)
downloadgdb-9902213101350fc9ad9386879e28aee7895feae8.zip
gdb-9902213101350fc9ad9386879e28aee7895feae8.tar.gz
gdb-9902213101350fc9ad9386879e28aee7895feae8.tar.bz2
Better tracing for conditional branches
Diffstat (limited to 'sim/tic80')
-rw-r--r--sim/tic80/ChangeLog10
-rw-r--r--sim/tic80/cpu.h9
-rw-r--r--sim/tic80/insns6
-rw-r--r--sim/tic80/misc.c79
4 files changed, 92 insertions, 12 deletions
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
index 3c2258a..cd494e5 100644
--- a/sim/tic80/ChangeLog
+++ b/sim/tic80/ChangeLog
@@ -1,3 +1,13 @@
+Tue Feb 17 14:35:05 1998 Michael Meissner <meissner@cygnus.com>
+
+ * misc.c (tic80_trace_cond_br): Take size/code arguments, and
+ decode bcond conditions and bbo/bbz comparison bits.
+
+ * cpu.h (tic80_trace_cond_br): Update prototype.
+ (TRACE_COND_PR): Take size/code additional arguments.
+
+ * insns: (bbo/bbz/bcnd): Update call to TRACE_COND_PR.
+
Tue Feb 17 12:50:27 1998 Andrew Cagney <cagney@b1.cygnus.com>
* sim-calls.c (sim_store_register, sim_fetch_register): Pass in
diff --git a/sim/tic80/cpu.h b/sim/tic80/cpu.h
index d8cfd0e..29da816 100644
--- a/sim/tic80/cpu.h
+++ b/sim/tic80/cpu.h
@@ -175,7 +175,7 @@ extern char *tic80_trace_nop PARAMS ((int));
extern char *tic80_trace_sink1 PARAMS ((int, unsigned32));
extern char *tic80_trace_sink2 PARAMS ((int, unsigned32, unsigned32));
extern char *tic80_trace_sink3 PARAMS ((int, unsigned32, unsigned32, unsigned32));
-extern char *tic80_trace_cond_br PARAMS ((int, int, unsigned32, unsigned32));
+extern char *tic80_trace_cond_br PARAMS ((int, int, unsigned32, unsigned32, int, int));
extern char *tic80_trace_ucond_br PARAMS ((int, unsigned32));
extern void tic80_trace_ldst PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, int, int, int, unsigned32, unsigned32, unsigned32));
@@ -292,12 +292,13 @@ do { \
} \
} while (0)
-#define TRACE_COND_BR(indx, jump_p, cond, target) \
+#define TRACE_COND_BR(indx, jump_p, cond, target, size, code) \
do { \
if (TRACE_BRANCH_P (CPU)) { \
trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \
itable[indx].line_nr, "branch", \
- tic80_trace_cond_br (indx, jump_p, cond, target)); \
+ tic80_trace_cond_br (indx, jump_p, cond, target, \
+ size, code)); \
} \
} while (0)
@@ -337,7 +338,7 @@ do { \
#define TRACE_SINK1(indx, input)
#define TRACE_SINK2(indx, input1, input2)
#define TRACE_SINK3(indx, input1, input2, input3)
-#define TRACE_COND_BR(indx, jump_p, cond, target)
+#define TRACE_COND_BR(indx, jump_p, cond, target, size, code)
#define TRACE_UCOND_BR(indx, target)
#define TRACE_LD(m, s, result, addr1, addr2)
#define TRACE_ST(m, s, value, addr1, addr2)
diff --git a/sim/tic80/insns b/sim/tic80/insns
index 4ffc6c5..fb05919 100644
--- a/sim/tic80/insns
+++ b/sim/tic80/insns
@@ -150,7 +150,7 @@
}
else
jump_p = 0;
- TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target);
+ TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1);
return nia;
:%s::::A:int A
if (A)
@@ -179,7 +179,7 @@
}
else
jump_p = 0;
- TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target);
+ TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1);
return nia;
31.BITNUM,26.Source,21.0b100100,15.A,14.SignedOffset::::bbz i
"bbz%s<A> <SignedOffset>, r<Source>, <bitnum>"
@@ -221,7 +221,7 @@
{
nia = do_branch (_SD, annul, target, 0, NULL);
}
- TRACE_COND_BR(MY_INDEX, condition, source, target);
+ TRACE_COND_BR(MY_INDEX, condition, val, target, size, code);
return nia;
31.Code,26.Source,21.0b100110,15.A,14.SignedOffset::::bcnd i
"bcnd%s<A> <SignedOffset>, r<Source>, <Code>"
diff --git a/sim/tic80/misc.c b/sim/tic80/misc.c
index f9e4d3c..fc7fbec 100644
--- a/sim/tic80/misc.c
+++ b/sim/tic80/misc.c
@@ -477,24 +477,93 @@ char *
tic80_trace_cond_br (int indx,
int jump_p,
unsigned32 cond,
- unsigned32 target)
+ unsigned32 target,
+ int size,
+ int code)
{
+ char *suffix1, *suffix2;
+
if (!tic80_size_name)
tic80_init_trace ();
+ if (size >= 0 && code >= 0)
+ { /* BCND */
+ switch (code)
+ {
+ default: suffix1 = "???"; break;
+ case 0: suffix1 = "nev"; break;
+ case 1: suffix1 = "gt0"; break;
+ case 2: suffix1 = "eq0"; break;
+ case 3: suffix1 = "ge0"; break;
+ case 4: suffix1 = "lt0"; break;
+ case 5: suffix1 = "ne0"; break;
+ case 6: suffix1 = "le0"; break;
+ case 7: suffix1 = "alw"; break;
+ }
+
+ switch (size)
+ {
+ default: suffix2 = ".?"; break;
+ case 0: suffix2 = ".b"; break;
+ case 1: suffix2 = ".h"; break;
+ case 2: suffix2 = ".w"; break;
+ }
+
+ } else { /* BBO/BBZ */
+
+ suffix2 = "";
+ switch (cond)
+ {
+ default: suffix1 = "??.?"; break;
+ case 29: suffix1 = "hs.w"; break;
+ case 28: suffix1 = "lo.w"; break;
+ case 27: suffix1 = "ls.w"; break;
+ case 26: suffix1 = "hi.w"; break;
+ case 25: suffix1 = "ge.w"; break;
+ case 24: suffix1 = "lt.w"; break;
+ case 23: suffix1 = "le.w"; break;
+ case 22: suffix1 = "gt.w"; break;
+ case 21: suffix1 = "ne.w"; break;
+ case 20: suffix1 = "eq.w"; break;
+ case 19: suffix1 = "hs.h"; break;
+ case 18: suffix1 = "lo.h"; break;
+ case 17: suffix1 = "ls.h"; break;
+ case 16: suffix1 = "hi.h"; break;
+ case 15: suffix1 = "ge.h"; break;
+ case 14: suffix1 = "lt.h"; break;
+ case 13: suffix1 = "le.h"; break;
+ case 12: suffix1 = "gt.h"; break;
+ case 11: suffix1 = "ne.h"; break;
+ case 10: suffix1 = "eq.h"; break;
+ case 9: suffix1 = "hs.b"; break;
+ case 8: suffix1 = "lo.b"; break;
+ case 7: suffix1 = "ls.b"; break;
+ case 6: suffix1 = "hi.b"; break;
+ case 5: suffix1 = "ge.b"; break;
+ case 4: suffix1 = "lt.b"; break;
+ case 3: suffix1 = "le.b"; break;
+ case 2: suffix1 = "gt.b"; break;
+ case 1: suffix1 = "ne.b"; break;
+ case 0: suffix1 = "eq.b"; break;
+ }
+ }
+
if (jump_p)
sprintf (tic80_trace_buffer,
- "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => 0x%.*lx",
+ "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => 0x%.*lx %s%s",
tic80_size_name, itable[indx].name,
SIZE_HEX, target, SIZE_DECIMAL, "",
SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond,
- SIZE_HEX, target);
+ SIZE_HEX, target,
+ suffix1, suffix2);
else
sprintf (tic80_trace_buffer,
- "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => [fallthrough]",
+ "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => %-*s %s%s",
tic80_size_name, itable[indx].name,
SIZE_HEX, target, SIZE_DECIMAL, "",
- SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond);
+ SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond,
+ SIZE_HEX + 2, "[no jump]",
+ suffix1, suffix2);
return tic80_trace_buffer;
}