"regdump" command, "stats" also on !ESP32
This commit is contained in:
parent
af8aa61876
commit
db9d7b3f9f
1 changed files with 39 additions and 3 deletions
40
debugger.cpp
40
debugger.cpp
|
@ -157,6 +157,30 @@ void mmu_dump(console *const cnsl, bus *const b)
|
||||||
dump_par_pdr(cnsl, b, ADDR_PDR_U_START + 020, ADDR_PAR_U_START + 020, "user d-space", 1 + (!!(mmr3 & 1)));
|
dump_par_pdr(cnsl, b, ADDR_PDR_U_START + 020, ADDR_PAR_U_START + 020, "user d-space", 1 + (!!(mmr3 & 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reg_dump(console *const cnsl, cpu *const c)
|
||||||
|
{
|
||||||
|
constexpr const char *const run_mode_name[] = { "kernel", "superv", " -", " user" };
|
||||||
|
|
||||||
|
for(uint8_t set=0; set<4; set++) {
|
||||||
|
cnsl->put_string_lf(format("%s, R0: %06o, R1: %06o, R2: %06o, R3: %06o, R4: %06o, R5: %06o",
|
||||||
|
run_mode_name[set],
|
||||||
|
c->lowlevel_register_get(set, 0),
|
||||||
|
c->lowlevel_register_get(set, 1),
|
||||||
|
c->lowlevel_register_get(set, 2),
|
||||||
|
c->lowlevel_register_get(set, 3),
|
||||||
|
c->lowlevel_register_get(set, 4),
|
||||||
|
c->lowlevel_register_get(set, 5)));
|
||||||
|
}
|
||||||
|
|
||||||
|
cnsl->put_string_lf(format("PSW: %06o, PC: %06o", c->getPSW(), c->lowlevel_register_get(0, 7)));
|
||||||
|
|
||||||
|
cnsl->put_string_lf(format("STACK: k:%06o, sv:%06o, -:%06o, usr: %06o",
|
||||||
|
c->lowlevel_register_sp_get(0),
|
||||||
|
c->lowlevel_register_sp_get(1),
|
||||||
|
c->lowlevel_register_sp_get(2),
|
||||||
|
c->lowlevel_register_sp_get(3)));
|
||||||
|
}
|
||||||
|
|
||||||
void show_run_statistics(console *const cnsl, cpu *const c)
|
void show_run_statistics(console *const cnsl, cpu *const c)
|
||||||
{
|
{
|
||||||
auto stats = c->get_mips_rel_speed();
|
auto stats = c->get_mips_rel_speed();
|
||||||
|
@ -306,6 +330,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (parts[0] == "regdump") {
|
||||||
|
reg_dump(cnsl, c);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (parts[0] == "strace") {
|
else if (parts[0] == "strace") {
|
||||||
if (parts.size() != 2) {
|
if (parts.size() != 2) {
|
||||||
trace_start_addr = -1;
|
trace_start_addr = -1;
|
||||||
|
@ -411,12 +440,12 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if (cmd == "stats") {
|
else if (cmd == "stats") {
|
||||||
show_run_statistics(cnsl, c);
|
show_run_statistics(cnsl, c);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (cmd == "cls") {
|
else if (cmd == "cls") {
|
||||||
const char cls[] = { 27, '[', '2', 'J', 12, 0 };
|
const char cls[] = { 27, '[', '2', 'J', 12, 0 };
|
||||||
|
|
||||||
|
@ -450,6 +479,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
cnsl->put_string_lf("trace/t - toggle tracing");
|
cnsl->put_string_lf("trace/t - toggle tracing");
|
||||||
cnsl->put_string_lf("turbo - toggle turbo mode (cannot be interrupted)");
|
cnsl->put_string_lf("turbo - toggle turbo mode (cannot be interrupted)");
|
||||||
cnsl->put_string_lf("strace - start tracing from address - invoke without address to disable");
|
cnsl->put_string_lf("strace - start tracing from address - invoke without address to disable");
|
||||||
|
cnsl->put_string_lf("regdump - dump register contents");
|
||||||
cnsl->put_string_lf("mmudump - dump MMU settings (PARs/PDRs)");
|
cnsl->put_string_lf("mmudump - dump MMU settings (PARs/PDRs)");
|
||||||
cnsl->put_string_lf("setpc - set PC to value");
|
cnsl->put_string_lf("setpc - set PC to value");
|
||||||
cnsl->put_string_lf("setmem - set memory (a=) to value (v=), both in octal, one byte");
|
cnsl->put_string_lf("setmem - set memory (a=) to value (v=), both in octal, one byte");
|
||||||
|
@ -478,6 +508,8 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
|
|
||||||
*cnsl->get_running_flag() = true;
|
*cnsl->get_running_flag() = true;
|
||||||
|
|
||||||
|
bool reset_cpu = true;
|
||||||
|
|
||||||
if (turbo) {
|
if (turbo) {
|
||||||
while(*stop_event == EVENT_NONE) {
|
while(*stop_event == EVENT_NONE) {
|
||||||
c->step_a();
|
c->step_a();
|
||||||
|
@ -499,18 +531,22 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
||||||
|
|
||||||
if (c->check_breakpoint() && !single_step) {
|
if (c->check_breakpoint() && !single_step) {
|
||||||
cnsl->put_string_lf("Breakpoint");
|
cnsl->put_string_lf("Breakpoint");
|
||||||
|
reset_cpu = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->step_b();
|
c->step_b();
|
||||||
|
|
||||||
if (single_step && --n_single_step == 0)
|
if (single_step && --n_single_step == 0) {
|
||||||
|
reset_cpu = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*cnsl->get_running_flag() = false;
|
*cnsl->get_running_flag() = false;
|
||||||
|
|
||||||
|
if (reset_cpu)
|
||||||
c->reset();
|
c->reset();
|
||||||
}
|
}
|
||||||
catch(const std::exception & e) {
|
catch(const std::exception & e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue