--- trunk/src/debugger/debugger.c 2007/10/08 16:22:20 41 +++ trunk/src/debugger/debugger.c 2007/10/08 16:22:32 42 @@ -25,25 +25,12 @@ * SUCH DAMAGE. * * - * $Id: debugger.c,v 1.22 2007/03/26 02:01:36 debug Exp $ + * $Id: debugger.c,v 1.26 2007/06/15 17:02:39 debug Exp $ * * Single-step debugger. * * - * TODO: - * - * This entire module is very much non-reentrant. :-/ - * - * Add more functionality that already exists elsewhere in the emulator. - * - * Call stack display (back-trace)? - * - * Nicer looking output of register dumps, floating point registers, - * etc. Warn about weird/invalid register contents. - * - * Ctrl-C doesn't enter the debugger on some OSes (HP-UX?)... - * - * Many other TODOs. + * This entire module is very much non-reentrant. :-/ TODO: Fix. */ #include @@ -183,13 +170,11 @@ { printf("%3i: 0x", i); if (m->cpus[0]->is_32bit) - printf("%08"PRIx32, (uint32_t) m->breakpoint_addr[i]); + printf("%08"PRIx32, (uint32_t) m->breakpoints.addr[i]); else - printf("%016"PRIx64, (uint64_t) m->breakpoint_addr[i]); - if (m->breakpoint_string[i] != NULL) - printf(" (%s)", m->breakpoint_string[i]); - if (m->breakpoint_flags[i]) - printf(": flags=0x%x", m->breakpoint_flags[i]); + printf("%016"PRIx64, (uint64_t) m->breakpoints.addr[i]); + if (m->breakpoints.string[i] != NULL) + printf(" (%s)", m->breakpoints.string[i]); printf("\n"); } @@ -215,11 +200,7 @@ uint64_t tmp; uint64_t old_pc = m->cpus[0]->pc; /* TODO: multiple cpus? */ - left = malloc(MAX_CMD_BUFLEN); - if (left == NULL) { - fprintf(stderr, "out of memory in debugger_assignment()\n"); - exit(1); - } + CHECK_ALLOCATION(left = malloc(MAX_CMD_BUFLEN)); strlcpy(left, cmd, MAX_CMD_BUFLEN); right = strchr(left, '='); if (right == NULL) { @@ -700,8 +681,10 @@ /* ... and reset starttime, so that nr of instructions per second can be calculated correctly: */ - gettimeofday(&debugger_machine->starttime, NULL); - debugger_machine->ninstrs_since_gettimeofday = 0; + for (i=0; incpus; i++) { + gettimeofday(&debugger_machine->cpus[i]->starttime, NULL); + debugger_machine->cpus[i]->ninstrs_since_gettimeofday = 0; + } single_step = NOT_SINGLE_STEPPING; debugger_machine->instruction_trace = old_instruction_trace; @@ -755,11 +738,7 @@ debugger_cur_emul = 0; for (i=0; i