From 208ecd698ef073b772750f88e3c11f7badaec215 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 8 Aug 2010 06:00:22 +0000 Subject: 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 --- Source/Core/DebuggerWX/Src/CodeWindow.cpp | 73 ++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 12 deletions(-) (limited to 'Source/Core/DebuggerWX/Src/CodeWindow.cpp') 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); } -- cgit v1.2.3