mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 11:45:18 +02:00
ImDebugger: fix stale symbol list after a game is reloaded
The disasm window cached the flattened symbol list and only rebuilt it when one of three menu items said so. Nothing marked it dirty when a game booted or exited, and a new SymbolMap is allocated per boot, so the list kept showing the previous game's functions. Give SymbolMap a version counter that every mutator bumps, and let the window compare against it instead. The counter is process-wide rather than per-map, so a fresh map can't hand out a version a cached copy already holds. Also re-find the selected symbol by address after a rebuild (the index means something else afterwards), and drop the unused symbol cache members in ImMemWindow. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SfY7iFJEjmRXf1XGrTs4MF
This commit is contained in:
co-authored by
Claude Opus 5
parent
adccd302e5
commit
daa18fc25a
@@ -1323,18 +1323,30 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, ImConfig &cfg, ImContro
|
||||
avail.y -= ImGui::GetTextLineHeightWithSpacing();
|
||||
|
||||
if (ImGui::BeginChild("left", ImVec2(150.0f, avail.y), ImGuiChildFlags_ResizeX)) {
|
||||
if (symCache_.empty() || symsDirty_) {
|
||||
if (symCacheVersion_ != g_symbolMap->Version()) {
|
||||
// The index into symCache_ means something different after a rebuild, and nothing at
|
||||
// all if the map was replaced (which is what happens when a game exits), so re-find
|
||||
// the selection by address instead of carrying the index over.
|
||||
const u32 selectedAddr = (selectedSymbol_ >= 0 && selectedSymbol_ < (int)symCache_.size()) ? symCache_[selectedSymbol_].address : (u32)INVALID_ADDR;
|
||||
symCache_ = g_symbolMap->GetAllActiveSymbols(SymbolType::ST_FUNCTION);
|
||||
symsDirty_ = false;
|
||||
symCacheVersion_ = g_symbolMap->Version();
|
||||
symMatchesDirty_ = true;
|
||||
selectedSymbol_ = -1;
|
||||
if (selectedAddr != INVALID_ADDR) {
|
||||
for (int i = 0; i < (int)symCache_.size(); i++) {
|
||||
if (symCache_[i].address == selectedAddr) {
|
||||
selectedSymbol_ = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedSymbol_ >= 0 && selectedSymbol_ < symCache_.size()) {
|
||||
if (selectedSymbol_ >= 0 && selectedSymbol_ < (int)symCache_.size()) {
|
||||
auto &sym = symCache_[selectedSymbol_];
|
||||
if (ImGui::TreeNode("Edit Symbol", "Edit %s", sym.name.c_str())) {
|
||||
if (ImGui::InputText("Name", selectedSymbolName_, sizeof(selectedSymbolName_), ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
g_symbolMap->SetLabelName(selectedSymbolName_, sym.address);
|
||||
symsDirty_ = true;
|
||||
}
|
||||
ImGui::Text("%08x (size: %0d)", sym.address, sym.size);
|
||||
ImGui::TreePop();
|
||||
|
||||
Reference in New Issue
Block a user