ImDebugger: Add ability to rename function symbols

This commit is contained in:
Henrik Rydgård
2024-11-23 00:17:00 +01:00
parent 6b11ebfb9f
commit e66516eb50
8 changed files with 33 additions and 8 deletions
+3
View File
@@ -1723,6 +1723,9 @@ public:
void UpdateTag(const char *newTag) override {
buf_->UpdateTag(newTag);
}
const char *Tag() const override {
return buf_->Tag();
}
private:
VKRFramebuffer *buf_;
};
+1 -1
View File
@@ -457,7 +457,7 @@ public:
int MultiSampleLevel() const { return multiSampleLevel_; }
virtual void UpdateTag(const char *tag) {}
virtual const char *Tag() { return "(no name)"; }
virtual const char *Tag() const { return "(no name)"; }
protected:
int width_ = -1, height_ = -1, layers_ = 1, multiSampleLevel_ = 0;
+1
View File
@@ -153,6 +153,7 @@ void ConsoleListener::Close() {
if (thread_.joinable()) {
logPendingWritePos_.store((u32)-1, std::memory_order_release);
SetEvent(hTriggerEvent);
// If we seem hung here, it's just that you made a selection in the debug console, blocking output.
thread_.join();
}
if (hTriggerEvent) {
+2
View File
@@ -3703,4 +3703,6 @@ void FramebufferManagerCommon::DrawImGuiDebug(int &selected) const {
ImGui::PopID();
}
ImGui::EndTable();
// Now, draw the actual framebuffer image. This could be refined a lot.
}
+22 -5
View File
@@ -514,6 +514,7 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState c
if (ImGui::SmallButton("Search")) {
// Open a small popup
ImGui::OpenPopup("disSearch");
ImGui::Shortcut(ImGuiKey_F | ImGuiMod_Ctrl);
}
ImGui::SameLine();
@@ -535,19 +536,35 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState c
ImGui::TableSetupColumn("right", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
if (symCache_.empty() || symsDirty_) {
symCache_ = g_symbolMap->GetAllSymbols(SymbolType::ST_FUNCTION);
symsDirty_ = false;
}
if (selectedSymbol_ >= 0 && selectedSymbol_ < 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();
}
}
ImVec2 sz = ImGui::GetContentRegionAvail();
if (ImGui::BeginListBox("##symbols", ImVec2(150.0, sz.y - ImGui::GetTextLineHeightWithSpacing() * 2))) {
if (symCache_.empty() || symsDirty_) {
symCache_ = g_symbolMap->GetAllSymbols(SymbolType::ST_FUNCTION);
symsDirty_ = false;
}
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)) {
if (ImGui::Selectable(symCache_[i].name.c_str(), selectedSymbol_ == i)) {
disasmView_.gotoAddr(symCache_[i].address);
disasmView_.scrollAddressIntoView();
truncate_cpy(selectedSymbolName_, symCache_[i].name.c_str());
selectedSymbol_ = i;
}
}
}
+2
View File
@@ -42,6 +42,8 @@ private:
// Symbol cache
std::vector<SymbolEntry> symCache_;
bool symsDirty_ = true;
int selectedSymbol_ = -1;
char selectedSymbolName_[128];
ImDisasmView disasmView_;
char searchTerm_[64]{};
+1 -1
View File
@@ -565,7 +565,7 @@ void ImDisasmView::ProcessKeyboardShortcuts() {
if (io.KeyMods & ImGuiMod_Ctrl) {
if (ImGui::IsKeyPressed(ImGuiKey_F)) {
// Toggle the find popup
ImGui::OpenPopup("disSearch");
// ImGui::OpenPopup("disSearch");
}
if (ImGui::IsKeyPressed(ImGuiKey_C) || ImGui::IsKeyPressed(ImGuiKey_Insert)) {
CopyInstructions(selectRangeStart_, selectRangeEnd_, CopyInstructionsMode::DISASM);
+1 -1
Submodule ext/lua updated: f3271af11a...7648485f14