diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 293f674d7..9d305e5f0 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -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) { diff --git a/Windows/Debugger/CtrlDisAsmView.h b/Windows/Debugger/CtrlDisAsmView.h index b3b6f6059..bf1ce6afb 100644 --- a/Windows/Debugger/CtrlDisAsmView.h +++ b/Windows/Debugger/CtrlDisAsmView.h @@ -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(); } }; \ No newline at end of file diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index dc4980161..4b08cae17 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -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(); } @@ -587,6 +597,7 @@ void CtrlMemView::scrollCursor(int bytes) { windowStart = (curAddress-(visibleRows-1)*rowSize) & ~15; } - + + updateStatusBarText(); redraw(); } \ No newline at end of file diff --git a/Windows/Debugger/CtrlMemView.h b/Windows/Debugger/CtrlMemView.h index 806b4d31f..8aa8193cf 100644 --- a/Windows/Debugger/CtrlMemView.h +++ b/Windows/Debugger/CtrlMemView.h @@ -52,6 +52,7 @@ class CtrlMemView static TCHAR szClassName[]; DebugInterface *debugger; MemViewMode mode; + void updateStatusBarText(); public: CtrlMemView(HWND _wnd); ~CtrlMemView(); diff --git a/Windows/Debugger/DebuggerShared.h b/Windows/Debugger/DebuggerShared.h index c6109d504..c0f8e38a1 100644 --- a/Windows/Debugger/DebuggerShared.h +++ b/Windows/Debugger/DebuggerShared.h @@ -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); diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index a09db71a4..7966cf5c5 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -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); diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index 41184baee..e58ccba6d 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -27,6 +27,7 @@ private: DebugInterface *cpu; u64 lastTicks; + HWND statusBarWnd; CtrlBreakpointList* breakpointList; CtrlThreadList* threadList; std::vector displayedBreakPoints_; diff --git a/Windows/resource.h b/Windows/resource.h index a2845517a..5d72a7d68 100644 Binary files a/Windows/resource.h and b/Windows/resource.h differ