Debug interface improvements

This commit is contained in:
Kingcom 2013-07-03 22:29:35 +02:00
parent c01a69df30
commit bccc3c4281
6 changed files with 61 additions and 3 deletions

View File

@ -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);

View File

@ -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

View File

@ -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";
}

View File

@ -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();
};

Binary file not shown.

Binary file not shown.