Try to make debugger more stable

This commit is contained in:
zilmar 2018-07-30 23:45:23 +10:00
parent ba0124efa8
commit 9cb3ed48e2
2 changed files with 17 additions and 1 deletions

View File

@ -48,7 +48,8 @@ HHOOK CDebugCommandsView::hWinMessageHook = NULL;
CDebugCommandsView::CDebugCommandsView(CDebuggerUI * debugger, SyncEvent &StepEvent) : CDebugCommandsView::CDebugCommandsView(CDebuggerUI * debugger, SyncEvent &StepEvent) :
CDebugDialog<CDebugCommandsView>(debugger), CDebugDialog<CDebugCommandsView>(debugger),
CToolTipDialog<CDebugCommandsView>(), CToolTipDialog<CDebugCommandsView>(),
m_StepEvent(StepEvent) m_StepEvent(StepEvent),
m_Attached(false)
{ {
m_HistoryIndex = -1; m_HistoryIndex = -1;
m_bIgnoreAddrChange = false; m_bIgnoreAddrChange = false;
@ -139,11 +140,13 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID); hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID);
WindowCreated(); WindowCreated();
m_Attached = true;
return TRUE; return TRUE;
} }
LRESULT CDebugCommandsView::OnDestroy(void) LRESULT CDebugCommandsView::OnDestroy(void)
{ {
m_Attached = false;
g_Settings->UnregisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)StaticSteppingOpsChanged); g_Settings->UnregisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)StaticSteppingOpsChanged);
g_Settings->UnregisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticWaitingForStepChanged); g_Settings->UnregisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)StaticWaitingForStepChanged);
@ -1329,6 +1332,10 @@ void CDebugCommandsView::EndOpEdit()
LRESULT CDebugCommandsView::OnAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) LRESULT CDebugCommandsView::OnAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
if (!m_Attached)
{
return 0;
}
if (m_bIgnoreAddrChange) if (m_bIgnoreAddrChange)
{ {
m_bIgnoreAddrChange = false; m_bIgnoreAddrChange = false;
@ -1340,6 +1347,10 @@ LRESULT CDebugCommandsView::OnAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HW
LRESULT CDebugCommandsView::OnPCChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) LRESULT CDebugCommandsView::OnPCChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
if (!m_Attached)
{
return 0;
}
if (m_bIgnorePCChange) if (m_bIgnorePCChange)
{ {
m_bIgnorePCChange = false; m_bIgnorePCChange = false;
@ -1477,6 +1488,10 @@ LRESULT CDebugCommandsView::OnListBoxClicked(WORD /*wNotifyCode*/, WORD wID, HWN
LRESULT CDebugCommandsView::OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CDebugCommandsView::OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
if (!m_Attached)
{
return false;
}
if (LOWORD(wParam) != WA_INACTIVE) if (LOWORD(wParam) != WA_INACTIVE)
{ {
ShowAddress(m_StartAddress, TRUE); ShowAddress(m_StartAddress, TRUE);

View File

@ -304,4 +304,5 @@ private:
std::vector<BRANCHARROW> m_BranchArrows; std::vector<BRANCHARROW> m_BranchArrows;
vector<bool> m_bvAnnotatedLines; vector<bool> m_bvAnnotatedLines;
bool m_Attached;
}; };