Add status bar

This commit is contained in:
Kingcom 2013-07-30 16:19:05 +02:00
parent 4ac782f789
commit 92c70af587
8 changed files with 96 additions and 5 deletions

View File

@ -505,6 +505,11 @@ void CtrlDisAsmView::followBranch()
{
jumpStack.push_back(curAddress);
gotoAddr(info.branchTarget);
} else if (info.isDataAccess)
{
// well, not exactly a branch, but we can do something anyway
SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,info.dataAddress,0);
SetFocus(wnd);
}
}
@ -821,6 +826,41 @@ void CtrlDisAsmView::onMouseMove(WPARAM wParam, LPARAM lParam, int button)
}
}
void CtrlDisAsmView::updateStatusBarText()
{
char text[512];
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(debugger,curAddress);
text[0] = 0;
if (info.isDataAccess)
{
switch (info.dataSize)
{
case 1:
sprintf(text,"[%08X] = %02X",info.dataAddress,Memory::Read_U8(info.dataAddress));
break;
case 2:
sprintf(text,"[%08X] = %04X",info.dataAddress,Memory::Read_U16(info.dataAddress));
break;
case 4:
sprintf(text,"[%08X] = %08X",info.dataAddress,Memory::Read_U32(info.dataAddress));
break;
}
}
if (info.isBranch)
{
const char* addressSymbol = debugger->findSymbolForAddress(info.branchTarget);
if (addressSymbol == NULL)
{
sprintf(text,"%08X",info.branchTarget);
} else {
sprintf(text,"%08X = %s",info.branchTarget,addressSymbol);
}
}
SendMessage(GetParent(wnd),WM_DEB_SETSTATUSBARTEXT,0,(LPARAM)text);
}
u32 CtrlDisAsmView::yToAddress(int y)
{

View File

@ -76,6 +76,7 @@ class CtrlDisAsmView
void calculatePixelPositions();
bool getDisasmAddressText(u32 address, char* dest, bool abbreviateLabels);
void parseDisasm(const char* disasm, char* opcode, char* arguments);
void updateStatusBarText();
public:
CtrlDisAsmView(HWND _wnd);
~CtrlDisAsmView();
@ -150,5 +151,6 @@ public:
curAddress = newAddress;
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
updateStatusBarText();
}
};

View File

@ -500,6 +500,12 @@ void CtrlMemView::onMouseMove(WPARAM wParam, LPARAM lParam, int button)
}
void CtrlMemView::updateStatusBarText()
{
char text[64];
sprintf(text,"%08X",curAddress);
SendMessage(GetParent(wnd),WM_DEB_SETSTATUSBARTEXT,0,(LPARAM)text);
}
void CtrlMemView::gotoPoint(int x, int y)
{
@ -514,6 +520,7 @@ void CtrlMemView::gotoPoint(int x, int y)
asciiSelected = true;
curAddress = lineAddress+col;
selectedNibble = 0;
updateStatusBarText();
redraw();
} else if (x >= hexStart)
{
@ -529,6 +536,7 @@ void CtrlMemView::gotoPoint(int x, int y)
asciiSelected = false;
curAddress = lineAddress+col/3;
updateStatusBarText();
redraw();
}
}
@ -545,6 +553,8 @@ void CtrlMemView::gotoAddr(unsigned int addr)
{
windowStart = curAddress & ~15;
}
updateStatusBarText();
redraw();
}
@ -588,5 +598,6 @@ void CtrlMemView::scrollCursor(int bytes)
windowStart = (curAddress-(visibleRows-1)*rowSize) & ~15;
}
updateStatusBarText();
redraw();
}

View File

@ -52,6 +52,7 @@ class CtrlMemView
static TCHAR szClassName[];
DebugInterface *debugger;
MemViewMode mode;
void updateStatusBarText();
public:
CtrlMemView(HWND _wnd);
~CtrlMemView();

View File

@ -11,6 +11,8 @@ enum { WM_DEB_RUNTOWPARAM = WM_USER+2,
WM_DEB_TABPRESSED,
WM_DEB_SETDEBUGLPARAM,
WM_DEB_UPDATE,
WM_DEB_SETSTATUSBARTEXT,
WM_DEB_GOTOHEXEDIT
};
bool executeExpressionWindow(HWND hwnd, DebugInterface* cpu, u32& dest);

View File

@ -143,6 +143,13 @@ CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Di
ShowWindow(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW), SW_NORMAL);
ShowWindow(GetDlgItem(m_hDlg, IDC_THREADLIST), SW_HIDE);
// init status bar
statusBarWnd = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "", m_hDlg, IDC_DISASMSTATUSBAR);
if (g_Config.bDisplayStatusBar == false)
{
ShowWindow(statusBarWnd,SW_HIDE);
}
// Actually resize the window to the proper size (after the above setup.)
if (w != -1 && h != -1)
{
@ -518,9 +525,27 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
}
}
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;
}
@ -566,20 +591,29 @@ void CDisasm::UpdateSize(WORD width, WORD height)
HWND memView = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST);
if (g_Config.bDisplayStatusBar)
{
RECT statusRect;
GetWindowRect(statusBarWnd,&statusRect);
height -= (statusRect.bottom-statusRect.top);
} else {
height -= 2;
}
int defaultHeight = defaultRect.bottom - defaultRect.top;
int breakpointHeight = defaultBreakpointRect.bottom - defaultBreakpointRect.top;
if (height < defaultHeight)
breakpointHeight -= defaultHeight - height;
int breakpointTop = height-breakpointHeight-8;
int breakpointTop = height-breakpointHeight-4;
int regWidth = regRect.right - regRect.left;
int regTop = 138;
int disasmWidth = width-regWidth;
int disasmTop = 25;
MoveWindow(regList, 8, regTop, regWidth, height-regTop-breakpointHeight-12, TRUE);
MoveWindow(funclist, 8, regTop, regWidth, height-regTop-breakpointHeight-12, TRUE);
MoveWindow(disasm,regWidth+15,disasmTop,disasmWidth-20,height-disasmTop-breakpointHeight-12,TRUE);
MoveWindow(regList, 8, regTop, regWidth, height-regTop-breakpointHeight-8, TRUE);
MoveWindow(funclist, 8, regTop, regWidth, height-regTop-breakpointHeight-8, TRUE);
MoveWindow(disasm,regWidth+15,disasmTop,disasmWidth-20,height-disasmTop-breakpointHeight-8,TRUE);
MoveWindow(breakpointList,8,breakpointTop,width-16,breakpointHeight,TRUE);
MoveWindow(memView,8,breakpointTop,width-16,breakpointHeight,TRUE);
MoveWindow(threads,8,breakpointTop,width-16,breakpointHeight,TRUE);

View File

@ -27,6 +27,7 @@ private:
DebugInterface *cpu;
u64 lastTicks;
HWND statusBarWnd;
CtrlBreakpointList* breakpointList;
CtrlThreadList* threadList;
std::vector<BreakPoint> displayedBreakPoints_;

Binary file not shown.