void CBreakPoints::Update(u32 addr) { if (MIPSComp::jit && Core_IsInactive()) { if (addr != 0) MIPSComp::jit->ClearCacheAt(addr); else MIPSComp::jit->ClearCache(); } // Redraw in order to show the breakpoint. host->UpdateDisassembly(); }
void Enqueue(SaveState::Operation op) { std::lock_guard<std::recursive_mutex> guard(mutex); pending.push_back(op); // Don't actually run it until next CoreTiming::Advance(). // It's possible there might be a duplicate but it won't hurt us. if (Core_IsInactive() && __KernelIsRunning()) { // Warning: this may run on a different thread. needsProcess = true; Process(); } else { needsProcess = true; } }
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: { 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 WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: case CBN_SELCHANGE: { 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); } } 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); } break; }; break; case IDC_GO: { SetDebugMode(false); Core_EnableStepping(false); } break; case IDC_STEP: { Core_DoSingleStep(); Sleep(1); _dbg_update_(); ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } break; case IDC_STEPOVER: { SetDebugMode(false); CBreakPoints::AddBreakPoint(cpu->GetPC()+cpu->getInstructionSize(0),true); _dbg_update_(); Core_EnableStepping(false); Sleep(1); ptr->gotoPC(); UpdateDialog(); } break; case IDC_STEPHLE: { hleDebugBreak(); SetDebugMode(false); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_STOP: { SetDebugMode(true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } break; case IDC_SKIP: { cpu->SetPC(cpu->GetPC() + cpu->getInstructionSize(0)); Sleep(1); ptr->gotoPC(); UpdateDialog(); } break; case IDC_MEMCHECK: { bool isRunning = !Core_IsInactive(); if (isRunning) { SetDebugMode(true); Core_EnableStepping(true); Core_WaitInactive(200); } MemCheck check; if (InputBox_GetHex(GetModuleHandle(NULL), m_hDlg, "JIT (and not HLE) only for now, no delete", 0, check.iStartAddress)) { check.bBreak = true; check.bLog = true; check.bOnRead = true; check.bOnWrite = true; check.bRange = false; CBreakPoints::MemChecks.push_back(check); CBreakPoints::InvalidateJit(); } if (isRunning) { SetDebugMode(false); Core_EnableStepping(false); } } break; case IDC_ADDRESS: { if (HIWORD(wParam) == EN_CHANGE ) { char szBuffer[32]; GetWindowText ((HWND)lParam, szBuffer, 32); ptr->gotoAddr(parseHex(szBuffer)); UpdateDialog(); } } 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); 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(); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); } 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_USER+1: NotifyMapLoaded(); break; case WM_SIZE: { HWND disasm = GetDlgItem(m_hDlg, IDC_DISASMVIEW); HWND funclist = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); HWND regList = GetDlgItem(m_hDlg, IDC_REGLIST); int wf = regRect.right-regRect.left; int top = 138; MoveWindow(regList,8,top,wf,HIWORD(lParam)-top-8,TRUE); MoveWindow(funclist,8,top,wf,HIWORD(lParam)-top-8,TRUE); int w = LOWORD(lParam)-wf; top = 25; MoveWindow(disasm,wf+15,top, w-20,HIWORD(lParam)-top-8,TRUE); return TRUE; } case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; m->ptMinTrackSize.x=minRect.right-minRect.left; //m->ptMaxTrackSize.x=m->ptMinTrackSize.x; m->ptMinTrackSize.y=minRect.bottom-minRect.top; } return TRUE; case WM_CLOSE: Show(false); return TRUE; } return FALSE; }
void CBreakPoints::InvalidateJit() { // Don't want to clear cache while running, I think? if (MIPSComp::jit && Core_IsInactive()) MIPSComp::jit->ClearCache(); }
void Core_WaitInactive() { while (!Core_IsInactive()) m_hInactiveEvent.wait(m_hInactiveMutex); }