mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-13 03:30:31 +00:00
Update debugger.cpp
This commit is contained in:
parent
1e93414f11
commit
c5a4698266
@ -47,15 +47,7 @@ void dump_regs()
|
|||||||
cout << "MSR: " << hex << ppc_state.ppc_msr << endl;
|
cout << "MSR: " << hex << ppc_state.ppc_msr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_mem_file()
|
void disasm(uint32_t inst_num = 1UL, uint32_t address = ppc_state.ppc_pc)
|
||||||
{
|
|
||||||
std::ofstream memdumpfile;
|
|
||||||
memdumpfile.open("memdump.bin", std::ofstream::out | std::ofstream::binary);
|
|
||||||
memdumpfile.write((char*)&machine_sysram_mem, sizeof(char) * 67108864);
|
|
||||||
memdumpfile.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void disasm()
|
|
||||||
{
|
{
|
||||||
PPCDisasmContext ctx;
|
PPCDisasmContext ctx;
|
||||||
|
|
||||||
@ -69,8 +61,8 @@ void disasm()
|
|||||||
|
|
||||||
void enter_debugger()
|
void enter_debugger()
|
||||||
{
|
{
|
||||||
string inp, cmd, addr_str, expr_str, reg_expr, last_cmd;
|
string inp, cmd, addr_str, expr_str, reg_expr, last_cmd, inst_num_str;
|
||||||
uint32_t addr;
|
uint32_t addr, inst_grab;
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
cout << "Welcome to the PowerPC debugger." << endl;
|
cout << "Welcome to the PowerPC debugger." << endl;
|
||||||
@ -132,7 +124,19 @@ void enter_debugger()
|
|||||||
ppc_exec_until(addr);
|
ppc_exec_until(addr);
|
||||||
}
|
}
|
||||||
else if (cmd == "disas") {
|
else if (cmd == "disas") {
|
||||||
disasm();
|
expr_str = "";
|
||||||
|
ss >> expr_str;
|
||||||
|
if (expr_str.length() > 0) {
|
||||||
|
cout << "Parsing disas params." << endl;
|
||||||
|
inst_num_str = expr_str.substr(expr_str.find(" ") + 1, expr_str.find(","));
|
||||||
|
inst_grab = stoul(inst_num_str, NULL, 0);
|
||||||
|
addr_str = expr_str.substr(expr_str.find(",") + 1, expr_str.length() - 1);
|
||||||
|
addr = stoul(addr_str, NULL, 16);
|
||||||
|
disasm(inst_grab, addr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
disasm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cout << "Unknown command: " << cmd << endl;
|
cout << "Unknown command: " << cmd << endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user