halt_printf, control-c, etc set a halt bit. This now invokes the debugger, asynchronously (ie, after the current instruction finishes execution).

This commit is contained in:
Kelvin Sherlock 2019-02-06 22:53:44 -05:00
parent 68260dcf6a
commit 524d4a27e4
4 changed files with 20 additions and 17 deletions

View File

@ -876,6 +876,12 @@ int debug_shell(int code) {
}
printf("%06x: %0*x\n", g_abort_address, g_abort_bytes * 2, g_abort_value);
}
if (code == RET_BRK) {
/* hit a BRK op */
}
if (code == RET_HALT) {
/* halt_printf */
}
do_list(engine.kpc, &psr, 1);

View File

@ -88,8 +88,7 @@
#define RET_MVN 0x5
#define RET_WAI 0x6
#define RET_STP 0x7
#define RET_ADD_DEC_8 0x8
#define RET_ADD_DEC_16 0x9
#define RET_HALT 0x8
#define RET_C700 0xa
#define RET_C70A 0xb
#define RET_C70D 0xc

View File

@ -880,7 +880,8 @@ word32 get_itimer() {
}
void set_halt_act(int val) {
if(val == 1 && g_ignore_halts && !g_user_halt_bad) {
extern int g_dbg_shell;
if(val == 1 && g_ignore_halts && !g_user_halt_bad && !g_dbg_shell) {
g_code_red++;
} else {
halt_sim |= val;

View File

@ -1514,11 +1514,11 @@ int run_prog() {
ret >>= 28;
}
if(halt_sim == HALT_EVENT) {
if(halt_sim & HALT_EVENT) {
g_engine_halt_event++;
/* if we needed to stop to check for interrupts, */
/* clear halt */
halt_sim = 0;
halt_sim &= ~HALT_EVENT;
}
#if 0
@ -1535,7 +1535,7 @@ int run_prog() {
this_event = g_event_start.next;
while(dcycs >= this_event->dcycs) {
if(halt_sim != 0 && halt_sim != HALT_EVENT) {
if(halt_sim & ~HALT_EVENT) {
break;
}
if(g_stepping) {
@ -1605,9 +1605,7 @@ int run_prog() {
}
#endif
if(halt_sim != 0 && halt_sim != HALT_EVENT) {
break;
}
if (ret == RET_MP) break;
if (ret == RET_BP) break;
engine.flags &= ~(FLAG_IGNORE_BP | FLAG_IGNORE_MP);
@ -1615,6 +1613,12 @@ int run_prog() {
ret = 0;
break;
}
if(halt_sim & 0x07) {
halt_sim &= ~0x07;
ret = RET_HALT;
break;
}
}
#if 0
@ -2256,14 +2260,6 @@ void handle_action(word32 ret) {
case RET_C70D:
do_c70d(ret);
break;
#if 0
case RET_ADD_DEC_8:
do_add_dec_8(ret);
break;
case RET_ADD_DEC_16:
do_add_dec_16(ret);
break;
#endif
case RET_IRQ:
irq_printf("Special fast IRQ response. irq_pending: %x\n",
g_irq_pending);
@ -2277,6 +2273,7 @@ void handle_action(word32 ret) {
case RET_BP:
case RET_MP:
case RET_BRK:
case RET_HALT:
/* handled elsewhere */
break;
default: