CodeView: Set Symbol Size added

This commit is contained in:
Sepalani 2017-05-03 20:43:29 +01:00
parent 252bb4471d
commit 7f552581e7
3 changed files with 36 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <queue> #include <queue>
#include <string> #include <string>
#include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.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 // Second pass analysis, done after the first pass is done for all functions
// so we have more information to work with // so we have more information to work with
static void AnalyzeFunction2(Symbol* func) static void AnalyzeFunction2(Symbol* func)

View File

@ -231,5 +231,6 @@ public:
void LogFunctionCall(u32 addr); void LogFunctionCall(u32 addr);
void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db); void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db);
bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size = 0); bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size = 0);
bool ReanalyzeFunction(u32 start_addr, Symbol& func, int max_size = 0);
} // namespace } // namespace

View File

@ -25,6 +25,7 @@
#include "Common/SymbolDB.h" #include "Common/SymbolDB.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "DolphinWX/Debugger/CodeView.h" #include "DolphinWX/Debugger/CodeView.h"
#include "DolphinWX/Debugger/DebuggerUIUtil.h" #include "DolphinWX/Debugger/DebuggerUIUtil.h"
#include "DolphinWX/Globals.h" #include "DolphinWX/Globals.h"
@ -44,6 +45,7 @@ enum
IDM_JITRESULTS, IDM_JITRESULTS,
IDM_FOLLOWBRANCH, IDM_FOLLOWBRANCH,
IDM_RENAMESYMBOL, IDM_RENAMESYMBOL,
IDM_SETSYMBOLSIZE,
IDM_PATCHALERT, IDM_PATCHALERT,
IDM_COPYFUNCTION, IDM_COPYFUNCTION,
IDM_ADDFUNCTION, IDM_ADDFUNCTION,
@ -340,6 +342,29 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
} }
break; 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<u32>::max())
{
PPCAnalyst::ReanalyzeFunction(symbol->address, *symbol, size);
Refresh();
Host_NotifyMapLoaded();
}
}
}
break;
case IDM_PATCHALERT: case IDM_PATCHALERT:
break; break;
@ -366,6 +391,7 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
menu.AppendSeparator(); menu.AppendSeparator();
#endif #endif
menu.Append(IDM_RENAMESYMBOL, _("Rename &symbol"))->Enable(isSymbol); menu.Append(IDM_RENAMESYMBOL, _("Rename &symbol"))->Enable(isSymbol);
menu.Append(IDM_SETSYMBOLSIZE, _("&Set symbol size"))->Enable(isSymbol);
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(IDM_RUNTOHERE, _("&Run To Here"))->Enable(Core::IsRunning()); menu.Append(IDM_RUNTOHERE, _("&Run To Here"))->Enable(Core::IsRunning());
menu.Append(IDM_ADDFUNCTION, _("&Add function"))->Enable(Core::IsRunning()); menu.Append(IDM_ADDFUNCTION, _("&Add function"))->Enable(Core::IsRunning());