Merge pull request #5366 from sepalani/set-sym-size
CodeView: Set Symbol Size/End Address added
This commit is contained in:
commit
5d6074f157
|
@ -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"
|
||||||
|
@ -189,6 +190,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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,8 @@ enum
|
||||||
IDM_JITRESULTS,
|
IDM_JITRESULTS,
|
||||||
IDM_FOLLOWBRANCH,
|
IDM_FOLLOWBRANCH,
|
||||||
IDM_RENAMESYMBOL,
|
IDM_RENAMESYMBOL,
|
||||||
|
IDM_SETSYMBOLSIZE,
|
||||||
|
IDM_SETSYMBOLEND,
|
||||||
IDM_PATCHALERT,
|
IDM_PATCHALERT,
|
||||||
IDM_COPYFUNCTION,
|
IDM_COPYFUNCTION,
|
||||||
IDM_ADDFUNCTION,
|
IDM_ADDFUNCTION,
|
||||||
|
@ -340,6 +343,53 @@ 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_SETSYMBOLEND:
|
||||||
|
{
|
||||||
|
Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
|
||||||
|
if (!symbol)
|
||||||
|
break;
|
||||||
|
|
||||||
|
wxTextEntryDialog dialog(
|
||||||
|
this, wxString::Format(_("Enter symbol (%s) end address:"), symbol->name.c_str()),
|
||||||
|
wxGetTextFromUserPromptStr, wxString::Format(wxT("%#08x"), symbol->address + symbol->size));
|
||||||
|
|
||||||
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
|
{
|
||||||
|
unsigned long address;
|
||||||
|
if (dialog.GetValue().ToULong(&address, 0) && address <= std::numeric_limits<u32>::max() &&
|
||||||
|
address >= symbol->address)
|
||||||
|
{
|
||||||
|
PPCAnalyst::ReanalyzeFunction(symbol->address, *symbol, address - symbol->address);
|
||||||
|
Refresh();
|
||||||
|
Host_NotifyMapLoaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_PATCHALERT:
|
case IDM_PATCHALERT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -355,22 +405,24 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
|
||||||
// popup menu
|
// popup menu
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
// menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
|
// menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
|
||||||
menu.Append(IDM_FOLLOWBRANCH, _("&Follow branch"))
|
menu.Append(IDM_FOLLOWBRANCH, _("Follow &branch"))
|
||||||
->Enable(AddrToBranch(m_selection) ? true : false);
|
->Enable(AddrToBranch(m_selection) ? true : false);
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
menu.Append(IDM_COPYADDRESS, _("Copy &address"));
|
menu.Append(IDM_COPYADDRESS, _("&Copy address"));
|
||||||
menu.Append(IDM_COPYFUNCTION, _("Copy &function"))->Enable(isSymbol);
|
menu.Append(IDM_COPYFUNCTION, _("Copy &function"))->Enable(isSymbol);
|
||||||
menu.Append(IDM_COPYCODE, _("Copy &code line"));
|
menu.Append(IDM_COPYCODE, _("Copy code &line"));
|
||||||
menu.Append(IDM_COPYHEX, _("Copy &hex"));
|
menu.Append(IDM_COPYHEX, _("Copy &hex"));
|
||||||
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.Append(IDM_SETSYMBOLEND, _("Set symbol &end address"))->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());
|
||||||
menu.Append(IDM_JITRESULTS, _("PPC vs x86"))->Enable(Core::IsRunning());
|
menu.Append(IDM_JITRESULTS, _("PPC vs x86"))->Enable(Core::IsRunning());
|
||||||
menu.Append(IDM_INSERTBLR, _("Insert &blr"))->Enable(Core::IsRunning());
|
menu.Append(IDM_INSERTBLR, _("&Insert blr"))->Enable(Core::IsRunning());
|
||||||
menu.Append(IDM_INSERTNOP, _("Insert &nop"))->Enable(Core::IsRunning());
|
menu.Append(IDM_INSERTNOP, _("Insert &nop"))->Enable(Core::IsRunning());
|
||||||
// menu.Append(IDM_PATCHALERT, _("Patch alert"))->Enable(Core::IsRunning());
|
// menu.Append(IDM_PATCHALERT, _("Patch alert"))->Enable(Core::IsRunning());
|
||||||
PopupMenu(&menu);
|
PopupMenu(&menu);
|
||||||
|
|
Loading…
Reference in New Issue