Clean up some of the debugger code

This commit is contained in:
zilmar 2019-01-14 14:33:02 +10:30
parent ee8a17b378
commit 82ff21f255
14 changed files with 80 additions and 138 deletions

View File

@ -22,6 +22,32 @@ protected:
SetEvent(m_CreatedEvent);
}
void LoadWindowPos(UISettingID TopSetting, UISettingID LeftSetting)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
uint32_t X = GetX(m_DefaultWindowRect);
uint32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(TopSetting, Y);
UISettingsLoadDword(LeftSetting, X);
SetPos(X, Y);
}
void SaveWindowPos(UISettingID TopSetting, UISettingID LeftSetting)
{
RECT WinRect;
GetWindowRect(&WinRect);
//Load the value from settings, if none is available, default to above
UISettingsSaveDword(TopSetting, WinRect.top);
UISettingsSaveDword(LeftSetting, WinRect.left);
}
public:
CDebugDialog(CDebuggerUI * debugger) :
m_Debugger(debugger),

View File

@ -87,18 +87,6 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
DlgResize_Init(false, true);
DlgToolTip_Init();
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(Commands_Top, (uint32_t &)Y);
UISettingsLoadDword(Commands_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(Commands_Width);
int32_t Height = UISettingsLoadDword(Commands_Height);
@ -180,11 +168,17 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
DWORD dwThreadID = ::GetCurrentThreadId();
hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID);
WindowCreated();
LoadWindowPos(Commands_Top, Commands_Left);
WindowCreated();
m_Attached = true;
return TRUE;
}
void CDebugCommandsView::OnExitSizeMove(void)
{
SaveWindowPos(Commands_Top, Commands_Left);
}
LRESULT CDebugCommandsView::OnDestroy(void)
{
m_Attached = false;

View File

@ -249,8 +249,6 @@ private:
CAddSymbolDlg m_AddSymbolDlg;
uint32_t m_StartAddress;
CRect m_DefaultWindowRect;
CEditNumber32 m_PCEdit;
bool m_bIgnorePCChange;

View File

@ -146,19 +146,6 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(DMALogView_Top, (uint32_t &)Y);
UISettingsLoadDword(DMALogView_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(DMALogView_Width);
int32_t Height = UISettingsLoadDword(DMALogView_Height);
@ -196,6 +183,7 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
RefreshList();
LoadWindowPos(DMALogView_Width, DMALogView_Height);
WindowCreated();
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);

View File

@ -40,19 +40,6 @@ void CDebugMemorySearch::AddAlignmentOptions(CComboBox & ctrl)
LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(MemorySearch_Top, (uint32_t &)Y);
UISettingsLoadDword(MemorySearch_Left, (uint32_t &)X);
SetPos(X, Y);
m_PAddrStart.Attach(GetDlgItem(IDC_PADDR_START));
m_PAddrStart.SetDisplayType(CEditNumber32::DisplayHex);
m_SearchLen.Attach(GetDlgItem(IDC_ADDR_END));
@ -84,10 +71,16 @@ LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
BOOL bHandled;
OnClicked(0, IDC_BTN_RDRAM, NULL, bHandled);
OnClicked(0, IDC_RADIO_VALUE, NULL, bHandled);
WindowCreated();
LoadWindowPos(MemorySearch_Top, MemorySearch_Left);
WindowCreated();
return TRUE;
}
void CDebugMemorySearch::OnExitSizeMove(void)
{
SaveWindowPos(MemorySearch_Top, MemorySearch_Left);
}
LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/)
{
switch (wID)

View File

@ -54,12 +54,14 @@ private:
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_DBLCLK, OnResultDblClick)
END_MSG_MAP()
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnResultRClick(LPNMHDR lpnmh);
LRESULT OnResultDblClick(LPNMHDR lpnmh);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnResultRClick(LPNMHDR lpnmh);
LRESULT OnResultDblClick(LPNMHDR lpnmh);
void OnExitSizeMove(void);
void EnableUnknownOptions(bool Enable);
void EnableValueOptions(bool Enable);

View File

@ -31,19 +31,6 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(Scripts_Top, (uint32_t &)Y);
UISettingsLoadDword(Scripts_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(Scripts_Width);
int32_t Height = UISettingsLoadDword(Scripts_Height);
@ -74,7 +61,8 @@ LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
RefreshList();
WindowCreated();
LoadWindowPos(Scripts_Top, Scripts_Left);
WindowCreated();
return 0;
}

View File

@ -50,19 +50,6 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
{
DlgResize_Init();
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(StackTrace_Top, (uint32_t &)Y);
UISettingsLoadDword(StackTrace_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(StackTrace_Width);
int32_t Height = UISettingsLoadDword(StackTrace_Height);
@ -80,6 +67,7 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
m_List.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
LoadWindowPos(StackTrace_Top, StackTrace_Left);
WindowCreated();
return TRUE;
}

View File

@ -26,19 +26,6 @@ LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(StackView_Top, (uint32_t &)Y);
UISettingsLoadDword(StackView_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(StackView_Width);
int32_t Height = UISettingsLoadDword(StackView_Height);
@ -60,7 +47,8 @@ LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /
m_SPStatic.Attach(GetDlgItem(IDC_SP_STATIC));
WindowCreated();
LoadWindowPos(StackView_Top, StackView_Left);
WindowCreated();
return 0;
}

View File

@ -26,19 +26,6 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
{
DlgResize_Init(false, true);
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(Symbols_Top, (uint32_t &)Y);
UISettingsLoadDword(Symbols_Left, (uint32_t &)X);
SetPos(X, Y);
int32_t Width = UISettingsLoadDword(Symbols_Width);
int32_t Height = UISettingsLoadDword(Symbols_Height);
@ -63,7 +50,8 @@ LRESULT CDebugSymbols::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
WindowCreated();
LoadWindowPos(Symbols_Top, Symbols_Left);
WindowCreated();
return 0;
}

View File

@ -23,19 +23,6 @@ CDebugTlb::~CDebugTlb()
LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(TLB_Top, (uint32_t &)Y);
UISettingsLoadDword(TLB_Left, (uint32_t &)X);
SetPos(X, Y);
LV_COLUMN col;
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
@ -89,14 +76,16 @@ LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
RefreshTLBWindow();
SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0);
// if (Settings().Load(TLBWindowLeft) <= 0)
// {
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
// }
WindowCreated();
LoadWindowPos(TLB_Top, TLB_Left);
WindowCreated();
return TRUE;
}
void CDebugTlb::OnExitSizeMove(void)
{
SaveWindowPos(TLB_Top, TLB_Left);
}
LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
{
switch (wID)

View File

@ -16,10 +16,12 @@ class CDebugTlb :
BEGIN_MSG_MAP_EX(CDebugTlb)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
END_MSG_MAP()
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
void OnExitSizeMove(void);
public:
enum { IDD = IDD_Debugger_TLB };

View File

@ -38,19 +38,6 @@ CDebugMemoryView::~CDebugMemoryView()
LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect m_DefaultWindowRect;
GetWindowRect(&m_DefaultWindowRect);
//We find the middle position of the screen, we use this if theres no setting
int32_t X = GetX(m_DefaultWindowRect);
int32_t Y = GetY(m_DefaultWindowRect);
//Load the value from settings, if none is available, default to above
UISettingsLoadDword(ViewMemory_Top, (uint32_t &)Y);
UISettingsLoadDword(ViewMemory_Left, (uint32_t &)X);
SetPos(X, Y);
m_SymbolColorStride = 0;
m_SymbolColorPhase = 0;
m_DataStartLoc = (DWORD)-1;
@ -140,7 +127,8 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
DWORD dwThreadID = ::GetCurrentThreadId();
hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID);
WindowCreated();
LoadWindowPos(ViewMemory_Top, ViewMemory_Left);
WindowCreated();
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
@ -160,6 +148,11 @@ DWORD WINAPI CDebugMemoryView::AutoRefreshProc(void* _self)
}
}
void CDebugMemoryView::OnExitSizeMove()
{
SaveWindowPos(ViewMemory_Top, ViewMemory_Left);
}
void CDebugMemoryView::InterceptMouseWheel(WPARAM wParam, LPARAM /*lParam*/)
{
uint32_t newAddress = m_DataStartLoc - ((short)HIWORD(wParam) / WHEEL_DELTA) * 16;
@ -199,7 +192,10 @@ LRESULT CDebugMemoryView::OnDestroy(void)
delete m_MemoryList;
m_MemoryList = NULL;
}
UnhookWindowsHookEx(hWinMessageHook);
m_MemAddr.Detach();
m_SymInfo.Detach();
m_DMAInfo.Detach();
UnhookWindowsHookEx(hWinMessageHook);
return 0;
}

View File

@ -32,6 +32,7 @@ private:
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_RIGHTCLICK, OnMemoryRightClicked)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_HOTITEMCHANGED, OnHotItemChanged)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_VSCROLL(OnVScroll)
END_MSG_MAP()
@ -40,6 +41,7 @@ private:
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
void OnAddrChanged(UINT Code, int id, HWND ctl);
void OnVScroll(int request, short Pos, HWND ctrl);
void OnExitSizeMove(void);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
LRESULT OnMemoryRightClicked(LPNMHDR lpNMHDR);