Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
emoon committed Mar 30, 2024
1 parent 4380b77 commit b105bd8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
18 changes: 15 additions & 3 deletions src/debugger/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Debugger* Debugger_create() {
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;

io.Fonts->AddFontFromFileTTF("../data/static/SourceCodePro-Regular.ttf", 24.0f);
io.Fonts->AddFontFromFileTTF("../data/static/SourceCodePro-Regular.ttf", 20.0f);

// Setup Dear ImGui style
ImGui::StyleColorsDark();
Expand Down Expand Up @@ -222,8 +222,8 @@ static void draw_debugger_window(Debugger* self) {

// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to
// learn more about Dear ImGui!).
// if (show_demo_window)
// ImGui::ShowDemoWindow(&show_demo_window);
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);

// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
{
Expand Down Expand Up @@ -347,6 +347,11 @@ static void update(void* self) {
if (e.key.keysym.sym == SDLK_ESCAPE) {
exit(0);
}

if (e.key.keysym.sym == SDLK_F10) {
Debugger_step(s_debugger);
}

break;
}

Expand All @@ -357,6 +362,13 @@ static void update(void* self) {
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Debugger_step(Debugger* debugger) {

}


static void live_update(void* self) { }
static void destroy(void* self) { }

Expand Down
1 change: 1 addition & 0 deletions src/debugger/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ void Debugger_update(Debugger* debugger);
void Debugger_update_event(SDL_Event* event);
void Debugger_destroy(Debugger* debugger);
void Debugger_toggle(Debugger* debugger, DebuggerMode mode);
void Debugger_step(Debugger* debugger);
21 changes: 20 additions & 1 deletion src/debugger/disassembly_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,32 @@ static void draw_disassembly(DisassemblyView* self) {

char buffer[512];

if (ImGui::BeginTable("disassembly", 3, flags)) {
float text_height = ImGui::GetTextLineHeight();

if (ImGui::BeginTable("disassembly", 4, flags)) {
ImGui::TableSetupColumn("Loc");
ImGui::TableSetupColumn("Adress");
ImGui::TableSetupColumn("Instruction");
ImGui::TableSetupColumn("Cycles");
ImGui::TableHeadersRow();

for (size_t j = 0; j < count; j++) {
// Assuming we're rendering the triangle in the first column
ImGui::TableNextColumn();
if (insn[j].address == pc) {
//ImGui::TableSetColumnIndex(0);
ImDrawList* draw_list = ImGui::GetWindowDrawList();
ImVec2 p = ImGui::GetCursorScreenPos();
// Define triangle vertices
ImVec2 tri[3] = {
ImVec2(p.x, p.y),
ImVec2(p.x + text_height / 2, p.y + text_height / 2),
ImVec2(p.x, p.y + text_height)
};

draw_list->AddTriangleFilled(tri[0], tri[1], tri[2], IM_COL32(255, 255, 0, 255));
}

ImGui::TableNextColumn();
ImGui::Text("0x%" PRIx64, insn[j].address);
ImGui::TableNextColumn();
Expand Down

0 comments on commit b105bd8

Please sign in to comment.