Slight improvements to debugger, still wonky
This commit is contained in:
@@ -13,16 +13,16 @@ char const* regNames[] = {
|
||||
"gp", "sp", "s8", "ra",
|
||||
};
|
||||
|
||||
void BreakpointFunc(s64 addr, s64 startAddr, Disassembler::DisassemblyResult&) {
|
||||
void BreakpointFunc(s64 addr, Disassembler::DisassemblyResult&) {
|
||||
n64::Core& core = n64::Core::GetInstance();
|
||||
bool isBroken = core.breakpoints.contains(addr + 4);
|
||||
bool isBroken = core.breakpoints.contains(addr);
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, 0xff0000ff);
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, 0);
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, 0);
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, 0x800000ff);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 0.5f);
|
||||
if(ImGui::Checkbox(std::format("##toggleBreakpoint{}", (addr - startAddr) / 4).c_str(), &isBroken)) {
|
||||
core.ToggleBreakpoint(addr + 4);
|
||||
if(ImGui::Checkbox(std::format("##toggleBreakpoint{}", addr).c_str(), &isBroken)) {
|
||||
core.ToggleBreakpoint(addr);
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
@@ -31,7 +31,7 @@ void BreakpointFunc(s64 addr, s64 startAddr, Disassembler::DisassemblyResult&) {
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
void AddressFunc(s64, s64, Disassembler::DisassemblyResult& disasm) {
|
||||
void AddressFunc(s64, Disassembler::DisassemblyResult& disasm) {
|
||||
if(!disasm.success) {
|
||||
ImGui::TextColored(ImColor(0xffeaefb6), "????????????????");
|
||||
return;
|
||||
@@ -40,7 +40,7 @@ void AddressFunc(s64, s64, Disassembler::DisassemblyResult& disasm) {
|
||||
ImGui::TextColored(ImColor(0xffeaefb6), "%s", std::format("{:016X}:", disasm.address).c_str());
|
||||
}
|
||||
|
||||
void InstructionFunc(s64, s64, Disassembler::DisassemblyResult& disasm) {
|
||||
void InstructionFunc(s64, Disassembler::DisassemblyResult& disasm) {
|
||||
if(!disasm.success) {
|
||||
ImGui::TextColored(ImColor(0xffcbf1ae), "Disassembly unsuccessful...");
|
||||
return;
|
||||
@@ -146,6 +146,7 @@ void Debugger::RegisterView() {
|
||||
bool Debugger::render() {
|
||||
n64::Core& core = n64::Core::GetInstance();
|
||||
n64::Registers& regs = core.GetRegs();
|
||||
bool ret = true;
|
||||
|
||||
if(!enabled)
|
||||
return false;
|
||||
@@ -153,8 +154,10 @@ bool Debugger::render() {
|
||||
static s64 startAddr = 0xFFFF'FFFF'8000'0000;
|
||||
int step = 4, stepFast = 256;
|
||||
|
||||
if(!ImGui::Begin("Debugger", &enabled))
|
||||
return false;
|
||||
if(!ImGui::Begin("Debugger", &enabled)) {
|
||||
ret = false;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled(followPC);
|
||||
ImGui::InputScalar("Address", ImGuiDataType_S64, (void*)&startAddr, (void*)&step, (void*)&stepFast, "%016lX", ImGuiInputTextFlags_CharsHexadecimal);
|
||||
@@ -176,8 +179,13 @@ bool Debugger::render() {
|
||||
core.ToggleBreakpoint(startAddr);
|
||||
}
|
||||
|
||||
if(!ImGui::BeginTable("Disassembly", columns.size(), ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody))
|
||||
return false;
|
||||
auto disasmTableFlags = ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter |
|
||||
ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
||||
|
||||
if(!ImGui::BeginTable("Disassembly", columns.size(), disasmTableFlags)) {
|
||||
ret = false;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
for(int i = 0; i < columns.size(); i++)
|
||||
ImGui::TableSetupColumn(columns[i].name);
|
||||
@@ -206,7 +214,7 @@ bool Debugger::render() {
|
||||
ImGui::TableNextRow();
|
||||
for(int i = 0; i < columns.size(); i++) {
|
||||
ImGui::TableSetColumnIndex(i);
|
||||
columns[i].func(addr, startAddr, disasm);
|
||||
columns[i].func(addr, disasm);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
@@ -217,7 +225,7 @@ bool Debugger::render() {
|
||||
|
||||
RegisterView();
|
||||
|
||||
EXIT:
|
||||
ImGui::End();
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user