summaryrefslogtreecommitdiff
path: root/Source/Core/DebuggerWX
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2008-08-23 15:15:25 +0000
committerhrydgard <hrydgard@gmail.com>2008-08-23 15:15:25 +0000
commit8be70a8ed28dc00ecff3eb091e4745640e288176 (patch)
treef70ef24ccf12c740fbe1086c527b979885970093 /Source/Core/DebuggerWX
parent0849a96d815ee0695c442ba1182594ffb97b72da (diff)
Finally hacked Super Monkey Ball into submission! Some bonus hacking tools included.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@282 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DebuggerWX')
-rw-r--r--Source/Core/DebuggerWX/src/CodeView.cpp53
-rw-r--r--Source/Core/DebuggerWX/src/CodeWindow.cpp61
-rw-r--r--Source/Core/DebuggerWX/src/CodeWindow.h1
3 files changed, 73 insertions, 42 deletions
diff --git a/Source/Core/DebuggerWX/src/CodeView.cpp b/Source/Core/DebuggerWX/src/CodeView.cpp
index e31a3ab9e7..ee75bb747d 100644
--- a/Source/Core/DebuggerWX/src/CodeView.cpp
+++ b/Source/Core/DebuggerWX/src/CodeView.cpp
@@ -16,13 +16,18 @@
// http://code.google.com/p/dolphin-emu/
#include "Debugger.h"
+#include "Debugger/PPCDebugInterface.h"
+#include "Debugger/Debugger_SymbolMap.h"
#include "Common.h"
+#include "StringUtil.h"
+#include "Host.h"
#include "CodeView.h"
#include "JitWindow.h"
#include <wx/event.h>
#include <wx/clipbrd.h>
+#include <wx/textdlg.h>
enum
@@ -34,6 +39,9 @@ enum
IDM_INSERTBLR,
IDM_RUNTOHERE,
IDM_JITRESULTS,
+ IDM_RENAMESYMBOL,
+ IDM_PATCHALERT,
+ IDM_COPYFUNCTION,
};
@@ -174,6 +182,22 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
}
break;
+ case IDM_COPYFUNCTION:
+ {
+ int sel = Debugger::FindSymbol(selection);
+ if (sel > 0) {
+ std::string text;
+ text = text + Debugger::GetSymbol(sel).GetName() + "\r\n";
+ // we got a function
+ u32 start = Debugger::GetSymbol(sel).vaddress;
+ u32 end = start + Debugger::GetSymbol(sel).size;
+ for (u32 addr = start; addr != end; addr += 4) {
+ text = text + StringFromFormat("%08x: ", addr) + debugger->disasm(addr) + "\r\n";
+ }
+ wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(text.c_str())));
+ }
+ }
+ break;
#endif
case IDM_RUNTOHERE:
@@ -190,6 +214,26 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
case IDM_JITRESULTS:
CJitWindow::ViewAddr(selection);
break;
+
+ case IDM_RENAMESYMBOL:
+ {
+ int sel = Debugger::FindSymbol(selection);
+ if (sel > 0) {
+ wxTextEntryDialog input_symbol(this, "Rename symbol:", wxGetTextFromUserPromptStr, Debugger::GetSymbol(sel).GetName().c_str());
+ if (input_symbol.ShowModal() == wxID_OK) {
+ Debugger::AccessSymbol(sel).SetName(input_symbol.GetValue().c_str());
+ }
+// redraw();
+ Host_NotifyMapLoaded();
+ }
+ }
+ break;
+
+ case IDM_PATCHALERT:
+ {
+
+ }
+ break;
}
#if wxUSE_CLIPBOARD
@@ -206,12 +250,17 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
#if wxUSE_CLIPBOARD
menu.Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
- menu.Append(IDM_COPYCODE, wxString::FromAscii("Copy &code"));
+ menu.Append(IDM_COPYFUNCTION, wxString::FromAscii("Copy &function"));
+ menu.Append(IDM_COPYCODE, wxString::FromAscii("Copy &code line"));
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
+ menu.AppendSeparator();
#endif
+ menu.Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"));
+ menu.AppendSeparator();
menu.Append(IDM_RUNTOHERE, _T("&Run To Here"));
- menu.Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr"));
menu.Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86"));
+ menu.Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr"));
+ menu.Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert"));
PopupMenu(&menu);
event.Skip(true);
}
diff --git a/Source/Core/DebuggerWX/src/CodeWindow.cpp b/Source/Core/DebuggerWX/src/CodeWindow.cpp
index ef796d9529..be110880d6 100644
--- a/Source/Core/DebuggerWX/src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/src/CodeWindow.cpp
@@ -17,9 +17,9 @@
#include "wx/button.h"
#include "wx/textctrl.h"
+#include "wx/textdlg.h"
#include "wx/listctrl.h"
#include "wx/thread.h"
-#include "wx/listctrl.h"
#include "wx/mstream.h"
// ugly that this lib included code from the main
@@ -39,7 +39,9 @@
#include "CodeWindow.h"
#include "CodeView.h"
+#include "FileUtil.h"
#include "Core.h"
+#include "Boot/Boot.h"
#include "LogManager.h"
#include "HW/CPU.h"
#include "PowerPC/PowerPC.h"
@@ -241,7 +243,9 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
{
wxMenu *pSymbolsMenu = new wxMenu;
- pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _T("&Scan for functions"));
+ pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _T("&Load symbol map"));
+ pSymbolsMenu->Append(IDM_SAVEMAPFILE, _T("&Save symbol map"));
+ pSymbolsMenu->Append(IDM_RENAMEFUNCTION, _T("&Rename function..."));
pMenuBar->Append(pSymbolsMenu, _T("&Symbols"));
}
@@ -293,50 +297,27 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
// TODO: disable menu items instead :P
return;
}
- wxString path;
+ std::string mapfile = CBoot::GenerateMapFilename();
switch (event.GetId())
{
case IDM_SCANFUNCTIONS:
- PPCAnalyst::FindFunctions(0x80003100, 0x80400000);
- PPCAnalyst::LoadFuncDB("Data/totaldb.dsy");
- Debugger::GetFromAnalyzer();
- NotifyMapLoaded();
- break;
- case IDM_LOADMAPFILE:
- path = wxFileSelector(
- _T("Select the mapfile to load"),
- wxEmptyString, wxEmptyString, wxEmptyString,
- wxString::Format
- (
- _T("Map files (*.map)|*.map|All files (%s)|%s"),
- wxFileSelectorDefaultWildcardStr,
- wxFileSelectorDefaultWildcardStr
- ),
- wxFD_OPEN | wxFD_FILE_MUST_EXIST,
- this);
- if (!path)
+ if (!File::Exists(mapfile))
{
- return;
+ PPCAnalyst::FindFunctions(0x80003100, 0x80400000);
+ if (PPCAnalyst::LoadFuncDB("Data/totaldb.dsy"))
+ {
+ Debugger::GetFromAnalyzer();
+ NotifyMapLoaded();
+ }
+ } else {
+ Debugger::LoadSymbolMap(mapfile.c_str());
}
- Debugger::LoadSymbolMap(path.ToAscii());
break;
+// case IDM_LOADMAPFILE:
+// Debugger::LoadSymbolMap(mapfile.c_str());
+// break;
case IDM_SAVEMAPFILE:
- path = wxFileSelector(
- _T("Name your mapfile"),
- wxEmptyString, wxEmptyString, wxEmptyString,
- wxString::Format
- (
- _T("Map files (*.map)|*.map|All files (%s)|%s"),
- wxFileSelectorDefaultWildcardStr,
- wxFileSelectorDefaultWildcardStr
- ),
- wxFD_SAVE,
- this);
- if (!path)
- {
- return;
- }
- Debugger::SaveSymbolMap(path.ToAscii());
+ Debugger::SaveSymbolMap(mapfile.c_str());
break;
}
}
@@ -362,7 +343,7 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
Update();
}
- break;
+ break;
case IDM_STEP:
SingleCPUStep();
diff --git a/Source/Core/DebuggerWX/src/CodeWindow.h b/Source/Core/DebuggerWX/src/CodeWindow.h
index 9a7010c7fb..0276a99c60 100644
--- a/Source/Core/DebuggerWX/src/CodeWindow.h
+++ b/Source/Core/DebuggerWX/src/CodeWindow.h
@@ -83,6 +83,7 @@ class CCodeWindow
IDM_LOGINSTRUCTIONS,
IDM_LOADMAPFILE,
IDM_SAVEMAPFILE,
+ IDM_RENAMEFUNCTION,
IDM_CLEARCODECACHE,
};