From 7f552581e7dca3ef68427940bd9552ec7a1e572d Mon Sep 17 00:00:00 2001 From: Sepalani Date: Wed, 3 May 2017 20:43:29 +0100 Subject: [PATCH] CodeView: Set Symbol Size added --- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 9 +++++++ Source/Core/Core/PowerPC/PPCAnalyst.h | 1 + Source/Core/DolphinWX/Debugger/CodeView.cpp | 26 +++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index b02dbd22f4..ad2584d6e6 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -6,6 +6,7 @@ #include #include +#include "Common/Assert.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" @@ -188,6 +189,14 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size) } } +bool ReanalyzeFunction(u32 start_addr, Symbol& func, int max_size) +{ + _assert_msg_(OSHLE, func.analyzed, "The function wasn't previously analyzed!"); + + func.analyzed = false; + return AnalyzeFunction(start_addr, func, max_size); +} + // Second pass analysis, done after the first pass is done for all functions // so we have more information to work with static void AnalyzeFunction2(Symbol* func) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h index eeefbcaf38..564e73b9c4 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/PowerPC/PPCAnalyst.h @@ -231,5 +231,6 @@ public: void LogFunctionCall(u32 addr); void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db); bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size = 0); +bool ReanalyzeFunction(u32 start_addr, Symbol& func, int max_size = 0); } // namespace diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp index fe3c583403..28ec7af083 100644 --- a/Source/Core/DolphinWX/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp @@ -25,6 +25,7 @@ #include "Common/SymbolDB.h" #include "Core/Core.h" #include "Core/Host.h" +#include "Core/PowerPC/PPCAnalyst.h" #include "DolphinWX/Debugger/CodeView.h" #include "DolphinWX/Debugger/DebuggerUIUtil.h" #include "DolphinWX/Globals.h" @@ -44,6 +45,7 @@ enum IDM_JITRESULTS, IDM_FOLLOWBRANCH, IDM_RENAMESYMBOL, + IDM_SETSYMBOLSIZE, IDM_PATCHALERT, IDM_COPYFUNCTION, IDM_ADDFUNCTION, @@ -340,6 +342,29 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) } break; + case IDM_SETSYMBOLSIZE: + { + Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection); + if (!symbol) + break; + + wxTextEntryDialog dialog(this, + wxString::Format(_("Enter symbol (%s) size:"), symbol->name.c_str()), + wxGetTextFromUserPromptStr, wxString::Format(wxT("%i"), symbol->size)); + + if (dialog.ShowModal() == wxID_OK) + { + unsigned long size; + if (dialog.GetValue().ToULong(&size, 0) && size <= std::numeric_limits::max()) + { + PPCAnalyst::ReanalyzeFunction(symbol->address, *symbol, size); + Refresh(); + Host_NotifyMapLoaded(); + } + } + } + break; + case IDM_PATCHALERT: break; @@ -366,6 +391,7 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event) menu.AppendSeparator(); #endif menu.Append(IDM_RENAMESYMBOL, _("Rename &symbol"))->Enable(isSymbol); + menu.Append(IDM_SETSYMBOLSIZE, _("&Set symbol size"))->Enable(isSymbol); menu.AppendSeparator(); menu.Append(IDM_RUNTOHERE, _("&Run To Here"))->Enable(Core::IsRunning()); menu.Append(IDM_ADDFUNCTION, _("&Add function"))->Enable(Core::IsRunning());