mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
Merge pull request #1291 from skidau/debugger-step-out
Dolphin debugger enhancements
This commit is contained in:
@ -45,6 +45,8 @@ set(GUI_SRCS
|
||||
Debugger/MemoryWindow.cpp
|
||||
Debugger/RegisterView.cpp
|
||||
Debugger/RegisterWindow.cpp
|
||||
Debugger/WatchView.cpp
|
||||
Debugger/WatchWindow.cpp
|
||||
FifoPlayerDlg.cpp
|
||||
Frame.cpp
|
||||
FrameAui.cpp
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
@ -45,9 +46,9 @@ public:
|
||||
{
|
||||
SetToolBitmapSize(wxSize(24, 24));
|
||||
|
||||
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(24, 24));
|
||||
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(24, 24));
|
||||
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(24, 24));
|
||||
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(16, 16));
|
||||
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(16, 16));
|
||||
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(16, 16));
|
||||
|
||||
AddTool(ID_DELETE, _("Delete"), m_Bitmaps[Toolbar_Delete]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::OnDelete, parent, ID_DELETE);
|
||||
@ -66,7 +67,7 @@ public:
|
||||
}
|
||||
|
||||
AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_Delete]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::LoadAll, parent, ID_LOAD);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::Event_LoadAll, parent, ID_LOAD);
|
||||
|
||||
AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_Delete]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::Event_SaveAll, parent, ID_SAVE);
|
||||
@ -112,7 +113,7 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
|
||||
m_BreakPointListView = new CBreakPointView(this, wxID_ANY);
|
||||
|
||||
m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top().
|
||||
LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false));
|
||||
LeftDockable(true).RightDockable(true).BottomDockable(false).Floatable(false));
|
||||
m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane());
|
||||
m_mgr.Update();
|
||||
}
|
||||
@ -180,32 +181,38 @@ void CBreakPointWindow::SaveAll()
|
||||
{
|
||||
// simply dump all to bp/mc files in a way we can read again
|
||||
IniFile ini;
|
||||
if (ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX)))
|
||||
{
|
||||
ini.SetLines("BreakPoints", PowerPC::breakpoints.GetStrings());
|
||||
ini.SetLines("MemoryChecks", PowerPC::memchecks.GetStrings());
|
||||
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
}
|
||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false);
|
||||
ini.SetLines("BreakPoints", PowerPC::breakpoints.GetStrings());
|
||||
ini.SetLines("MemoryChecks", PowerPC::memchecks.GetStrings());
|
||||
ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini");
|
||||
}
|
||||
|
||||
void CBreakPointWindow::LoadAll(wxCommandEvent& WXUNUSED(event))
|
||||
void CBreakPointWindow::Event_LoadAll(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
LoadAll();
|
||||
return;
|
||||
}
|
||||
|
||||
void CBreakPointWindow::LoadAll()
|
||||
{
|
||||
IniFile ini;
|
||||
BreakPoints::TBreakPointsStr newbps;
|
||||
MemChecks::TMemChecksStr newmcs;
|
||||
|
||||
if (!ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX)))
|
||||
if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ini.GetLines("BreakPoints", &newbps, false))
|
||||
{
|
||||
PowerPC::breakpoints.Clear();
|
||||
PowerPC::breakpoints.AddFromStrings(newbps);
|
||||
}
|
||||
|
||||
if (ini.GetLines("MemoryChecks", &newmcs, false))
|
||||
{
|
||||
PowerPC::memchecks.Clear();
|
||||
PowerPC::memchecks.AddFromStrings(newmcs);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,8 @@ public:
|
||||
void OnAddMemoryCheck(wxCommandEvent& WXUNUSED(event));
|
||||
void Event_SaveAll(wxCommandEvent& WXUNUSED(event));
|
||||
void SaveAll();
|
||||
void LoadAll(wxCommandEvent& WXUNUSED(event));
|
||||
void Event_LoadAll(wxCommandEvent& WXUNUSED(event));
|
||||
void LoadAll();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "Core/Debugger/PPCDebugInterface.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
#include "Core/PowerPC/JitInterface.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
@ -51,6 +52,7 @@
|
||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||
#include "DolphinWX/Debugger/JitWindow.h"
|
||||
#include "DolphinWX/Debugger/RegisterWindow.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
extern "C" // Bitmaps
|
||||
{
|
||||
@ -92,6 +94,7 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
|
||||
: wxPanel(parent, id, position, size, style, name)
|
||||
, Parent(parent)
|
||||
, m_RegisterWindow(nullptr)
|
||||
, m_WatchWindow(nullptr)
|
||||
, m_BreakpointWindow(nullptr)
|
||||
, m_MemoryWindow(nullptr)
|
||||
, m_JitWindow(nullptr)
|
||||
@ -151,6 +154,7 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||
Update();
|
||||
if (codeview) codeview->Center(PC);
|
||||
if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate();
|
||||
if (m_WatchWindow) m_WatchWindow->NotifyUpdate();
|
||||
break;
|
||||
|
||||
case IDM_UPDATEBREAKPOINTS:
|
||||
@ -180,6 +184,10 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
|
||||
StepOver();
|
||||
break;
|
||||
|
||||
case IDM_STEPOUT:
|
||||
StepOut();
|
||||
break;
|
||||
|
||||
case IDM_TOGGLE_BREAKPOINT:
|
||||
ToggleBreakpoint();
|
||||
break;
|
||||
@ -288,6 +296,7 @@ void CCodeWindow::SingleStep()
|
||||
{
|
||||
if (CCPU::IsStepping())
|
||||
{
|
||||
PowerPC::breakpoints.ClearAllTemporary();
|
||||
JitInterface::InvalidateICache(PC, 4, true);
|
||||
CCPU::StepOpcode(&sync_event);
|
||||
wxThread::Sleep(20);
|
||||
@ -304,6 +313,7 @@ void CCodeWindow::StepOver()
|
||||
UGeckoInstruction inst = Memory::Read_Instruction(PC);
|
||||
if (inst.LK)
|
||||
{
|
||||
PowerPC::breakpoints.ClearAllTemporary();
|
||||
PowerPC::breakpoints.Add(PC + 4, true);
|
||||
CCPU::EnableStepping(false);
|
||||
JumpToAddress(PC);
|
||||
@ -320,6 +330,52 @@ void CCodeWindow::StepOver()
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::StepOut()
|
||||
{
|
||||
if (CCPU::IsStepping())
|
||||
{
|
||||
PowerPC::breakpoints.ClearAllTemporary();
|
||||
|
||||
// Keep stepping until the next blr or timeout after one second
|
||||
u64 timeout = SystemTimers::GetTicksPerSecond();
|
||||
u64 steps = 0;
|
||||
PowerPC::CoreMode oldMode = PowerPC::GetMode();
|
||||
PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
|
||||
UGeckoInstruction inst = Memory::Read_Instruction(PC);
|
||||
GekkoOPInfo* opinfo = GetOpInfo(inst);
|
||||
while (inst.hex != 0x4e800020 && steps < timeout) // check for blr
|
||||
{
|
||||
if (inst.LK)
|
||||
{
|
||||
// Step over branches
|
||||
u32 next_pc = PC + 4;
|
||||
while (PC != next_pc && steps < timeout)
|
||||
{
|
||||
PowerPC::SingleStep();
|
||||
++steps;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerPC::SingleStep();
|
||||
++steps;
|
||||
}
|
||||
inst = Memory::Read_Instruction(PC);
|
||||
opinfo = GetOpInfo(inst);
|
||||
}
|
||||
|
||||
PowerPC::SingleStep();
|
||||
PowerPC::SetMode(oldMode);
|
||||
|
||||
JumpToAddress(PC);
|
||||
Update();
|
||||
|
||||
UpdateButtonStates();
|
||||
// Update all toolbars in the aui manager
|
||||
Parent->UpdateGUI();
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleBreakpoint()
|
||||
{
|
||||
if (CCPU::IsStepping())
|
||||
@ -443,6 +499,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& core_startup_parameter
|
||||
|
||||
pDebugMenu->Append(IDM_STEP, _("Step &Into\tF11"));
|
||||
pDebugMenu->Append(IDM_STEPOVER, _("Step &Over\tF10"));
|
||||
pDebugMenu->Append(IDM_STEPOUT, _("Step O&ut\tSHIFT+F11"));
|
||||
pDebugMenu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint\tF9"));
|
||||
pDebugMenu->AppendSeparator();
|
||||
|
||||
@ -607,6 +664,7 @@ void CCodeWindow::InitBitmaps()
|
||||
// load original size 48x48
|
||||
m_Bitmaps[Toolbar_Step] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png);
|
||||
m_Bitmaps[Toolbar_StepOver] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_StepOut] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
@ -624,6 +682,7 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
|
||||
toolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step], _("Step into the next instruction"));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver], _("Step over the next instruction"));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_STEPOUT, _("Step Out"), m_Bitmaps[Toolbar_StepOut], _("Step out of the current function"));
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip], _("Skips the next instruction completely"));
|
||||
toolBar->AddSeparator();
|
||||
WxUtils::AddToolbarButton(toolBar, IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC], _("Go to the current instruction"));
|
||||
@ -660,6 +719,7 @@ void CCodeWindow::UpdateButtonStates()
|
||||
if (!Initialized)
|
||||
{
|
||||
ToolBar->EnableTool(IDM_STEPOVER, false);
|
||||
ToolBar->EnableTool(IDM_STEPOUT, false);
|
||||
ToolBar->EnableTool(IDM_SKIP, false);
|
||||
}
|
||||
else
|
||||
@ -667,11 +727,13 @@ void CCodeWindow::UpdateButtonStates()
|
||||
if (!Stepping)
|
||||
{
|
||||
ToolBar->EnableTool(IDM_STEPOVER, false);
|
||||
ToolBar->EnableTool(IDM_STEPOUT, false);
|
||||
ToolBar->EnableTool(IDM_SKIP, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolBar->EnableTool(IDM_STEPOVER, true);
|
||||
ToolBar->EnableTool(IDM_STEPOUT, true);
|
||||
ToolBar->EnableTool(IDM_SKIP, true);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
class CFrame;
|
||||
class CRegisterWindow;
|
||||
class CWatchWindow;
|
||||
class CBreakPointWindow;
|
||||
class CMemoryWindow;
|
||||
class CJitWindow;
|
||||
@ -77,6 +78,7 @@ public:
|
||||
|
||||
void ToggleCodeWindow(bool bShow);
|
||||
void ToggleRegisterWindow(bool bShow);
|
||||
void ToggleWatchWindow(bool bShow);
|
||||
void ToggleBreakPointWindow(bool bShow);
|
||||
void ToggleMemoryWindow(bool bShow);
|
||||
void ToggleJitWindow(bool bShow);
|
||||
@ -93,6 +95,7 @@ public:
|
||||
|
||||
// Sub dialogs
|
||||
CRegisterWindow* m_RegisterWindow;
|
||||
CWatchWindow* m_WatchWindow;
|
||||
CBreakPointWindow* m_BreakpointWindow;
|
||||
CMemoryWindow* m_MemoryWindow;
|
||||
CJitWindow* m_JitWindow;
|
||||
@ -126,6 +129,7 @@ private:
|
||||
// Debugger functions
|
||||
void SingleStep();
|
||||
void StepOver();
|
||||
void StepOut();
|
||||
void ToggleBreakpoint();
|
||||
|
||||
void UpdateLists();
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "DolphinWX/Debugger/JitWindow.h"
|
||||
#include "DolphinWX/Debugger/MemoryWindow.h"
|
||||
#include "DolphinWX/Debugger/RegisterWindow.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
|
||||
// Save and load settings
|
||||
@ -421,6 +422,8 @@ void CCodeWindow::OpenPages()
|
||||
Parent->ToggleLogConfigWindow(true);
|
||||
if (bShowOnStart[IDM_REGISTERWINDOW - IDM_LOGWINDOW])
|
||||
ToggleRegisterWindow(true);
|
||||
if (bShowOnStart[IDM_WATCHWINDOW - IDM_LOGWINDOW])
|
||||
ToggleWatchWindow(true);
|
||||
if (bShowOnStart[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW])
|
||||
ToggleBreakPointWindow(true);
|
||||
if (bShowOnStart[IDM_MEMORYWINDOW - IDM_LOGWINDOW])
|
||||
@ -461,6 +464,24 @@ void CCodeWindow::ToggleRegisterWindow(bool bShow)
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleWatchWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_WATCHWINDOW)->Check(bShow);
|
||||
if (bShow)
|
||||
{
|
||||
if (!m_WatchWindow)
|
||||
m_WatchWindow = new CWatchWindow(Parent, IDM_WATCHWINDOW);
|
||||
Parent->DoAddPage(m_WatchWindow,
|
||||
iNbAffiliation[IDM_WATCHWINDOW - IDM_LOGWINDOW],
|
||||
Parent->bFloatWindow[IDM_WATCHWINDOW - IDM_LOGWINDOW]);
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
Parent->DoRemovePage(m_WatchWindow, false);
|
||||
m_WatchWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CCodeWindow::ToggleBreakPointWindow(bool bShow)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(bShow);
|
||||
|
@ -25,10 +25,13 @@
|
||||
#include "Common/DebugInterface.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "DolphinWX/Frame.h"
|
||||
#include "DolphinWX/Globals.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||
#include "DolphinWX/Debugger/MemoryView.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@ -38,6 +41,7 @@ enum
|
||||
IDM_COPYCODE,
|
||||
IDM_RUNTOHERE,
|
||||
IDM_DYNARECRESULTS,
|
||||
IDM_WATCHADDRESS,
|
||||
IDM_TOGGLEMEMORY,
|
||||
IDM_VIEWASFP,
|
||||
IDM_VIEWASASCII,
|
||||
@ -161,6 +165,10 @@ void CMemoryView::OnScrollWheel(wxMouseEvent& event)
|
||||
|
||||
void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
CFrame* main_frame = (CFrame*)(GetParent()->GetParent()->GetParent());
|
||||
CCodeWindow* code_window = main_frame->g_pCodeWindow;
|
||||
CWatchWindow* watch_window = code_window->m_WatchWindow;
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
wxTheClipboard->Open();
|
||||
#endif
|
||||
@ -180,6 +188,13 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IDM_WATCHADDRESS:
|
||||
debugger->AddWatch(selection);
|
||||
if (watch_window)
|
||||
watch_window->NotifyUpdate();
|
||||
Refresh();
|
||||
break;
|
||||
|
||||
case IDM_TOGGLEMEMORY:
|
||||
memory ^= 1;
|
||||
Refresh();
|
||||
@ -215,6 +230,7 @@ void CMemoryView::OnMouseDownR(wxMouseEvent& event)
|
||||
menu->Append(IDM_COPYADDRESS, _("Copy &address"));
|
||||
menu->Append(IDM_COPYHEX, _("Copy &hex"));
|
||||
#endif
|
||||
menu->Append(IDM_WATCHADDRESS, _("Add to &watch"));
|
||||
menu->Append(IDM_TOGGLEMEMORY, _("Toggle &memory"));
|
||||
|
||||
wxMenu* viewAsSubMenu = new wxMenu;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <wx/colour.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/windowid.h>
|
||||
|
||||
@ -15,14 +16,25 @@
|
||||
#include "Core/HW/ProcessorInterface.h"
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "DolphinWX/Frame.h"
|
||||
#include "DolphinWX/Globals.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||
#include "DolphinWX/Debugger/MemoryWindow.h"
|
||||
#include "DolphinWX/Debugger/RegisterView.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
class wxWindow;
|
||||
|
||||
// F-zero 80005e60 wtf??
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_WATCHADDRESS,
|
||||
IDM_VIEWMEMORY,
|
||||
};
|
||||
|
||||
static const char *special_reg_names[] = {
|
||||
"PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause", "DSISR", "DAR", "PT hashmask"
|
||||
};
|
||||
@ -49,7 +61,7 @@ static u32 GetSpecialRegValue(int reg)
|
||||
}
|
||||
}
|
||||
|
||||
wxString CRegTable::GetValue(int row, int col)
|
||||
static wxString GetValueByRowCol(int row, int col)
|
||||
{
|
||||
if (row < 32)
|
||||
{
|
||||
@ -130,6 +142,11 @@ wxString CRegTable::GetValue(int row, int col)
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString CRegTable::GetValue(int row, int col)
|
||||
{
|
||||
return GetValueByRowCol(row, col);
|
||||
}
|
||||
|
||||
static void SetSpecialRegValue(int reg, u32 value)
|
||||
{
|
||||
switch (reg)
|
||||
@ -246,3 +263,42 @@ void CRegisterView::Update()
|
||||
ForceRefresh();
|
||||
((CRegTable *)GetTable())->UpdateCachedRegs();
|
||||
}
|
||||
|
||||
void CRegisterView::OnMouseDownR(wxGridEvent& event)
|
||||
{
|
||||
// popup menu
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
|
||||
wxString strNewVal = GetValueByRowCol(row, col);
|
||||
TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress);
|
||||
|
||||
wxMenu* menu = new wxMenu;
|
||||
menu->Append(IDM_WATCHADDRESS, _("Add to &watch"));
|
||||
menu->Append(IDM_VIEWMEMORY, _("View &memory"));
|
||||
PopupMenu(menu);
|
||||
}
|
||||
|
||||
void CRegisterView::OnPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
CFrame* main_frame = (CFrame*)(GetParent()->GetParent());
|
||||
CCodeWindow* code_window = main_frame->g_pCodeWindow;
|
||||
CWatchWindow* watch_window = code_window->m_WatchWindow;
|
||||
CMemoryWindow* memory_window = code_window->m_MemoryWindow;
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_WATCHADDRESS:
|
||||
PowerPC::watches.Add(m_selectedAddress);
|
||||
if (watch_window)
|
||||
watch_window->NotifyUpdate();
|
||||
Refresh();
|
||||
break;
|
||||
case IDM_VIEWMEMORY:
|
||||
if (memory_window)
|
||||
memory_window->JumpToAddress(m_selectedAddress);
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
@ -30,14 +30,13 @@ class wxWindow;
|
||||
// Interrupt Mask (PI)
|
||||
// Interrupt Cause(PI)
|
||||
|
||||
#define NUM_SPECIALS 14
|
||||
|
||||
class CRegTable : public wxGridTableBase
|
||||
{
|
||||
enum
|
||||
{
|
||||
NUM_SPECIALS = 14,
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
CRegTable()
|
||||
{
|
||||
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
|
||||
@ -72,4 +71,9 @@ class CRegisterView : public wxGrid
|
||||
public:
|
||||
CRegisterView(wxWindow* parent, wxWindowID id);
|
||||
void Update() override;
|
||||
void OnMouseDownR(wxGridEvent& event);
|
||||
void OnPopupMenu(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
u32 m_selectedAddress = 0;
|
||||
};
|
||||
|
@ -11,12 +11,15 @@
|
||||
#include <wx/string.h>
|
||||
#include <wx/windowid.h>
|
||||
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "DolphinWX/Debugger/RegisterView.h"
|
||||
#include "DolphinWX/Debugger/RegisterWindow.h"
|
||||
|
||||
class wxWindow;
|
||||
|
||||
BEGIN_EVENT_TABLE(CRegisterWindow, wxPanel)
|
||||
EVT_GRID_CELL_RIGHT_CLICK(CRegisterView::OnMouseDownR)
|
||||
EVT_MENU(-1, CRegisterView::OnPopupMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
307
Source/Core/DolphinWX/Debugger/WatchView.cpp
Normal file
307
Source/Core/DolphinWX/Debugger/WatchView.cpp
Normal file
@ -0,0 +1,307 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <wx/chartype.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/windowid.h>
|
||||
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "DolphinWX/Frame.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "DolphinWX/Debugger/BreakpointWindow.h"
|
||||
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||
#include "DolphinWX/Debugger/MemoryWindow.h"
|
||||
#include "DolphinWX/Debugger/RegisterView.h"
|
||||
#include "DolphinWX/Debugger/WatchView.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
class wxWindow;
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_DELETEWATCH,
|
||||
IDM_ADDMEMCHECK,
|
||||
IDM_VIEWMEMORY,
|
||||
};
|
||||
|
||||
|
||||
static std::string GetWatchName(int count)
|
||||
{
|
||||
return PowerPC::watches.GetWatches().at(count - 1).name;
|
||||
}
|
||||
|
||||
static u32 GetWatchAddr(int count)
|
||||
{
|
||||
return PowerPC::watches.GetWatches().at(count - 1).iAddress;
|
||||
}
|
||||
|
||||
static u32 GetWatchValue(int count)
|
||||
{
|
||||
return Memory::ReadUnchecked_U32(GetWatchAddr(count));
|
||||
}
|
||||
|
||||
static void AddWatchAddr(int count, u32 value)
|
||||
{
|
||||
PowerPC::watches.Add(value);
|
||||
}
|
||||
|
||||
static void UpdateWatchAddr(int count, u32 value)
|
||||
{
|
||||
PowerPC::watches.Update(count - 1, value);
|
||||
}
|
||||
|
||||
static void SetWatchName(int count, const std::string value)
|
||||
{
|
||||
if ((count - 1) < PowerPC::watches.GetWatches().size())
|
||||
{
|
||||
PowerPC::watches.UpdateName(count - 1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerPC::watches.Add(0);
|
||||
PowerPC::watches.UpdateName(PowerPC::watches.GetWatches().size() - 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
static void SetWatchValue(int count, u32 value)
|
||||
{
|
||||
Memory::WriteUnchecked_U32(value, GetWatchAddr(count));
|
||||
}
|
||||
|
||||
static wxString GetValueByRowCol(int row, int col)
|
||||
{
|
||||
if (row == 0)
|
||||
{
|
||||
// Column Labels
|
||||
switch (col)
|
||||
{
|
||||
case 0: return wxString::Format("Label");
|
||||
case 1: return wxString::Format("Addr");
|
||||
case 2: return wxString::Format("Hex");
|
||||
case 3: return wxString::Format("Dec");
|
||||
case 4: return wxString::Format("Str");
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
}
|
||||
else if (row <= PowerPC::watches.GetWatches().size())
|
||||
{
|
||||
if (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||
{
|
||||
switch (col)
|
||||
{
|
||||
case 0: return wxString::Format("%s", GetWatchName(row));
|
||||
case 1: return wxString::Format("%08x", GetWatchAddr(row));
|
||||
case 2: return wxString::Format("%08x", GetWatchValue(row));
|
||||
case 3: return wxString::Format("%lu", GetWatchValue(row));
|
||||
case 4:
|
||||
{
|
||||
u32 addr = GetWatchAddr(row);
|
||||
if (Memory::IsRAMAddress(addr))
|
||||
return Memory::GetString(addr, 32).c_str();
|
||||
else
|
||||
return wxEmptyString;
|
||||
}
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
}
|
||||
}
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString CWatchTable::GetValue(int row, int col)
|
||||
{
|
||||
return GetValueByRowCol(row, col);
|
||||
}
|
||||
|
||||
void CWatchTable::SetValue(int row, int col, const wxString& strNewVal)
|
||||
{
|
||||
u32 newVal = 0;
|
||||
if (col == 0 || TryParse("0x" + WxStrToStr(strNewVal), &newVal))
|
||||
{
|
||||
if (row > 0)
|
||||
{
|
||||
switch (col)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
SetWatchName(row, std::string(WxStrToStr(strNewVal)));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (row > (int)PowerPC::watches.GetWatches().size())
|
||||
{
|
||||
AddWatchAddr(row, newVal);
|
||||
row = (int)PowerPC::watches.GetWatches().size();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWatchAddr(row, newVal);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
SetWatchValue(row, newVal);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CWatchTable::UpdateWatch()
|
||||
{
|
||||
for (int i = 0; i < (int)PowerPC::watches.GetWatches().size(); ++i)
|
||||
{
|
||||
m_CachedWatchHasChanged[i] = (m_CachedWatch[i] != GetWatchValue(i + 1));
|
||||
m_CachedWatch[i] = GetWatchValue(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
wxGridCellAttr* CWatchTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
{
|
||||
wxGridCellAttr* attr = new wxGridCellAttr();
|
||||
|
||||
attr->SetBackgroundColour(*wxWHITE);
|
||||
attr->SetFont(DebuggerFont);
|
||||
|
||||
switch (col)
|
||||
{
|
||||
case 1:
|
||||
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
break;
|
||||
default:
|
||||
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
break;
|
||||
}
|
||||
|
||||
if (row == 0)
|
||||
{
|
||||
attr->SetReadOnly(true);
|
||||
attr->SetBackgroundColour(*wxBLACK);
|
||||
attr->SetTextColour(*wxWHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool red = false;
|
||||
if (col == 1)
|
||||
red = m_CachedWatchHasChanged[row];
|
||||
|
||||
attr->SetTextColour(red ? *wxRED : *wxBLACK);
|
||||
|
||||
if (row > (int)(PowerPC::watches.GetWatches().size() + 1) || (PowerPC::GetState() == PowerPC::CPU_POWERDOWN))
|
||||
{
|
||||
attr->SetReadOnly(true);
|
||||
attr->SetBackgroundColour(*wxLIGHT_GREY);
|
||||
}
|
||||
}
|
||||
attr->IncRef();
|
||||
return attr;
|
||||
}
|
||||
|
||||
CWatchView::CWatchView(wxWindow* parent, wxWindowID id)
|
||||
: wxGrid(parent, id)
|
||||
{
|
||||
SetTable(new CWatchTable(), false);
|
||||
SetRowLabelSize(0);
|
||||
SetColLabelSize(0);
|
||||
DisableDragRowSize();
|
||||
}
|
||||
|
||||
void CWatchView::Update()
|
||||
{
|
||||
if (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||
{
|
||||
ForceRefresh();
|
||||
((CWatchTable *)GetTable())->UpdateWatch();
|
||||
}
|
||||
}
|
||||
|
||||
void CWatchView::OnMouseDownR(wxGridEvent& event)
|
||||
{
|
||||
// popup menu
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
|
||||
m_selectedRow = row;
|
||||
|
||||
if (col == 1 || col == 2)
|
||||
{
|
||||
wxString strNewVal = GetValueByRowCol(row, col);
|
||||
TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress);
|
||||
}
|
||||
|
||||
wxMenu* menu = new wxMenu;
|
||||
if (row != 0 && row != (int)(PowerPC::watches.GetWatches().size() + 1))
|
||||
menu->Append(IDM_DELETEWATCH, _("&Delete watch"));
|
||||
|
||||
if (row != 0 && row != (int)(PowerPC::watches.GetWatches().size() + 1) && (col == 1 || col == 2))
|
||||
{
|
||||
#ifdef ENABLE_MEM_CHECK
|
||||
menu->Append(IDM_ADDMEMCHECK, _("Add memory &breakpoint"));
|
||||
#endif
|
||||
menu->Append(IDM_VIEWMEMORY, _("View &memory"));
|
||||
}
|
||||
PopupMenu(menu);
|
||||
}
|
||||
|
||||
void CWatchView::OnPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
CFrame* main_frame = (CFrame*)(GetParent()->GetParent());
|
||||
CCodeWindow* code_window = main_frame->g_pCodeWindow;
|
||||
CWatchWindow* watch_window = code_window->m_WatchWindow;
|
||||
CMemoryWindow* memory_window = code_window->m_MemoryWindow;
|
||||
CBreakPointWindow* breakpoint_window = code_window->m_BreakpointWindow;
|
||||
|
||||
wxString strNewVal;
|
||||
TMemCheck MemCheck;
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_DELETEWATCH:
|
||||
strNewVal = GetValueByRowCol(m_selectedRow, 1);
|
||||
if (TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress))
|
||||
{
|
||||
PowerPC::watches.Remove(m_selectedAddress);
|
||||
if (watch_window)
|
||||
watch_window->NotifyUpdate();
|
||||
Refresh();
|
||||
}
|
||||
break;
|
||||
case IDM_ADDMEMCHECK:
|
||||
MemCheck.StartAddress = m_selectedAddress;
|
||||
MemCheck.EndAddress = m_selectedAddress;
|
||||
MemCheck.bRange = m_selectedAddress != m_selectedAddress;
|
||||
MemCheck.OnRead = true;
|
||||
MemCheck.OnWrite = true;
|
||||
MemCheck.Log = true;
|
||||
MemCheck.Break = true;
|
||||
PowerPC::memchecks.Add(MemCheck);
|
||||
|
||||
if (breakpoint_window)
|
||||
breakpoint_window->NotifyUpdate();
|
||||
Refresh();
|
||||
break;
|
||||
case IDM_VIEWMEMORY:
|
||||
if (memory_window)
|
||||
memory_window->JumpToAddress(m_selectedAddress);
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
event.Skip();
|
||||
}
|
55
Source/Core/DolphinWX/Debugger/WatchView.h
Normal file
55
Source/Core/DolphinWX/Debugger/WatchView.h
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/windowid.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class wxWindow;
|
||||
|
||||
class CWatchTable : public wxGridTableBase
|
||||
{
|
||||
enum
|
||||
{
|
||||
MAX_SPECIALS = 256,
|
||||
};
|
||||
|
||||
public:
|
||||
CWatchTable()
|
||||
{
|
||||
}
|
||||
|
||||
int GetNumberCols() override { return 5; }
|
||||
int GetNumberRows() override { return MAX_SPECIALS; }
|
||||
wxString GetValue(int row, int col) override;
|
||||
void SetValue(int row, int col, const wxString&) override;
|
||||
wxGridCellAttr* GetAttr(int, int, wxGridCellAttr::wxAttrKind) override;
|
||||
void UpdateWatch();
|
||||
|
||||
private:
|
||||
std::array<u32, MAX_SPECIALS> m_CachedWatch;
|
||||
std::array<bool, MAX_SPECIALS> m_CachedWatchHasChanged;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(CWatchTable);
|
||||
};
|
||||
|
||||
class CWatchView : public wxGrid
|
||||
{
|
||||
public:
|
||||
CWatchView(wxWindow* parent, wxWindowID id);
|
||||
void Update() override;
|
||||
void OnMouseDownR(wxGridEvent& event);
|
||||
void OnPopupMenu(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
u32 m_selectedAddress = 0;
|
||||
u32 m_selectedRow = 0;
|
||||
};
|
137
Source/Core/DolphinWX/Debugger/WatchWindow.cpp
Normal file
137
Source/Core/DolphinWX/Debugger/WatchWindow.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/windowid.h>
|
||||
#include <wx/aui/auibar.h>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "DolphinWX/Debugger/WatchView.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
extern "C" {
|
||||
#include "DolphinWX/resources/toolbar_debugger_delete.c"
|
||||
}
|
||||
|
||||
class wxWindow;
|
||||
|
||||
BEGIN_EVENT_TABLE(CWatchWindow, wxPanel)
|
||||
EVT_GRID_CELL_RIGHT_CLICK(CWatchView::OnMouseDownR)
|
||||
EVT_MENU(-1, CWatchView::OnPopupMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
class CWatchToolbar : public wxAuiToolBar
|
||||
{
|
||||
public:
|
||||
CWatchToolbar(CWatchWindow* parent, const wxWindowID id)
|
||||
: wxAuiToolBar(parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT)
|
||||
{
|
||||
SetToolBitmapSize(wxSize(16, 16));
|
||||
|
||||
m_Bitmaps[Toolbar_File] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(16, 16));
|
||||
|
||||
AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_File]);
|
||||
Bind(wxEVT_TOOL, &CWatchWindow::Event_LoadAll, parent, ID_LOAD);
|
||||
|
||||
AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_File]);
|
||||
Bind(wxEVT_TOOL, &CWatchWindow::Event_SaveAll, parent, ID_SAVE);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
Toolbar_File,
|
||||
Num_Bitmaps
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ID_LOAD,
|
||||
ID_SAVE
|
||||
};
|
||||
|
||||
wxBitmap m_Bitmaps[Num_Bitmaps];
|
||||
};
|
||||
|
||||
CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& position, const wxSize& size,
|
||||
long style, const wxString& name)
|
||||
: wxPanel(parent, id, position, size, style, name)
|
||||
, m_GPRGridView(nullptr)
|
||||
{
|
||||
m_mgr.SetManagedWindow(this);
|
||||
m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
|
||||
|
||||
wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL);
|
||||
m_GPRGridView = new CWatchView(this, ID_GPR);
|
||||
sGrid->Add(m_GPRGridView, 1, wxGROW);
|
||||
SetSizer(sGrid);
|
||||
|
||||
m_mgr.AddPane(new CWatchToolbar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top().
|
||||
LeftDockable(true).RightDockable(true).BottomDockable(false).Floatable(false));
|
||||
m_mgr.AddPane(m_GPRGridView, wxAuiPaneInfo().CenterPane());
|
||||
m_mgr.Update();
|
||||
}
|
||||
|
||||
CWatchWindow::~CWatchWindow()
|
||||
{
|
||||
m_mgr.UnInit();
|
||||
}
|
||||
|
||||
void CWatchWindow::NotifyUpdate()
|
||||
{
|
||||
if (m_GPRGridView != nullptr)
|
||||
m_GPRGridView->Update();
|
||||
}
|
||||
|
||||
void CWatchWindow::Event_SaveAll(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
SaveAll();
|
||||
}
|
||||
|
||||
void CWatchWindow::SaveAll()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false);
|
||||
ini.SetLines("Watches", PowerPC::watches.GetStrings());
|
||||
ini.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini");
|
||||
}
|
||||
|
||||
void CWatchWindow::Event_LoadAll(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
LoadAll();
|
||||
}
|
||||
|
||||
void CWatchWindow::LoadAll()
|
||||
{
|
||||
IniFile ini;
|
||||
Watches::TWatchesStr watches;
|
||||
|
||||
if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ini.GetLines("Watches", &watches, false))
|
||||
{
|
||||
PowerPC::watches.Clear();
|
||||
PowerPC::watches.AddFromStrings(watches);
|
||||
}
|
||||
|
||||
NotifyUpdate();
|
||||
}
|
49
Source/Core/DolphinWX/Debugger/WatchWindow.h
Normal file
49
Source/Core/DolphinWX/Debugger/WatchWindow.h
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/translation.h>
|
||||
#include <wx/windowid.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
|
||||
class CWatchView;
|
||||
class wxWindow;
|
||||
|
||||
class CWatchWindow
|
||||
: public wxPanel
|
||||
{
|
||||
public:
|
||||
CWatchWindow(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = _("Watch"));
|
||||
~CWatchWindow();
|
||||
|
||||
void NotifyUpdate();
|
||||
void Event_SaveAll(wxCommandEvent& WXUNUSED(event));
|
||||
void SaveAll();
|
||||
void Event_LoadAll(wxCommandEvent& WXUNUSED(event));
|
||||
void LoadAll();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxAuiManager m_mgr;
|
||||
|
||||
enum
|
||||
{
|
||||
ID_GPR = 1002
|
||||
};
|
||||
|
||||
CWatchView* m_GPRGridView;
|
||||
void CreateGUIControls();
|
||||
};
|
@ -71,6 +71,8 @@
|
||||
<ClCompile Include="Debugger\MemoryWindow.cpp" />
|
||||
<ClCompile Include="Debugger\RegisterView.cpp" />
|
||||
<ClCompile Include="Debugger\RegisterWindow.cpp" />
|
||||
<ClCompile Include="Debugger\WatchView.cpp" />
|
||||
<ClCompile Include="Debugger\WatchWindow.cpp" />
|
||||
<ClCompile Include="FifoPlayerDlg.cpp" />
|
||||
<ClCompile Include="Frame.cpp" />
|
||||
<ClCompile Include="FrameAui.cpp" />
|
||||
@ -124,6 +126,8 @@
|
||||
<ClInclude Include="Debugger\MemoryWindow.h" />
|
||||
<ClInclude Include="Debugger\RegisterView.h" />
|
||||
<ClInclude Include="Debugger\RegisterWindow.h" />
|
||||
<ClInclude Include="Debugger\WatchView.h" />
|
||||
<ClInclude Include="Debugger\WatchWindow.h" />
|
||||
<ClInclude Include="FifoPlayerDlg.h" />
|
||||
<ClInclude Include="Frame.h" />
|
||||
<ClInclude Include="GameListCtrl.h" />
|
||||
|
@ -90,6 +90,12 @@
|
||||
<ClCompile Include="Debugger\RegisterWindow.cpp">
|
||||
<Filter>GUI\Debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Debugger\WatchView.cpp">
|
||||
<Filter>GUI\Debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Debugger\WatchWindow.cpp">
|
||||
<Filter>GUI\Debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputConfigDiag.cpp">
|
||||
<Filter>GUI\InputConfig</Filter>
|
||||
</ClCompile>
|
||||
@ -222,6 +228,12 @@
|
||||
<ClInclude Include="Debugger\RegisterWindow.h">
|
||||
<Filter>GUI\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Debugger\WatchView.h">
|
||||
<Filter>GUI\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Debugger\WatchWindow.h">
|
||||
<Filter>GUI\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="InputConfigDiag.h">
|
||||
<Filter>GUI\InputConfig</Filter>
|
||||
</ClInclude>
|
||||
@ -303,4 +315,4 @@
|
||||
<ItemGroup>
|
||||
<Image Include="$(CoreDir)..\..\Installer\Dolphin.ico" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -179,6 +179,9 @@ void CFrame::OnToggleWindow(wxCommandEvent& event)
|
||||
case IDM_REGISTERWINDOW:
|
||||
g_pCodeWindow->ToggleRegisterWindow(bShow);
|
||||
break;
|
||||
case IDM_WATCHWINDOW:
|
||||
g_pCodeWindow->ToggleWatchWindow(bShow);
|
||||
break;
|
||||
case IDM_BREAKPOINTWINDOW:
|
||||
g_pCodeWindow->ToggleBreakPointWindow(bShow);
|
||||
break;
|
||||
@ -208,6 +211,7 @@ void CFrame::ClosePages()
|
||||
{
|
||||
g_pCodeWindow->ToggleCodeWindow(false);
|
||||
g_pCodeWindow->ToggleRegisterWindow(false);
|
||||
g_pCodeWindow->ToggleWatchWindow(false);
|
||||
g_pCodeWindow->ToggleBreakPointWindow(false);
|
||||
g_pCodeWindow->ToggleMemoryWindow(false);
|
||||
g_pCodeWindow->ToggleJitWindow(false);
|
||||
@ -247,6 +251,8 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
|
||||
ToggleLogConfigWindow(false);
|
||||
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_REGISTERWINDOW)
|
||||
g_pCodeWindow->ToggleRegisterWindow(false);
|
||||
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_WATCHWINDOW)
|
||||
g_pCodeWindow->ToggleWatchWindow(false);
|
||||
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_BREAKPOINTWINDOW)
|
||||
g_pCodeWindow->ToggleBreakPointWindow(false);
|
||||
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_JITWINDOW)
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||
|
||||
#include "DiscIO/NANDContentLoader.h"
|
||||
|
||||
@ -78,7 +79,9 @@
|
||||
#include "DolphinWX/WXInputBase.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "DolphinWX/Cheats/CheatsWindow.h"
|
||||
#include "DolphinWX/Debugger/BreakpointWindow.h"
|
||||
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
@ -285,6 +288,7 @@ wxMenuBar* CFrame::CreateMenu()
|
||||
|
||||
const wxString MenuText[] = {
|
||||
wxTRANSLATE("&Registers"),
|
||||
wxTRANSLATE("&Watch"),
|
||||
wxTRANSLATE("&Breakpoints"),
|
||||
wxTRANSLATE("&Memory"),
|
||||
wxTRANSLATE("&JIT"),
|
||||
@ -655,7 +659,16 @@ void CFrame::BootGame(const std::string& filename)
|
||||
}
|
||||
}
|
||||
if (!bootfile.empty())
|
||||
{
|
||||
StartGame(bootfile);
|
||||
if (UseDebugger && g_pCodeWindow)
|
||||
{
|
||||
if (g_pCodeWindow->m_WatchWindow)
|
||||
g_pCodeWindow->m_WatchWindow->LoadAll();
|
||||
if (g_pCodeWindow->m_BreakpointWindow)
|
||||
g_pCodeWindow->m_BreakpointWindow->LoadAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Open file to boot
|
||||
@ -1162,6 +1175,24 @@ void CFrame::DoStop()
|
||||
}
|
||||
}
|
||||
|
||||
if (UseDebugger && g_pCodeWindow)
|
||||
{
|
||||
if (g_pCodeWindow->m_WatchWindow)
|
||||
{
|
||||
g_pCodeWindow->m_WatchWindow->SaveAll();
|
||||
PowerPC::watches.Clear();
|
||||
}
|
||||
if (g_pCodeWindow->m_BreakpointWindow)
|
||||
{
|
||||
g_pCodeWindow->m_BreakpointWindow->SaveAll();
|
||||
PowerPC::breakpoints.Clear();
|
||||
PowerPC::memchecks.Clear();
|
||||
g_pCodeWindow->m_BreakpointWindow->NotifyUpdate();
|
||||
}
|
||||
g_symbolDB.Clear();
|
||||
Host_NotifyMapLoaded();
|
||||
}
|
||||
|
||||
// TODO: Show the author/description dialog here
|
||||
if (Movie::IsRecordingInput())
|
||||
DoRecordingSave();
|
||||
|
@ -14,6 +14,7 @@ enum
|
||||
{
|
||||
Toolbar_Step,
|
||||
Toolbar_StepOver,
|
||||
Toolbar_StepOut,
|
||||
Toolbar_Skip,
|
||||
Toolbar_GotoPC,
|
||||
Toolbar_SetPC,
|
||||
@ -149,6 +150,7 @@ enum
|
||||
IDM_LOGWINDOW,
|
||||
IDM_LOGCONFIGWINDOW,
|
||||
IDM_REGISTERWINDOW,
|
||||
IDM_WATCHWINDOW,
|
||||
IDM_BREAKPOINTWINDOW,
|
||||
IDM_MEMORYWINDOW,
|
||||
IDM_JITWINDOW,
|
||||
@ -230,6 +232,7 @@ enum
|
||||
ID_TOOLBAR_DEBUG,
|
||||
IDM_STEP,
|
||||
IDM_STEPOVER,
|
||||
IDM_STEPOUT,
|
||||
IDM_TOGGLE_BREAKPOINT,
|
||||
IDM_SKIP,
|
||||
IDM_SETPC,
|
||||
|
Reference in New Issue
Block a user