SymbolDB: Namespace code under the Common namespace

Moves more common code into the Common namespace where it belongs.
This commit is contained in:
Lioncash
2018-05-27 18:01:40 -04:00
parent 72e8058fb8
commit f4ec419929
24 changed files with 122 additions and 104 deletions
@@ -45,7 +45,7 @@ void CBreakPointView::Repopulate()
int item = InsertItem(0, breakpoint_enabled_str);
SetItem(item, 1, StrToWxStr("BP"));
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rBP.address);
Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rBP.address);
if (symbol)
{
wxString symbol_description = StrToWxStr(g_symbolDB.GetDescription(rBP.address));
@@ -67,7 +67,7 @@ void CBreakPointView::Repopulate()
int item = InsertItem(0, memcheck_on_str);
SetItem(item, 1, StrToWxStr("MBP"));
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.start_address);
Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.start_address);
if (symbol)
{
wxString memcheck_start_addr = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.start_address));
+5 -5
View File
@@ -57,7 +57,7 @@ enum
IDM_ADDFUNCTION,
};
CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB* symboldb, wxWindow* parent,
CCodeView::CCodeView(DebugInterface* debuginterface, Common::SymbolDB* symboldb, wxWindow* parent,
wxWindowID Id)
: wxControl(parent, Id), m_debugger(debuginterface), m_symbol_db(symboldb), m_plain(false),
m_curAddress(debuginterface->GetPC()), m_align(debuginterface->GetInstructionSize(0)),
@@ -243,7 +243,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_COPYFUNCTION:
{
Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
Common::Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
if (symbol)
{
std::string text;
@@ -335,7 +335,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_RENAMESYMBOL:
{
Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
Common::Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
if (symbol)
{
wxTextEntryDialog input_symbol(this, _("Rename symbol:"), wxGetTextFromUserPromptStr,
@@ -352,7 +352,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_SETSYMBOLSIZE:
{
Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
Common::Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
if (!symbol)
break;
@@ -375,7 +375,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_SETSYMBOLEND:
{
Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
Common::Symbol* symbol = m_symbol_db->GetSymbolFromAddr(m_selection);
if (!symbol)
break;
+7 -3
View File
@@ -18,13 +18,17 @@
wxDECLARE_EVENT(wxEVT_CODEVIEW_CHANGE, wxCommandEvent);
class DebugInterface;
class SymbolDB;
class wxPaintDC;
namespace Common
{
class SymbolDB;
}
class CCodeView : public wxControl
{
public:
CCodeView(DebugInterface* debuginterface, SymbolDB* symbol_db, wxWindow* parent,
CCodeView(DebugInterface* debuginterface, Common::SymbolDB* symbol_db, wxWindow* parent,
wxWindowID Id = wxID_ANY);
void ToggleBreakpoint(u32 address);
@@ -58,7 +62,7 @@ private:
static constexpr int LEFT_COL_WIDTH = 16;
DebugInterface* m_debugger;
SymbolDB* m_symbol_db;
Common::SymbolDB* m_symbol_db;
bool m_plain;
@@ -434,14 +434,14 @@ void CCodeWindow::UpdateLists()
{
callers->Clear();
u32 addr = codeview->GetSelection();
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(addr);
Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(addr);
if (!symbol)
return;
for (auto& call : symbol->callers)
{
u32 caller_addr = call.call_address;
Symbol* caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
Common::Symbol* caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
if (caller_symbol)
{
int idx = callers->Append(StrToWxStr(
@@ -454,7 +454,7 @@ void CCodeWindow::UpdateLists()
for (auto& call : symbol->calls)
{
u32 call_addr = call.function;
Symbol* call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
Common::Symbol* call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
if (call_symbol)
{
int idx = calls->Append(StrToWxStr(
@@ -335,7 +335,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
std::istringstream ss(line);
ss >> std::hex >> address >> std::dec >> type >> name;
Symbol* symbol = g_symbolDB.GetSymbolFromAddr(address);
Common::Symbol* symbol = g_symbolDB.GetSymbolFromAddr(address);
if (symbol)
symbol->Rename(line.substr(12));
}
@@ -474,10 +474,10 @@ void CCodeWindow::OnSymbolListChange(wxCommandEvent& event)
int index = symbols->GetSelection();
if (index >= 0)
{
Symbol* pSymbol = static_cast<Symbol*>(symbols->GetClientData(index));
auto* pSymbol = static_cast<Common::Symbol*>(symbols->GetClientData(index));
if (pSymbol != nullptr)
{
if (pSymbol->type == Symbol::Type::Data)
if (pSymbol->type == Common::Symbol::Type::Data)
{
CMemoryWindow* memory = GetPanel<CMemoryWindow>();
if (memory)
@@ -223,10 +223,10 @@ void DSPDebuggerLLE::OnSymbolListChange(wxCommandEvent& event)
int index = m_SymbolList->GetSelection();
if (index >= 0)
{
Symbol* pSymbol = static_cast<Symbol*>(m_SymbolList->GetClientData(index));
auto* pSymbol = static_cast<Common::Symbol*>(m_SymbolList->GetClientData(index));
if (pSymbol != nullptr)
{
if (pSymbol->type == Symbol::Type::Function)
if (pSymbol->type == Common::Symbol::Type::Function)
{
JumpToAddress(pSymbol->address);
}
@@ -131,7 +131,7 @@ wxString CMemoryView::ReadMemoryAsString(u32 address) const
str += ' ';
}
Symbol* sym = g_symbolDB.GetSymbolFromAddr(mem_data);
Common::Symbol* sym = g_symbolDB.GetSymbolFromAddr(mem_data);
if (sym)
{
str += StringFromFormat(" # -> %s", sym->name.c_str());