From bccc3c42819d43d2aa9cf1a2a1640b929be52163 Mon Sep 17 00:00:00 2001 From: Kingcom Date: Wed, 3 Jul 2013 22:29:35 +0200 Subject: [PATCH] Debug interface improvements --- Windows/Debugger/Debugger_Disasm.cpp | 26 ++++++++++++++++++- Windows/Debugger/Debugger_Disasm.h | 1 + Windows/Debugger/Debugger_Lists.cpp | 36 +++++++++++++++++++++++++-- Windows/Debugger/Debugger_Lists.h | 1 + Windows/ppsspp.rc | Bin 43766 -> 43954 bytes Windows/resource.h | Bin 24832 -> 24924 bytes 6 files changed, 61 insertions(+), 3 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index b8a34a62a5..20a3035cf5 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -558,6 +558,10 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); + + CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW))->redraw(); + threadList->reloadThreads(); + updateThreadLabel(false); } break; @@ -575,7 +579,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) ptr->setDontRedraw(true); u32 breakpointAddress = cpu->GetPC()+cpu->getInstructionSize(0); - if (memcmp(dis,"jal\t",4) == 0) + if (memcmp(dis,"jal\t",4) == 0 || memcmp(dis,"jalr\t",5) == 0) { // it's a function call with a delay slot - skip that too breakpointAddress += cpu->getInstructionSize(0); @@ -844,6 +848,19 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) return FALSE; } +void CDisasm::updateThreadLabel(bool clear) +{ + char label[512]; + if (clear) + { + sprintf(label,"Thread: -"); + } else { + sprintf(label,"Thread: %s",threadList->getCurrentThreadName()); + } + + SetDlgItemText(m_hDlg, IDC_THREADNAME,label); +} + void CDisasm::UpdateSize(WORD width, WORD height) { HWND disasm = GetDlgItem(m_hDlg, IDC_DISASMVIEW); @@ -905,6 +922,7 @@ void CDisasm::SetDebugMode(bool _bDebug) CBreakPoints::ClearTemporaryBreakPoints(); updateBreakpointList(); threadList->reloadThreads(); + updateThreadLabel(false); EnableWindow( GetDlgItem(hDlg, IDC_GO), TRUE); EnableWindow( GetDlgItem(hDlg, IDC_STEP), TRUE); @@ -915,12 +933,18 @@ void CDisasm::SetDebugMode(bool _bDebug) CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->setDontRedraw(false); ptr->gotoPC(); + + CtrlMemView *mem = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); + mem->redraw(); + // update the callstack //CDisam::blah blah UpdateDialog(); } else { + updateThreadLabel(true); + EnableWindow( GetDlgItem(hDlg, IDC_GO), FALSE); EnableWindow( GetDlgItem(hDlg, IDC_STEP), FALSE); EnableWindow( GetDlgItem(hDlg, IDC_STEPOVER), FALSE); diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index b38d73db1e..a984068a7f 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -41,6 +41,7 @@ private: void removeBreakpoint(int itemIndex); int getTotalBreakpointCount(); int getBreakpointIndex(int itemIndex, bool& isMemory); + void updateThreadLabel(bool clear); public: int index; //helper diff --git a/Windows/Debugger/Debugger_Lists.cpp b/Windows/Debugger/Debugger_Lists.cpp index 09919fb9d5..fedd360b33 100644 --- a/Windows/Debugger/Debugger_Lists.cpp +++ b/Windows/Debugger/Debugger_Lists.cpp @@ -83,7 +83,20 @@ void CtrlThreadList::handleNotify(LPARAM lParam) if (mhdr->code == NM_DBLCLK) { LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam; - SendMessage(GetParent(wnd),WM_DEB_GOTOWPARAM,threads[item->iItem].curPC,0); + + u32 address; + switch (threads[item->iItem].status) + { + case THREADSTATUS_DORMANT: + case THREADSTATUS_DEAD: + address = threads[item->iItem].entrypoint; + break; + default: + address = threads[item->iItem].curPC; + break; + } + + SendMessage(GetParent(wnd),WM_DEB_GOTOWPARAM,address,0); return; } @@ -99,7 +112,16 @@ void CtrlThreadList::handleNotify(LPARAM lParam) strcpy(stringBuffer,threads[index].name); break; case TL_PROGRAMCOUNTER: - sprintf(stringBuffer,"0x%08X",threads[index].curPC); + switch (threads[index].status) + { + case THREADSTATUS_DORMANT: + case THREADSTATUS_DEAD: + sprintf(stringBuffer,"N/A"); + break; + default: + sprintf(stringBuffer,"0x%08X",threads[index].curPC); + break; + }; break; case TL_ENTRYPOINT: sprintf(stringBuffer,"0x%08X",threads[index].entrypoint); @@ -168,3 +190,13 @@ void CtrlThreadList::reloadThreads() InvalidateRect(wnd,NULL,true); UpdateWindow(wnd); } + +const char* CtrlThreadList::getCurrentThreadName() +{ + for (int i = 0; i < threads.size(); i++) + { + if (threads[i].isCurrent) return threads[i].name; + } + + return "N/A"; +} \ No newline at end of file diff --git a/Windows/Debugger/Debugger_Lists.h b/Windows/Debugger/Debugger_Lists.h index 875959df5e..ac8ffd5afb 100644 --- a/Windows/Debugger/Debugger_Lists.h +++ b/Windows/Debugger/Debugger_Lists.h @@ -15,4 +15,5 @@ public: void reloadThreads(); void handleNotify(LPARAM lParam); static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + const char* getCurrentThreadName(); }; \ No newline at end of file diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 31e05eb94e1ccc7443d98c2bf0b04a3b28326e38..0fb48aeb0c30d255410e0a4f56b76436886bd66d 100644 GIT binary patch delta 74 zcmex%m1)y;rVRpW`XLM+3_%R842}#g41Nrb489Dm3_1+P43-S0U|NU4kime#07~mj VPV`fryiLhz@&zxA%>ruAS^#Mn5hDNq delta 14 WcmdmVo$1?ErVRpWo6o2{YXJZ_2nS98 diff --git a/Windows/resource.h b/Windows/resource.h index 836aa27a9141f05b041a193bd3f5311bd4a11e77..bed8c55149ed681a8d418e88f2db6bc308efb119 100644 GIT binary patch delta 45 zcmV+|0Mh?}!U5dE0kFO;lNwnVlX@)-0ZxKkue#Qzybub)-5VC Df&dR+ delta 21 dcmca}h_T@iA7EnHY^0}U3;<}_2qFLg