25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: debugger.c,v 1.10 2006/06/16 18:31:26 debug Exp $ |
* $Id: debugger.c,v 1.14 2006/07/01 21:15:46 debug Exp $ |
29 |
* |
* |
30 |
* Single-step debugger. |
* Single-step debugger. |
31 |
* |
* |
86 |
* TODO: Some of these should be moved to some other place! |
* TODO: Some of these should be moved to some other place! |
87 |
*/ |
*/ |
88 |
|
|
89 |
volatile int single_step = 0; |
volatile int single_step = NOT_SINGLE_STEPPING; |
90 |
volatile int exit_debugger; |
volatile int exit_debugger; |
91 |
int force_debugger_at_exit = 0; |
int force_debugger_at_exit = 0; |
|
int show_opcode_statistics = 0; |
|
92 |
|
|
93 |
volatile int single_step_breakpoint = 0; |
volatile int single_step_breakpoint = 0; |
94 |
int debugger_n_steps_left_before_interaction = 0; |
int debugger_n_steps_left_before_interaction = 0; |
167 |
{ |
{ |
168 |
ctrl_c = 1; |
ctrl_c = 1; |
169 |
|
|
170 |
if (single_step) { |
if (single_step != NOT_SINGLE_STEPPING) { |
171 |
/* Already in the debugger. Do nothing. */ |
/* Already in the debugger. Do nothing. */ |
172 |
int i; |
int i; |
173 |
for (i=0; i<MAX_CMD_BUFLEN; i++) |
for (i=0; i<MAX_CMD_BUFLEN; i++) |
178 |
fflush(stdout); |
fflush(stdout); |
179 |
} else { |
} else { |
180 |
/* Enter the single step debugger. */ |
/* Enter the single step debugger. */ |
181 |
single_step = 1; |
single_step = ENTER_SINGLE_STEPPING; |
182 |
|
|
183 |
/* Discard any chars in the input queue: */ |
/* Discard any chars in the input queue: */ |
184 |
while (console_charavail(MAIN_CONSOLE)) |
while (console_charavail(MAIN_CONSOLE)) |
791 |
*/ |
*/ |
792 |
/* TODO: In all machines */ |
/* TODO: In all machines */ |
793 |
for (i=0; i<debugger_machine->ncpus; i++) |
for (i=0; i<debugger_machine->ncpus; i++) |
794 |
if (debugger_machine->cpus[i]->translation_cache != NULL) |
if (debugger_machine->cpus[i]->translation_cache != NULL) { |
795 |
cpu_create_or_reset_tc(debugger_machine->cpus[i]); |
cpu_create_or_reset_tc(debugger_machine->cpus[i]); |
796 |
|
debugger_machine->cpus[i]-> |
797 |
|
invalidate_translation_caches( |
798 |
|
debugger_machine->cpus[i], 0, INVALIDATE_ALL); |
799 |
|
} |
800 |
|
|
801 |
/* |
/* |
802 |
* Ugly GDB hack: After single stepping, we need to send back |
* Ugly GDB hack: After single stepping, we need to send back |
859 |
} |
} |
860 |
|
|
861 |
gettimeofday(&debugger_machine->starttime, NULL); |
gettimeofday(&debugger_machine->starttime, NULL); |
862 |
debugger_machine->ncycles_since_gettimeofday = 0; |
debugger_machine->ninstrs_since_gettimeofday = 0; |
863 |
|
|
864 |
single_step = 0; |
single_step = NOT_SINGLE_STEPPING; |
865 |
debugger_machine->instruction_trace = old_instruction_trace; |
debugger_machine->instruction_trace = old_instruction_trace; |
866 |
debugger_machine->show_trace_tree = old_show_trace_tree; |
debugger_machine->show_trace_tree = old_show_trace_tree; |
867 |
quiet_mode = old_quiet_mode; |
quiet_mode = old_quiet_mode; |