Some cosmetic fixes to the ImGui debugger

This commit is contained in:
Henrik Rydgård 2024-11-07 20:11:23 +01:00
parent 8081ebc265
commit 80474fd0f0
4 changed files with 21 additions and 19 deletions

View File

@ -244,8 +244,8 @@ void MIPSDebugInterface::toggleBreakpoint(unsigned int address)
int MIPSDebugInterface::getColor(unsigned int address, bool darkMode) const {
int colors[6] = { 0xe0FFFF, 0xFFe0e0, 0xe8e8FF, 0xFFe0FF, 0xe0FFe0, 0xFFFFe0 };
int colorsDark[6] = { ~0xe0FFFF, ~0xFFe0e0, ~0xe8e8FF, ~0xFFe0FF, ~0xe0FFe0, ~0xFFFFe0 };
uint32_t colors[6] = { 0xFFe0FFFF, 0xFFFFe0e0, 0xFFe8e8FF, 0xFFFFe0FF, 0xFFe0FFe0, 0xFFFFFFe0 };
uint32_t colorsDark[6] = { 0xFF301010, 0xFF103030, 0xFF403010, 0xFF103000, 0xFF301030, 0xFF101030 };
int n = g_symbolMap->GetFunctionNum(address);
if (n == -1) {

View File

@ -57,7 +57,7 @@ void DrawRegisterView(MIPSDebugInterface *mipsDebug, bool *open) {
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("FPR")) {
if (ImGui::BeginTabItem("FPU")) {
if (ImGui::BeginTable("fpr", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("regname", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthFixed);
@ -79,7 +79,7 @@ void DrawRegisterView(MIPSDebugInterface *mipsDebug, bool *open) {
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("VPR")) {
if (ImGui::BeginTabItem("VFPU")) {
ImGui::Text("TODO");
ImGui::EndTabItem();
}
@ -93,10 +93,10 @@ static const char *ThreadStatusToString(u32 status) {
case THREADSTATUS_RUNNING: return "Running";
case THREADSTATUS_READY: return "Ready";
case THREADSTATUS_WAIT: return "Wait";
case THREADSTATUS_SUSPEND: return "Suspend";
case THREADSTATUS_SUSPEND: return "Suspended";
case THREADSTATUS_DORMANT: return "Dormant";
case THREADSTATUS_DEAD: return "Dead";
case THREADSTATUS_WAITSUSPEND: return "WaitSuspend";
case THREADSTATUS_WAITSUSPEND: return "WaitSuspended";
default:
break;
}
@ -379,12 +379,11 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState c
while (clipper.Step()) {
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
if (ImGui::Selectable(symCache_[i].name.c_str(), false)) {
disasmView_.setCurAddress(symCache_[i].address);
disasmView_.gotoAddr(symCache_[i].address);
disasmView_.scrollAddressIntoView();
}
}
}
clipper.End();
ImGui::EndListBox();
}

View File

@ -375,7 +375,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
ImColor textColor = 0xFFFFFFFF;
if (isInInterval(address, line.totalSize, debugger->getPC())) {
backgroundColor = scaleColor(backgroundColor, 1.15f);
backgroundColor = scaleColor(backgroundColor, 1.3f);
}
if (address >= selectRangeStart_ && address < selectRangeEnd_ && searching_ == false) {
@ -383,7 +383,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
backgroundColor = ImColor(address == curAddress_ ? 0xFFFF8822 : 0xFFFF9933);
textColor = ImColor(0xFF000000);
} else {
backgroundColor = ImColor(0xFFC0C0C0);
backgroundColor = ImColor(0xFF606060);
}
}
@ -404,10 +404,12 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
drawList->AddText(ImVec2(rect.left + pixelPositions_.addressStart, rect.top + rowY1 + 2), textColor, addressText);
if (isInInterval(address, line.totalSize, debugger->getPC())) {
// Show the current PC with a little square.
drawList->AddRectFilled(
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - rowHeight_, canvas_p0.y + rowY1 + 2),
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - 4, canvas_p0.y + rowY1 + rowHeight_ - 2), 0xFFFFFFFF);
// Show the current PC with a little triangle.
drawList->AddTriangleFilled(
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - rowHeight_ * 0.7f, canvas_p0.y + rowY1 + 2),
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - rowHeight_ * 0.7f, canvas_p0.y + rowY1 + rowHeight_ - 2),
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - 4, canvas_p0.y + rowY1 + rowHeight_ * 0.5f),
0xFFFFFFFF);
}
// display whether the condition of a branch is met
@ -498,7 +500,8 @@ void ImDisasmView::ScrollRelative(int amount) {
ScanVisibleFunctions();
}
void ImDisasmView::followBranch() {
// Follows branches and jumps.
void ImDisasmView::FollowBranch() {
DisassemblyLineInfo line;
manager.getLine(curAddress_, true, line);
@ -507,7 +510,7 @@ void ImDisasmView::followBranch() {
jumpStack_.push_back(curAddress_);
gotoAddr(line.info.branchTarget);
} else if (line.info.hasRelevantAddress) {
// well, not exactly a branch, but we can do something anyway
// well, not exactly a branch, but we can do something anyway
// SendMessage(GetParent(wnd), WM_DEB_GOTOHEXEDIT, line.info.relevantAddress, 0);
// SetFocus(wnd);
}
@ -644,7 +647,7 @@ void ImDisasmView::onKeyDown(ImGuiKey key) {
}
return;
case VK_RIGHT:
followBranch();
FollowBranch();
return;
case VK_TAB:
displaySymbols_ = !displaySymbols_;
@ -797,7 +800,7 @@ void ImDisasmView::PopupMenu() {
debugger->setPC(curAddress_);
}
if (ImGui::MenuItem("Follow branch")) {
followBranch();
FollowBranch();
}
if (ImGui::MenuItem("Run to here")) {
// CBreakPoints::AddBreakPoint(pos, true);

View File

@ -125,7 +125,7 @@ private:
std::string disassembleRange(u32 start, u32 size);
void disassembleToFile();
void search(bool continueSearch);
void followBranch();
void FollowBranch();
void calculatePixelPositions();
bool getDisasmAddressText(u32 address, char* dest, bool abbreviateLabels, bool showData);
void updateStatusBarText();