From a47f8cbe9a8ee0270fab60fd3a3fa6f206a203f2 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 24 Aug 2008 21:54:59 +0000 Subject: [PATCH] more fixes, prefix filter for export symbols git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@304 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/PowerPC/SignatureDB.cpp | 14 +++++++---- Source/Core/Core/Src/PowerPC/SignatureDB.h | 2 +- Source/Core/DebuggerWX/src/BreakpointView.cpp | 4 ++-- Source/Core/DebuggerWX/src/CodeWindow.cpp | 23 +++++++++++-------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp index afd6f5bb9a..f7d82e990c 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp @@ -133,14 +133,18 @@ void SignatureDB::Apply(SymbolDB *symbol_db) symbol_db->Index(); } -void SignatureDB::Initialize(SymbolDB *symbol_db) +void SignatureDB::Initialize(SymbolDB *symbol_db, const char *prefix) { + std::string prefix_str(prefix); for (SymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); iter++) { - DBFunc temp_dbfunc; - temp_dbfunc.name = iter->second.name; - temp_dbfunc.size = iter->second.size; - database[iter->second.hash] = temp_dbfunc; + if (iter->second.name.substr(0, prefix_str.size()) == prefix_str) + { + DBFunc temp_dbfunc; + temp_dbfunc.name = iter->second.name; + temp_dbfunc.size = iter->second.size; + database[iter->second.hash] = temp_dbfunc; + } } } diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.h b/Source/Core/Core/Src/PowerPC/SignatureDB.h index 9798772fab..509b2784e9 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.h +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.h @@ -50,7 +50,7 @@ public: void Clear(); void List(); - void Initialize(SymbolDB *func_db); + void Initialize(SymbolDB *func_db, const char *prefix = ""); void Apply(SymbolDB *func_db); static u32 ComputeCodeChecksum(u32 offsetStart, u32 offsetEnd); diff --git a/Source/Core/DebuggerWX/src/BreakpointView.cpp b/Source/Core/DebuggerWX/src/BreakpointView.cpp index fc5c24a59b..cde9a9519d 100644 --- a/Source/Core/DebuggerWX/src/BreakpointView.cpp +++ b/Source/Core/DebuggerWX/src/BreakpointView.cpp @@ -62,7 +62,7 @@ void CBreakPointView::Update() Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress); if (symbol) { - temp = wxString::FromAscii("halloj"); //Debugger::GetDescription(rBP.iAddress)); + temp = wxString::FromAscii(g_symbolDB.GetDescription(rBP.iAddress)); SetItem(Item, 2, temp); } @@ -88,7 +88,7 @@ void CBreakPointView::Update() Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress); if (symbol) { - temp = wxString::FromAscii("bjorn"); //Debugger::GetDescription(rMemCheck.StartAddress)); + temp = wxString::FromAscii(g_symbolDB.GetDescription(rMemCheck.StartAddress)); SetItem(Item, 2, temp); } diff --git a/Source/Core/DebuggerWX/src/CodeWindow.cpp b/Source/Core/DebuggerWX/src/CodeWindow.cpp index d18ca64b0c..4e502030f3 100644 --- a/Source/Core/DebuggerWX/src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/src/CodeWindow.cpp @@ -348,15 +348,20 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) break; case IDM_CREATESIGNATUREFILE: { - wxString path = wxFileSelector( - _T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString, - _T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_SAVE, - this); - if (path) { - SignatureDB db; - db.Initialize(&g_symbolDB); - std::string filename(path.ToAscii()); // PPCAnalyst::SaveSignatureDB( - db.Save(path.ToAscii()); + wxTextEntryDialog input_prefix(this, wxString::FromAscii("Only export symbols with prefix:"), wxGetTextFromUserPromptStr, "."); + if (input_prefix.ShowModal() == wxID_OK) { + std::string prefix = input_prefix.GetValue().mb_str(); + + wxString path = wxFileSelector( + _T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString, + _T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_SAVE, + this); + if (path) { + SignatureDB db; + db.Initialize(&g_symbolDB, prefix.c_str()); + std::string filename(path.ToAscii()); // PPCAnalyst::SaveSignatureDB( + db.Save(path.ToAscii()); + } } } break;