From d99d35013d38aac7766add7d2304c3917fae204b Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sat, 13 Mar 2021 20:56:19 +0000 Subject: [PATCH] Add support for symbols. Signed-off-by: Andrea Odetti --- source/CMakeLists.txt | 5 +++ source/frontends/sdl/imgui/sdlsettings.cpp | 32 +++++++++++----- source/linux/duplicates/Debug.cpp | 43 +++++++++++++++++++--- 3 files changed, 65 insertions(+), 15 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a0b26d7e..c2ccc400 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -188,5 +188,10 @@ target_compile_options(appleii PUBLIC -Wno-multichar ) +add_custom_command( + TARGET appleii POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/bin/*.SYM ${CMAKE_BINARY_DIR} + ) + install(TARGETS appleii DESTINATION lib) diff --git a/source/frontends/sdl/imgui/sdlsettings.cpp b/source/frontends/sdl/imgui/sdlsettings.cpp index 5667a406..c11a5ba3 100644 --- a/source/frontends/sdl/imgui/sdlsettings.cpp +++ b/source/frontends/sdl/imgui/sdlsettings.cpp @@ -234,11 +234,12 @@ namespace sa2 if (ImGui::BeginChild("CPU")) { const ImGuiTableFlags flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuter; - if (ImGui::BeginTable("CPU", 7, flags)) + if (ImGui::BeginTable("CPU", 8, flags)) { // weigths proportional to column width (including header) ImGui::TableSetupColumn("Disassembly", 0, 30); - ImGui::TableSetupColumn("Target", 0, 6); + ImGui::TableSetupColumn("Symbol", 0, 20); + ImGui::TableSetupColumn("Target", 0, 20); ImGui::TableSetupColumn("Offset", 0, 6); ImGui::TableSetupColumn("Pointer", 0, 7); ImGui::TableSetupColumn("Value", 0, 5); @@ -261,7 +262,6 @@ namespace sa2 IM_ASSERT(row == clipper.DisplayStart && "Clipper position mismatch"); for (; row < clipper.DisplayEnd; ++row) { - ImGui::TableNextRow(); DisasmLine_t line; const char* pSymbol = FindSymbolFromAddress(nAddress); const int bDisasmFormatFlags = GetDisassemblyLine(nAddress, line); @@ -278,19 +278,31 @@ namespace sa2 ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, currentBgColor); } - ImGui::TableSetColumnIndex(0); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); ImGui::Selectable(buffer, false, ImGuiSelectableFlags_SpanAllColumns); - ImGui::TableSetColumnIndex(1); + + ImGui::TableNextColumn(); + if (pSymbol) + { + ImGui::TextUnformatted(pSymbol); + } + ImGui::TableNextColumn(); ImGui::TextUnformatted(line.sTarget); - ImGui::TableSetColumnIndex(2); + + ImGui::TableNextColumn(); ImGui::TextUnformatted(line.sTargetOffset); - ImGui::TableSetColumnIndex(3); + + ImGui::TableNextColumn(); ImGui::TextUnformatted(line.sTargetPointer); - ImGui::TableSetColumnIndex(4); + + ImGui::TableNextColumn(); ImGui::TextUnformatted(line.sTargetValue); - ImGui::TableSetColumnIndex(5); + + ImGui::TableNextColumn(); ImGui::TextUnformatted(line.sImmediate); - ImGui::TableSetColumnIndex(6); + + ImGui::TableNextColumn(); ImGui::TextUnformatted(line.sBranch); } } diff --git a/source/linux/duplicates/Debug.cpp b/source/linux/duplicates/Debug.cpp index 5d437398..d9d4cde9 100644 --- a/source/linux/duplicates/Debug.cpp +++ b/source/linux/duplicates/Debug.cpp @@ -7,11 +7,8 @@ #include "Core.h" #include "Interface.h" -void InitDisasm() -{ - g_nDisasmCurAddress = regs.pc; - DisasmCalcTopBotAddress(); -} +const int MIN_DISPLAY_CONSOLE_LINES = 5; // doesn't include ConsoleInput +int g_iWindowThis = WINDOW_CODE; // TODO: FIXME! should be offset into WindowConfig!!! void WindowUpdateDisasmSize() { @@ -19,9 +16,45 @@ void WindowUpdateDisasmSize() g_nDisasmCurLine = MAX(0, (g_nDisasmWinHeight - 1) / 2); } +void WindowUpdateConsoleDisplayedSize() +{ + g_nConsoleDisplayLines = MIN_DISPLAY_CONSOLE_LINES; +#if USE_APPLE_FONT + g_bConsoleFullWidth = true; + g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; + + if (g_iWindowThis == WINDOW_CONSOLE) + { + g_nConsoleDisplayLines = MAX_DISPLAY_LINES; + g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; + g_bConsoleFullWidth = true; + } +#else + g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 10; + g_bConsoleFullWidth = false; + + // g_bConsoleFullWidth = false; + // g_nConsoleDisplayWidth = CONSOLE_WIDTH - 10; + + if (g_iWindowThis == WINDOW_CONSOLE) + { + g_nConsoleDisplayLines = MAX_DISPLAY_LINES; + g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; + g_bConsoleFullWidth = true; + } +#endif +} + +void InitDisasm() +{ + g_nDisasmCurAddress = regs.pc; + DisasmCalcTopBotAddress(); +} + void DebugInitialize() { WindowUpdateDisasmSize(); + WindowUpdateConsoleDisplayedSize(); extern bool g_bSymbolsDisplayMissingFile; g_bSymbolsDisplayMissingFile = false;