void CDisasm::stepOut() { auto threads = GetThreadsInfo(); u32 entry, stackTop; for (size_t i = 0; i < threads.size(); i++) { if (threads[i].isCurrent) { entry = threads[i].entrypoint; stackTop = threads[i].initialStack; break; } } auto frames = MIPSStackWalk::Walk(cpu->GetPC(),cpu->GetRegValue(0,31),cpu->GetRegValue(0,29),entry,stackTop); if (frames.size() < 2) return; u32 breakpointAddress = frames[1].pc; // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->setDontRedraw(true); SetDebugMode(false); CBreakPoints::AddBreakPoint(breakpointAddress,true); _dbg_update_(); Core_EnableStepping(false); Sleep(1); ptr->gotoAddr(breakpointAddress); UpdateDialog(); }
void CtrlThreadList::reloadThreads() { threads = GetThreadsInfo(); int items = ListView_GetItemCount(wnd); while (items < (int)threads.size()) { LVITEM lvI; lvI.pszText = LPSTR_TEXTCALLBACK; // Sends an LVN_GETDISPINFO message. lvI.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE; lvI.stateMask = 0; lvI.iSubItem = 0; lvI.state = 0; lvI.iItem = items; lvI.iImage = items; ListView_InsertItem(wnd, &lvI); items++; } while (items > (int)threads.size()) { ListView_DeleteItem(wnd,--items); } InvalidateRect(wnd,NULL,true); UpdateWindow(wnd); }
void CtrlStackTraceView::loadStackTrace() { auto threads = GetThreadsInfo(); u32 entry, stackTop; for (size_t i = 0; i < threads.size(); i++) { if (threads[i].isCurrent) { entry = threads[i].entrypoint; stackTop = threads[i].initialStack; break; } } frames = MIPSStackWalk::Walk(cpu->GetPC(),cpu->GetRegValue(0,31),cpu->GetRegValue(0,29),entry,stackTop); Update(); }
void CtrlStackTraceView::loadStackTrace() { auto threads = GetThreadsInfo(); u32 entry, stackTop; for (size_t i = 0; i < threads.size(); i++) { if (threads[i].isCurrent) { entry = threads[i].entrypoint; stackTop = threads[i].initialStack; break; } } frames = MIPSStackWalk::Walk(cpu->GetPC(),cpu->GetRegValue(0,31),cpu->GetRegValue(0,29),entry,stackTop); int items = ListView_GetItemCount(wnd); while (items < (int)frames.size()) { LVITEM lvI; lvI.pszText = LPSTR_TEXTCALLBACK; // Sends an LVN_GETDISPINFO message. lvI.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE; lvI.stateMask = 0; lvI.iSubItem = 0; lvI.state = 0; lvI.iItem = items; lvI.iImage = items; ListView_InsertItem(wnd, &lvI); items++; } while (items > (int)frames.size()) { ListView_DeleteItem(wnd,--items); } InvalidateRect(wnd,NULL,true); UpdateWindow(wnd); }
void Debugger_Disasm::UpdateCallstackGUI() { auto threads = GetThreadsInfo(); u32 entry = 0, stackTop = 0; for (size_t i = 0; i < threads.size(); i++) { if (threads[i].isCurrent) { entry = threads[i].entrypoint; stackTop = threads[i].initialStack; break; } } if (entry != 0) { stackTraceModel = MIPSStackWalk::Walk( cpu->GetPC(), cpu->GetRegValue(0,MIPS_REG_RA), cpu->GetRegValue(0,MIPS_REG_SP), entry, stackTop); } else { stackTraceModel.clear(); } ui->callStack->clear(); QTreeWidgetItem* item; for(auto it=stackTraceModel.begin();it!=stackTraceModel.end();it++) { item = new QTreeWidgetItem(); item->setText(0,QString("%1").arg(it->pc,8,16,QChar('0')).prepend("0x")); item->setData(0,Qt::UserRole,it->pc); item->setText(1,QString("%1").arg(it->entry,8,16,QChar('0')).prepend("0x")); item->setData(1,Qt::UserRole,it->entry); item->setText(2,QString("%1").arg(it->sp,8,16,QChar('0')).prepend("0x")); item->setText(3,QString("%1").arg(it->stackSize,8,16,QChar('0')).prepend("0x")); ui->callStack->addTopLevelItem(item); } }
void Debugger_Disasm::UpdateThreadGUI() { ui->threadList->clear(); EmuThread_LockDraw(true); std::vector<DebugThreadInfo> threads = GetThreadsInfo(); EmuThread_LockDraw(false); for(int i = 0; i < threads.size(); i++) { QTreeWidgetItem* item = new QTreeWidgetItem(); item->setText(0,QVariant(threads[i].id).toString()); item->setData(0,Qt::UserRole,threads[i].id); item->setText(1,threads[i].name); QString status = ""; if(threads[i].status & THREADSTATUS_RUNNING) status += "Running "; if(threads[i].status & THREADSTATUS_WAIT) status += "Wait "; if(threads[i].status & THREADSTATUS_READY) status += "Ready "; if(threads[i].status & THREADSTATUS_SUSPEND) status += "Suspend "; if(threads[i].status & THREADSTATUS_DORMANT) status += "Dormant "; if(threads[i].status & THREADSTATUS_DEAD) status += "Dead "; item->setText(2,status); char temp[24]; sprintf(temp,"%08x",threads[i].curPC); item->setText(3,temp); item->setData(3,Qt::UserRole,threads[i].curPC); sprintf(temp,"%08x",threads[i].entrypoint); item->setText(4,temp); item->setData(4,Qt::UserRole,threads[i].entrypoint); if(threads[i].isCurrent) { for(int j = 0; j < 5; j++) item->setTextColor(j,Qt::green); } ui->threadList->addTopLevelItem(item); } }
void Debugger_Disasm::UpdateThreadGUI() { ui->threadList->clear(); EmuThread_LockDraw(true); std::vector<DebugThreadInfo> threads = GetThreadsInfo(); EmuThread_LockDraw(false); for(size_t i = 0; i < threads.size(); i++) { QTreeWidgetItem* item = new QTreeWidgetItem(); item->setText(0,QString::number(threads[i].id)); item->setData(0,Qt::UserRole,threads[i].id); item->setText(1,threads[i].name); QString status = ""; if(threads[i].status & THREADSTATUS_RUNNING) status += "Running "; if(threads[i].status & THREADSTATUS_WAIT) status += "Wait "; if(threads[i].status & THREADSTATUS_READY) status += "Ready "; if(threads[i].status & THREADSTATUS_SUSPEND) status += "Suspend "; if(threads[i].status & THREADSTATUS_DORMANT) status += "Dormant "; if(threads[i].status & THREADSTATUS_DEAD) status += "Dead "; item->setText(2,status); item->setText(3,QString("%1").arg(threads[i].curPC,8,16,QChar('0'))); item->setData(3,Qt::UserRole,threads[i].curPC); item->setText(4,QString("%1").arg(threads[i].entrypoint,8,16,QChar('0'))); item->setData(4,Qt::UserRole,threads[i].entrypoint); if(threads[i].isCurrent) { for(int j = 0; j < 5; j++) item->setTextColor(j,Qt::green); } ui->threadList->addTopLevelItem(item); } for(int i = 0; i < ui->threadList->columnCount(); i++) ui->threadList->resizeColumnToContents(i); }
void CtrlThreadList::reloadThreads() { threads = GetThreadsInfo(); Update(); }