diff --git a/Core/Debugger/SymbolMap.h b/Core/Debugger/SymbolMap.h index b3e1529779..d888539027 100644 --- a/Core/Debugger/SymbolMap.h +++ b/Core/Debugger/SymbolMap.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include "Common/CommonTypes.h" @@ -163,6 +162,7 @@ private: // This is indexed by the end address of the module. std::map activeModuleEnds; + // Module ID, index typedef std::pair SymbolKey; // These are indexed by the module id and relative address in the module. diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 4d88aecc7d..03d42cc467 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -196,13 +196,21 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState c ImGui::TableSetColumnIndex(0); ImVec2 sz = ImGui::GetContentRegionAvail(); if (ImGui::BeginListBox("##symbols", ImVec2(150.0, sz.y - ImGui::GetTextLineHeightWithSpacing() * 2))) { - std::vector syms = g_symbolMap->GetAllSymbols(SymbolType::ST_FUNCTION); - for (auto &sym : syms) { - if (ImGui::Selectable(sym.name.c_str(), false)) { - disasmView_.setCurAddress(sym.address); - disasmView_.scrollAddressIntoView(); + if (symCache_.empty()) { + symCache_ = g_symbolMap->GetAllSymbols(SymbolType::ST_FUNCTION); + } + ImGuiListClipper clipper; + clipper.Begin((int)symCache_.size(), -1); + 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_.scrollAddressIntoView(); + } } } + + clipper.End(); ImGui::EndListBox(); } diff --git a/UI/ImDebugger/ImDebugger.h b/UI/ImDebugger/ImDebugger.h index b0f458a26b..574aad01ae 100644 --- a/UI/ImDebugger/ImDebugger.h +++ b/UI/ImDebugger/ImDebugger.h @@ -37,6 +37,9 @@ private: u32 gotoAddr_ = 0x1000; + // Symbol cache + std::vector symCache_; + ImDisasmView disasmView_; };