Lines 1132-1167
Link Here
|
1132 |
|
1132 |
|
1133 |
void bx_dbg_stepN_command(bx_dbg_icount_t count) |
1133 |
void bx_dbg_stepN_command(bx_dbg_icount_t count) |
1134 |
{ |
1134 |
{ |
1135 |
if (count == 0) { |
1135 |
if (count == 0) { |
1136 |
dbg_printf("Error: stepN: count=0\n"); |
1136 |
dbg_printf("Error: stepN: count=0\n"); |
1137 |
return; |
1137 |
return; |
1138 |
} |
|
|
1139 |
|
1140 |
// use simulation mode while executing instructions. When the prompt |
1141 |
// is printed, we will return to config mode. |
1142 |
SIM->set_display_mode (DISP_MODE_SIM); |
1143 |
|
1144 |
// single CPU |
1145 |
bx_guard.guard_for |= BX_DBG_GUARD_ICOUNT; // looking for icount |
1146 |
bx_guard.guard_for |= BX_DBG_GUARD_CTRL_C; // or Ctrl-C |
1147 |
// for now, step each CPU one BX_DBG_DEFAULT_ICOUNT_QUANTUM at a time |
1148 |
for (unsigned cycle=0; cycle < count; cycle++) { |
1149 |
for (unsigned cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) { |
1150 |
bx_guard.icount = 1; |
1151 |
bx_guard.interrupt_requested = 0; |
1152 |
BX_CPU(cpu)->guard_found.guard_found = 0; |
1153 |
BX_CPU(cpu)->guard_found.icount = 0; |
1154 |
BX_CPU(cpu)->cpu_loop(-1); |
1155 |
} |
1138 |
} |
1156 |
#if BX_SUPPORT_SMP == 0 |
1139 |
|
1157 |
// ticks are handled inside the cpu loop |
1140 |
// use simulation mode while executing instructions. When the prompt |
1158 |
#else |
1141 |
// is printed, we will return to config mode. |
1159 |
BX_TICK1 (); |
1142 |
SIM->set_display_mode(DISP_MODE_SIM); |
1160 |
#endif |
1143 |
|
1161 |
} |
1144 |
// single CPU |
1162 |
|
1145 |
int old_guard = bx_guard.guard_for; |
1163 |
BX_INSTR_DEBUG_PROMPT(); |
1146 |
bx_guard.guard_for |= BX_DBG_GUARD_ICOUNT; // looking for icount |
1164 |
bx_dbg_print_guard_results(); |
1147 |
bx_guard.guard_for |= BX_DBG_GUARD_CTRL_C; // or Ctrl-C |
|
|
1148 |
bx_guard.guard_for &= ~BX_DBG_GUARD_IADDR_ALL; |
1149 |
// for now, step each CPU one instruction at a time |
1150 |
for (unsigned cycle=0; cycle < count; cycle++) { |
1151 |
for (unsigned cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) { |
1152 |
bx_guard.icount = 1; |
1153 |
bx_guard.interrupt_requested = 0; |
1154 |
int old_mode_break = BX_CPU(cpu)->mode_break; |
1155 |
BX_CPU(cpu)->guard_found.guard_found = 0; |
1156 |
BX_CPU(cpu)->guard_found.icount = 0; |
1157 |
BX_CPU(cpu)->cpu_loop(1); |
1158 |
BX_CPU(cpu)->mode_break = old_mode_break; |
1159 |
} |
1160 |
#if BX_SUPPORT_SMP == 0 |
1161 |
// ticks are handled inside the cpu loop |
1162 |
#else |
1163 |
BX_TICK1(); |
1164 |
#endif |
1165 |
} |
1166 |
|
1167 |
BX_INSTR_DEBUG_PROMPT(); |
1168 |
bx_dbg_print_guard_results(); |
1169 |
bx_guard.guard_for = old_guard; |
1165 |
} |
1170 |
} |
1166 |
|
1171 |
|
1167 |
static disassembler bx_disassemble; |
1172 |
static disassembler bx_disassemble; |