25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: debugger.c,v 1.26 2007/06/15 17:02:39 debug Exp $ |
* $Id: debugger.c,v 1.27 2007/06/28 14:58:38 debug Exp $ |
29 |
* |
* |
30 |
* Single-step debugger. |
* Single-step debugger. |
31 |
* |
* |
85 |
|
|
86 |
static volatile int ctrl_c; |
static volatile int ctrl_c; |
87 |
|
|
88 |
static int debugger_n_emuls; |
static struct emul *debugger_emul; |
|
static struct emul **debugger_emuls; |
|
89 |
|
|
90 |
/* Currently focused CPU, machine, and emulation: */ |
/* Currently focused CPU, machine, and emulation: */ |
91 |
int debugger_cur_cpu; |
int debugger_cur_cpu; |
92 |
int debugger_cur_machine; |
int debugger_cur_machine; |
|
int debugger_cur_emul; |
|
93 |
static struct machine *debugger_machine; |
static struct machine *debugger_machine; |
94 |
static struct emul *debugger_emul; |
static struct emul *debugger_emul; |
95 |
|
|
115 |
|
|
116 |
while ((ch = console_readchar(MAIN_CONSOLE)) < 0 && !exit_debugger) { |
while ((ch = console_readchar(MAIN_CONSOLE)) < 0 && !exit_debugger) { |
117 |
/* Check for X11 events: */ |
/* Check for X11 events: */ |
118 |
x11_check_event(debugger_emuls, debugger_n_emuls); |
x11_check_event(debugger_emul); |
119 |
|
|
120 |
/* Give up some CPU time: */ |
/* Give up some CPU time: */ |
121 |
usleep(10000); |
usleep(10000); |
710 |
* |
* |
711 |
* Must be called before any other debugger function is used. |
* Must be called before any other debugger function is used. |
712 |
*/ |
*/ |
713 |
void debugger_init(struct emul **emuls, int n_emuls) |
void debugger_init(struct emul *emul) |
714 |
{ |
{ |
715 |
int i; |
int i; |
716 |
|
|
717 |
debugger_n_emuls = n_emuls; |
debugger_emul = emul; |
|
debugger_emuls = emuls; |
|
|
|
|
|
if (n_emuls < 1) { |
|
|
fprintf(stderr, "\nERROR: No emuls (?)\n"); |
|
|
exit(1); |
|
|
} |
|
718 |
|
|
719 |
debugger_emul = emuls[0]; |
if (emul->n_machines < 1) { |
720 |
if (emuls[0]->n_machines < 1) { |
fprintf(stderr, "\nERROR: No machines, " |
|
fprintf(stderr, "\nERROR: No machines in emuls[0], " |
|
721 |
"cannot handle this situation yet.\n\n"); |
"cannot handle this situation yet.\n\n"); |
722 |
exit(1); |
exit(1); |
723 |
} |
} |
724 |
|
|
725 |
debugger_machine = emuls[0]->machines[0]; |
debugger_machine = emul->machines[0]; |
726 |
|
|
727 |
debugger_cur_cpu = 0; |
debugger_cur_cpu = 0; |
728 |
debugger_cur_machine = 0; |
debugger_cur_machine = 0; |
|
debugger_cur_emul = 0; |
|
729 |
|
|
730 |
for (i=0; i<N_PREVIOUS_CMDS; i++) { |
for (i=0; i<N_PREVIOUS_CMDS; i++) { |
731 |
CHECK_ALLOCATION(last_cmd[i] = malloc(MAX_CMD_BUFLEN)); |
CHECK_ALLOCATION(last_cmd[i] = malloc(MAX_CMD_BUFLEN)); |