summaryrefslogtreecommitdiff
path: root/Source/Core/DebuggerWX/Src/CodeWindow.cpp
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2010-08-08 06:00:22 +0000
committerskidau <skidau@gmail.com>2010-08-08 06:00:22 +0000
commit208ecd698ef073b772750f88e3c11f7badaec215 (patch)
tree739505d3b4dd2bc6848d0f08c30b0e0865da75c0 /Source/Core/DebuggerWX/Src/CodeWindow.cpp
parent7b8863dc9c50c2c0d45070a1519bacc287d27113 (diff)
Debugger enhancements:
* Added working Step Over function. * Added hard-coded hotkeys for step into (F11), step over (F10) and toggle breakpoint (F9). The hotkeys are only active when the debugger is enabled. They function as before when the debugger is disabled. * Added Debug menu item. * Removed obsolete NotifyBreakpoint function from JIT and JITIL. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6069 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DebuggerWX/Src/CodeWindow.cpp')
-rw-r--r--Source/Core/DebuggerWX/Src/CodeWindow.cpp73
1 files changed, 61 insertions, 12 deletions
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index 17e6d98f82..877dd8d476 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -116,6 +116,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
// Toolbar
EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep)
+ EVT_MENU(IDM_TOGGLE_BREAKPOINT, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_SKIP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
@@ -167,9 +168,10 @@ wxAuiToolBar *CCodeWindow::GetToolBar()
void CCodeWindow::OnKeyDown(wxKeyEvent& event)
{
- event.Skip();
-
- if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive()) SingleCPUStep();
+ if (event.GetKeyCode() == WXK_SPACE && event.GetModifiers() == wxMOD_NONE)
+ SingleStep();
+ else
+ event.Skip();
}
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
@@ -199,13 +201,17 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
switch (event.GetId())
{
case IDM_STEP:
- SingleCPUStep();
+ SingleStep();
break;
case IDM_STEPOVER:
- CCPU::EnableStepping(true); // TODO: Huh?
+ StepOver();
break;
+ case IDM_TOGGLE_BREAKPOINT:
+ ToggleBreakpoint();
+ break;
+
case IDM_SKIP:
PC += 4;
Update();
@@ -289,14 +295,47 @@ void CCodeWindow::OnCallsListChange(wxCommandEvent& event)
}
}
-void CCodeWindow::SingleCPUStep()
+void CCodeWindow::SingleStep()
{
- CCPU::StepOpcode(&sync_event);
- wxThread::Sleep(20);
- // need a short wait here
- JumpToAddress(PC);
- Update();
- Host_UpdateLogDisplay();
+ if (CCPU::IsStepping())
+ {
+ CCPU::StepOpcode(&sync_event);
+ wxThread::Sleep(20);
+ // need a short wait here
+ JumpToAddress(PC);
+ Update();
+ Host_UpdateLogDisplay();
+ }
+}
+
+void CCodeWindow::StepOver()
+{
+ if (CCPU::IsStepping())
+ {
+ UGeckoInstruction inst = Memory::Read_Instruction(PC);
+ if (inst.LK)
+ {
+ PowerPC::breakpoints.Add(PC + 4, true);
+ CCPU::EnableStepping(false);
+ JumpToAddress(PC);
+ Update();
+ }
+ else
+ SingleStep();
+
+ UpdateButtonStates();
+ // Update all toolbars in the aui manager
+ Parent->UpdateGUI();
+ }
+}
+
+void CCodeWindow::ToggleBreakpoint()
+{
+ if (CCPU::IsStepping())
+ {
+ if (codeview) codeview->ToggleBreakpoint(codeview->GetSelection());
+ Update();
+ }
}
void CCodeWindow::UpdateLists()
@@ -439,6 +478,16 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pMenuBar->Append(pCoreMenu, _T("&JIT"));
+
+ // Debug Menu
+ wxMenu* pDebugMenu = new wxMenu;
+
+ wxMenuItem* stepinto = pDebugMenu->Append(IDM_STEP, _T("Step &Into\tF11"));
+ wxMenuItem* stepover = pDebugMenu->Append(IDM_STEPOVER, _T("Step &Over\tF10"));
+ wxMenuItem* togglebreakpoint = pDebugMenu->Append(IDM_TOGGLE_BREAKPOINT, _T("Toggle &Breakpoint\tF9"));
+
+ pMenuBar->Append(pDebugMenu, _T("&Debug"));
+
CreateMenuSymbols(pMenuBar);
}