Debugger::Debugger(QWidget *parent) : QMainWindow( parent ) , ui(new Ui::Debugger) , m_pItemAtPc( 0 ) , m_autoStepping( false ) { ui->setupUi(this); connect( ui->tableWidgetCode, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(setBreakpoint(int, int)) ); connect( ui->actionStep_Into, SIGNAL(triggered()), this, SIGNAL(stepInto()) ); connect( ui->actionStep_Over, SIGNAL(triggered()), this, SIGNAL(stepOver()) ); connect( ui->actionStep_Skip, SIGNAL(triggered()), this, SIGNAL(stepSkip()) ); connect( ui->actionContinue, SIGNAL(triggered()), this, SLOT(setupExecution()) ); connect( ui->radioButtonP, SIGNAL(clicked()), this, SLOT(updateP()) ); connect( ui->radioButtonX, SIGNAL(clicked()), this, SLOT(updateX()) ); connect( ui->radioButtonY, SIGNAL(clicked()), this, SLOT(updateY()) ); connect( ui->radioButtonL, SIGNAL(clicked()), this, SLOT(updateL()) ); connect( ui->lineEditX0, SIGNAL(editingFinished()), this, SLOT(setRegisterX0()) ); connect( ui->lineEditX1, SIGNAL(editingFinished()), this, SLOT(setRegisterX1()) ); connect( ui->lineEditY0, SIGNAL(editingFinished()), this, SLOT(setRegisterY0()) ); connect( ui->lineEditY1, SIGNAL(editingFinished()), this, SLOT(setRegisterY1()) ); connect( ui->lineEditA0, SIGNAL(editingFinished()), this, SLOT(setRegisterA0()) ); connect( ui->lineEditA1, SIGNAL(editingFinished()), this, SLOT(setRegisterA1()) ); connect( ui->lineEditA2, SIGNAL(editingFinished()), this, SLOT(setRegisterA2()) ); connect( ui->lineEditB0, SIGNAL(editingFinished()), this, SLOT(setRegisterB0()) ); connect( ui->lineEditB1, SIGNAL(editingFinished()), this, SLOT(setRegisterB1()) ); connect( ui->lineEditB2, SIGNAL(editingFinished()), this, SLOT(setRegisterB2()) ); connect( ui->lineEditR0, SIGNAL(editingFinished()), this, SLOT(setRegisterR0()) ); connect( ui->lineEditR1, SIGNAL(editingFinished()), this, SLOT(setRegisterR1()) ); connect( ui->lineEditR2, SIGNAL(editingFinished()), this, SLOT(setRegisterR2()) ); connect( ui->lineEditR3, SIGNAL(editingFinished()), this, SLOT(setRegisterR3()) ); connect( ui->lineEditR4, SIGNAL(editingFinished()), this, SLOT(setRegisterR4()) ); connect( ui->lineEditR5, SIGNAL(editingFinished()), this, SLOT(setRegisterR5()) ); connect( ui->lineEditR6, SIGNAL(editingFinished()), this, SLOT(setRegisterR6()) ); connect( ui->lineEditR7, SIGNAL(editingFinished()), this, SLOT(setRegisterR7()) ); connect( ui->lineEditN0, SIGNAL(editingFinished()), this, SLOT(setRegisterN0()) ); connect( ui->lineEditN1, SIGNAL(editingFinished()), this, SLOT(setRegisterN1()) ); connect( ui->lineEditN2, SIGNAL(editingFinished()), this, SLOT(setRegisterN2()) ); connect( ui->lineEditN3, SIGNAL(editingFinished()), this, SLOT(setRegisterN3()) ); connect( ui->lineEditN4, SIGNAL(editingFinished()), this, SLOT(setRegisterN4()) ); connect( ui->lineEditN5, SIGNAL(editingFinished()), this, SLOT(setRegisterN5()) ); connect( ui->lineEditN6, SIGNAL(editingFinished()), this, SLOT(setRegisterN6()) ); connect( ui->lineEditN7, SIGNAL(editingFinished()), this, SLOT(setRegisterN7()) ); connect( ui->lineEditM0, SIGNAL(editingFinished()), this, SLOT(setRegisterM0()) ); connect( ui->lineEditM1, SIGNAL(editingFinished()), this, SLOT(setRegisterM1()) ); connect( ui->lineEditM2, SIGNAL(editingFinished()), this, SLOT(setRegisterM2()) ); connect( ui->lineEditM3, SIGNAL(editingFinished()), this, SLOT(setRegisterM3()) ); connect( ui->lineEditM4, SIGNAL(editingFinished()), this, SLOT(setRegisterM4()) ); connect( ui->lineEditM5, SIGNAL(editingFinished()), this, SLOT(setRegisterM5()) ); connect( ui->lineEditM6, SIGNAL(editingFinished()), this, SLOT(setRegisterM6()) ); connect( ui->lineEditM7, SIGNAL(editingFinished()), this, SLOT(setRegisterM7()) ); connect( ui->lineEditSR, SIGNAL(editingFinished()), this, SLOT(setRegisterSR()) ); connect( ui->lineEditPC, SIGNAL(editingFinished()), this, SLOT(setRegisterPC()) ); connect( ui->lineEditLC, SIGNAL(editingFinished()), this, SLOT(setRegisterLC()) ); }
void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt) { wxEventType type = evt.GetEventType(); if (type == debEVT_SETSTATUSBARTEXT) { CtrlDisassemblyView* view = reinterpret_cast<CtrlDisassemblyView*>(evt.GetEventObject()); if (view != NULL && view == currentCpu->getDisassembly()) GetStatusBar()->SetLabel(evt.GetString()); } else if (type == debEVT_UPDATELAYOUT) { if (currentCpu != NULL) currentCpu->GetSizer()->Layout(); topSizer->Layout(); update(); } else if (type == debEVT_GOTOINMEMORYVIEW) { if (currentCpu != NULL) { currentCpu->showMemoryView(); currentCpu->getMemoryView()->gotoAddress(evt.GetInt()); currentCpu->getDisassembly()->SetFocus(); } } else if (type == debEVT_RUNTOPOS) { // todo: breakpoints for iop if (currentCpu != eeTab) return; CBreakPoints::AddBreakPoint(evt.GetInt(),true); currentCpu->getCpu()->resumeCpu(); } else if (type == debEVT_GOTOINDISASM) { if (currentCpu != NULL) { currentCpu->getDisassembly()->gotoAddress(r5900Debug.getPC()); currentCpu->getDisassembly()->SetFocus(); update(); } } else if (type == debEVT_STEPOVER) { if (currentCpu != NULL) stepOver(); } else if (type == debEVT_STEPINTO) { if (currentCpu != NULL) stepInto(); } else if (type == debEVT_UPDATE) { update(); } }
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { //if (!m_hDlg) return FALSE; switch(message) { case WM_INITDIALOG: { return TRUE; } break; case WM_NOTIFY: switch (wParam) { case IDC_LEFTTABS: leftTabs->HandleNotify(lParam); break; case IDC_BREAKPOINTLIST: breakpointList->HandleNotify(lParam); break; case IDC_THREADLIST: threadList->HandleNotify(lParam); break; case IDC_STACKFRAMES: stackTraceView->HandleNotify(lParam); break; case IDC_MODULELIST: moduleList->HandleNotify(lParam); break; case IDC_DEBUG_BOTTOMTABS: bottomTabs->HandleNotify(lParam); break; } break; case WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case ID_TOGGLE_PAUSE: SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0); break; case ID_DEBUG_DISPLAYMEMVIEW: bottomTabs->ShowTab(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); break; case ID_DEBUG_DISPLAYBREAKPOINTLIST: bottomTabs->ShowTab(breakpointList->GetHandle()); break; case ID_DEBUG_DISPLAYTHREADLIST: bottomTabs->ShowTab(threadList->GetHandle()); break; case ID_DEBUG_DISPLAYSTACKFRAMELIST: bottomTabs->ShowTab(stackTraceView->GetHandle()); break; case ID_DEBUG_DSIPLAYREGISTERLIST: leftTabs->ShowTab(0); break; case ID_DEBUG_DSIPLAYFUNCTIONLIST: leftTabs->ShowTab(1); break; case ID_DEBUG_ADDBREAKPOINT: { keepStatusBarText = true; bool isRunning = Core_IsActive(); if (isRunning) { SetDebugMode(true, false); Core_EnableStepping(true); Core_WaitInactive(200); } BreakpointWindow bpw(m_hDlg,cpu); if (bpw.exec()) bpw.addBreakpoint(); if (isRunning) { SetDebugMode(false, false); Core_EnableStepping(false); } keepStatusBarText = false; } break; case ID_DEBUG_STEPOVER: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver(); break; case ID_DEBUG_STEPINTO: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto(); break; case ID_DEBUG_RUNTOLINE: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine(); break; case ID_DEBUG_STEPOUT: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut(); break; case ID_DEBUG_HIDEBOTTOMTABS: { RECT rect; hideBottomTabs = !hideBottomTabs; GetClientRect(m_hDlg,&rect); UpdateSize(rect.right-rect.left,rect.bottom-rect.top); } break; case ID_DEBUG_TOGGLEBOTTOMTABTITLES: bottomTabs->SetShowTabTitles(!bottomTabs->GetShowTabTitles()); break; case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: { HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ListBox_GetCurSel(lb); if (n!=-1) { unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GOTOINT: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ComboBox_GetCurSel(lb); unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); if (addr != 0xFFFFFFFF) { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_STOPGO: { if (!PSP_IsInited()) { break; } if (!Core_IsStepping()) // stop { ptr->setDontRedraw(false); SetDebugMode(true, true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } else { // go lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); SetDebugMode(false, true); Core_EnableStepping(false); } } break; case IDC_STEP: stepInto(); break; case IDC_STEPOVER: stepOver(); break; case IDC_STEPOUT: stepOut(); break; case IDC_STEPHLE: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); hleDebugBreak(); SetDebugMode(false, true); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_MEMCHECK: SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0); break; case IDC_GOTOPC: { ptr->gotoPC(); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } break; case IDC_ALLFUNCTIONS: { symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); break; } default: return FALSE; } return TRUE; } case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->gotoAddr(wParam); SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); break; } case WM_DEB_GOTOADDRESSEDIT: { if (!PSP_IsInited()) { break; } wchar_t szBuffer[256]; CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256); u32 addr; if (parseExpression(ConvertWStringToUTF8(szBuffer).c_str(),cpu,addr) == false) { displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS)); } else { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } UpdateDialog(); } break; case WM_DEB_SETDEBUGLPARAM: SetDebugMode(lParam != 0, true); return TRUE; case WM_DEB_UPDATE: Update(); return TRUE; case WM_DEB_TABPRESSED: bottomTabs->NextTab(true); SetFocus(bottomTabs->CurrentTabHandle()); break; case WM_DEB_SETSTATUSBARTEXT: if (!keepStatusBarText) SetWindowText(statusBarWnd, ConvertUTF8ToWString((const char *)lParam).c_str()); break; case WM_DEB_GOTOHEXEDIT: { CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); memory->gotoAddr(wParam); // display the memory viewer too bottomTabs->ShowTab(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); } break; case WM_SIZE: { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SendMessage(statusBarWnd,WM_SIZE,0,10); SavePosition(); return TRUE; } case WM_MOVE: SavePosition(); break; case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; // Reduce the minimum size slightly, so they can size it however they like. m->ptMinTrackSize.x = minWidth; //m->ptMaxTrackSize.x = m->ptMinTrackSize.x; m->ptMinTrackSize.y = minHeight; } return TRUE; case WM_CLOSE: Show(false); return TRUE; case WM_ACTIVATE: if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) { g_activeWindow = WINDOW_CPUDEBUGGER; } break; } return FALSE; }
void DebugCLI::enterDebugger() { setCurrentSource( (core->callStack) ? (core->callStack->filename()) : 0 ); if (currentSource == NULL) { stepInto(); return; } for (;;) { printIP(); core->console << "(asdb) "; fflush(stdout); fgets(commandLine, kMaxCommandLine, stdin); commandLine[strlen(commandLine)-1] = 0; if (!commandLine[0]) { strcpy(commandLine, lastCommand); } else { strcpy(lastCommand, commandLine); } currentToken = commandLine; char *command = nextToken(); int cmd = commandFor(command); switch (cmd) { case -1: // ambiguous, we already printed error message break; case CMD_INFO: info(); break; case CMD_BREAK: breakpoint(nextToken()); break; case CMD_DELETE: deleteBreakpoint(nextToken()); break; case CMD_LIST: list(nextToken()); break; case CMD_UNKNOWN: core->console << "Unknown command.\n"; break; case CMD_QUIT: exit(0); break; case CMD_CONTINUE: return; case CMD_PRINT: print(nextToken()); break; case CMD_NEXT: stepOver(); return; case INFO_STACK_CMD: bt(); break; case CMD_FINISH: stepOut(); return; case CMD_STEP: stepInto(); return; case CMD_SET: set(); break; default: core->console << "Command not implemented.\n"; break; } } }
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { //if (!m_hDlg) return FALSE; switch(message) { case WM_INITDIALOG: { return TRUE; } break; case WM_TIMER: { int iPage = TabCtrl_GetCurSel (GetDlgItem(m_hDlg, IDC_LEFTTABS)); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), iPage?SW_HIDE:SW_NORMAL); } break; case WM_NOTIFY: switch (wParam) { case IDC_LEFTTABS: { HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS); NMHDR* pNotifyMessage = NULL; pNotifyMessage = (LPNMHDR)lParam; if (pNotifyMessage->hwndFrom == tabs) { int iPage = TabCtrl_GetCurSel (tabs); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), iPage?SW_HIDE:SW_NORMAL); } } break; case IDC_BREAKPOINTLIST: breakpointList->handleNotify(lParam); break; case IDC_THREADLIST: threadList->handleNotify(lParam); break; case IDC_STACKFRAMES: stackTraceView->handleNotify(lParam); break; } break; case WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case ID_TOGGLE_PAUSE: SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0); break; case ID_DEBUG_DISPLAYMEMVIEW: changeSubWindow(SUBWIN_MEM); break; case ID_DEBUG_DISPLAYBREAKPOINTLIST: changeSubWindow(SUBWIN_BREAKPOINT); break; case ID_DEBUG_DISPLAYTHREADLIST: changeSubWindow(SUBWIN_THREADS); break; case ID_DEBUG_DISPLAYSTACKFRAMELIST: changeSubWindow(SUBWIN_STACKFRAMES); break; case ID_DEBUG_ADDBREAKPOINT: { bool isRunning = Core_IsActive(); if (isRunning) { SetDebugMode(true); Core_EnableStepping(true); Core_WaitInactive(200); } BreakpointWindow bpw(m_hDlg,cpu); if (bpw.exec()) bpw.addBreakpoint(); if (isRunning) { SetDebugMode(false); Core_EnableStepping(false); } } break; case ID_DEBUG_STEPOVER: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver(); break; case ID_DEBUG_STEPINTO: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto(); break; case ID_DEBUG_RUNTOLINE: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine(); break; case ID_DEBUG_STEPOUT: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut(); break; case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: { HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ListBox_GetCurSel(lb); if (n!=-1) { unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GOTOINT: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ComboBox_GetCurSel(lb); unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); if (addr != 0xFFFFFFFF) { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_STOPGO: { if (!Core_IsStepping()) // stop { ptr->setDontRedraw(false); SetDebugMode(true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } else { // go lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); SetDebugMode(false); Core_EnableStepping(false); } } break; case IDC_STEP: stepInto(); break; case IDC_STEPOVER: stepOver(); break; case IDC_STEPOUT: stepOut(); break; case IDC_STEPHLE: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); hleDebugBreak(); SetDebugMode(false); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_MEMCHECK: SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0); break; case IDC_UPDATECALLSTACK: { HWND hDlg = m_hDlg; HWND list = GetDlgItem(hDlg,IDC_CALLSTACK); ComboBox_ResetContent(list); u32 pc = currentMIPS->pc; u32 ra = currentMIPS->r[MIPS_REG_RA]; DWORD addr = Memory::ReadUnchecked_U32(pc); int count=1; ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(pc)),pc); if (symbolMap.GetDescription(pc) != symbolMap.GetDescription(ra)) { ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(ra)),ra); count++; } //walk the stack chain while (addr != 0xFFFFFFFF && addr!=0 && count++<20) { DWORD fun = Memory::ReadUnchecked_U32(addr+4); const char *str = symbolMap.GetDescription(fun); if (strlen(str)==0) str = "(unknown)"; ComboBox_SetItemData(list, ComboBox_AddString(list,str), fun); addr = Memory::ReadUnchecked_U32(addr); } ComboBox_SetCurSel(list,0); } break; case IDC_GOTOPC: { ptr->gotoPC(); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } break; case IDC_BACKWARDLINKS: { HWND box = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); int funcnum = symbolMap.GetSymbolNum(ListBox_GetItemData(box,ListBox_GetCurSel(box))); if (funcnum!=-1) symbolMap.FillListBoxBLinks(box,funcnum); break; } case IDC_ALLFUNCTIONS: { symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); break; } default: return FALSE; } return TRUE; } case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->gotoAddr(wParam); SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); break; } case WM_DEB_GOTOADDRESSEDIT: { char szBuffer[256]; CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256); u32 addr; if (parseExpression(szBuffer,cpu,addr) == false) { displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS)); } else { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } UpdateDialog(); } break; case WM_DEB_SETDEBUGLPARAM: SetDebugMode(lParam != 0); return TRUE; case WM_DEB_UPDATE: Update(); return TRUE; case WM_DEB_TABPRESSED: changeSubWindow(SUBWIN_NEXT); break; case WM_DEB_SETSTATUSBARTEXT: SendMessage(statusBarWnd,WM_SETTEXT,0,lParam); break; case WM_DEB_GOTOHEXEDIT: { CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); memory->gotoAddr(wParam); // display the memory viewer too HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST); HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW); HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST); ShowWindow(bp,SW_HIDE); ShowWindow(mem,SW_NORMAL); ShowWindow(threads,SW_HIDE); } break; case WM_SIZE: { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SendMessage(statusBarWnd,WM_SIZE,0,10); SavePosition(); return TRUE; } case WM_MOVE: SavePosition(); break; case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; // Reduce the minimum size slightly, so they can size it however they like. m->ptMinTrackSize.x = defaultRect.right - defaultRect.left - 100; //m->ptMaxTrackSize.x = m->ptMinTrackSize.x; m->ptMinTrackSize.y = defaultRect.bottom - defaultRect.top - 200; } return TRUE; case WM_CLOSE: Show(false); return TRUE; case WM_ACTIVATE: if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) { g_debuggerActive = true; } else { g_debuggerActive = false; } break; } return FALSE; }
void DisassemblyDialog::onStepIntoClicked(wxCommandEvent& evt) { stepInto(); }
void Debugger::setupExecution() { emit stepInto(); m_autoStepping = true; }
void Debugger::updateData( const dsp_core_t* pCore ) { int regs = sizeof( pCore->registers ) / sizeof( pCore->registers[0] ); for( int i = 0; i < regs; ++i ) { QString str = QString::number( pCore->registers[i], 16 ); int justify; if( i == DSP_REG_X0 || i == DSP_REG_X1 || i == DSP_REG_Y0 || i == DSP_REG_Y1 || i == DSP_REG_A0 || i == DSP_REG_B0 || i == DSP_REG_A1 || i == DSP_REG_B1 ) { justify = 6; } else if( i == DSP_REG_A2 || i == DSP_REG_B2 ) { justify = 2; } else { justify = 4; } str = str.rightJustified( justify, '0' ).toUpper(); switch( i ) { case DSP_REG_X0: ui->lineEditX0->setText( str ); break; case DSP_REG_X1: ui->lineEditX1->setText( str ); break; case DSP_REG_Y0: ui->lineEditY0->setText( str ); break; case DSP_REG_Y1: ui->lineEditY1->setText( str ); break; case DSP_REG_A0: ui->lineEditA0->setText( str ); break; case DSP_REG_B0: ui->lineEditB0->setText( str ); break; case DSP_REG_A2: ui->lineEditA2->setText( str ); break; case DSP_REG_B2: ui->lineEditB2->setText( str ); break; case DSP_REG_A1: ui->lineEditA1->setText( str ); break; case DSP_REG_B1: ui->lineEditB1->setText( str ); break; case DSP_REG_R0: ui->lineEditR0->setText( str ); break; case DSP_REG_R1: ui->lineEditR1->setText( str ); break; case DSP_REG_R2: ui->lineEditR2->setText( str ); break; case DSP_REG_R3: ui->lineEditR3->setText( str ); break; case DSP_REG_R4: ui->lineEditR4->setText( str ); break; case DSP_REG_R5: ui->lineEditR5->setText( str ); break; case DSP_REG_R6: ui->lineEditR6->setText( str ); break; case DSP_REG_R7: ui->lineEditR7->setText( str ); break; case DSP_REG_N0: ui->lineEditN0->setText( str ); break; case DSP_REG_N1: ui->lineEditN1->setText( str ); break; case DSP_REG_N2: ui->lineEditN2->setText( str ); break; case DSP_REG_N3: ui->lineEditN3->setText( str ); break; case DSP_REG_N4: ui->lineEditN4->setText( str ); break; case DSP_REG_N5: ui->lineEditN5->setText( str ); break; case DSP_REG_N6: ui->lineEditN6->setText( str ); break; case DSP_REG_N7: ui->lineEditN7->setText( str ); break; case DSP_REG_M0: ui->lineEditM0->setText( str ); break; case DSP_REG_M1: ui->lineEditM1->setText( str ); break; case DSP_REG_M2: ui->lineEditM2->setText( str ); break; case DSP_REG_M3: ui->lineEditM3->setText( str ); break; case DSP_REG_M4: ui->lineEditM4->setText( str ); break; case DSP_REG_M5: ui->lineEditM5->setText( str ); break; case DSP_REG_M6: ui->lineEditM6->setText( str ); break; case DSP_REG_M7: ui->lineEditM7->setText( str ); break; case DSP_REG_SR: ui->lineEditSR->setText( str ); break; case DSP_REG_LC: ui->lineEditLC->setText( str ); break; } } QString str = QString::number( pCore->pc, 16 ); str = str.rightJustified( 4, '0' ).toUpper(); ui->lineEditPC->setText( str ); scrollToPc(); if( ui->radioButtonP->isChecked() ) { updateP(); } else if( ui->radioButtonX->isChecked() ) { updateX(); } else if( ui->radioButtonY->isChecked() ) { updateY(); } else if( ui->radioButtonL->isChecked() ) { updateL(); } // if waiting for another breakpoint if( m_autoStepping ) { if( !m_breakpoints.contains( m_pCurrentDspCore->pc ) ) { emit stepInto(); } else { m_autoStepping = false; } } }
void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt) { wxEventType type = evt.GetEventType(); if (type == debEVT_SETSTATUSBARTEXT) { DebugInterface* cpu = reinterpret_cast<DebugInterface*>(evt.GetClientData()); if (cpu != NULL && currentCpu != NULL && cpu == currentCpu->getCpu()) GetStatusBar()->SetLabel(evt.GetString()); } else if (type == debEVT_UPDATELAYOUT) { if (currentCpu != NULL) currentCpu->GetSizer()->Layout(); topSizer->Layout(); update(); } else if (type == debEVT_GOTOINMEMORYVIEW) { if (currentCpu != NULL) { currentCpu->showMemoryView(); currentCpu->getMemoryView()->gotoAddress(evt.GetInt()); currentCpu->getDisassembly()->SetFocus(); } } else if (type == debEVT_RUNTOPOS) { // todo: breakpoints for iop if (currentCpu != eeTab) return; CBreakPoints::AddBreakPoint(evt.GetInt(),true); currentCpu->getCpu()->resumeCpu(); } else if (type == debEVT_GOTOINDISASM) { if (currentCpu != NULL) { u32 pos = evt.GetInt(); currentCpu->getDisassembly()->gotoAddress(pos); currentCpu->getDisassembly()->SetFocus(); update(); } } else if (type == debEVT_STEPOVER) { if (currentCpu != NULL) stepOver(); } else if (type == debEVT_STEPINTO) { if (currentCpu != NULL) stepInto(); } else if (type == debEVT_UPDATE) { update(); } else if (type == debEVT_BREAKPOINTWINDOW) { wxCommandEvent evt; onBreakpointClick(evt); } else if (type == debEVT_MAPLOADED) { eeTab->reloadSymbolMap(); iopTab->reloadSymbolMap(); } else if (type == debEVT_STEPOUT) { if (currentCpu != NULL) stepOut(); } }
void UIDebugCPU::on_pbStepInto_clicked() { stepInto(); }