[Debugger] Make DMA log stable

This commit is contained in:
shygoo 2019-04-02 13:28:46 -05:00
parent 693925f340
commit 27bc76d089
4 changed files with 38 additions and 23 deletions

View File

@ -126,16 +126,6 @@ void CDebugDMALogView::RefreshList()
m_nLastStartIndex = dmaLogSize;
}
DWORD WINAPI CDebugDMALogView::AutoRefreshProc(void* _this)
{
CDebugDMALogView* self = (CDebugDMALogView*)_this;
while (true)
{
self->RefreshList();
Sleep(100);
}
}
LRESULT CDebugDMALogView::OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
//RefreshList();
@ -182,11 +172,25 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
LoadWindowPos();
WindowCreated();
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
return TRUE;
}
void CDebugDMALogView::RefreshDMALogWindow(void)
{
if (m_hWnd == NULL)
{
return;
}
PostMessage(WM_REFRESH);
}
LRESULT CDebugDMALogView::OnRefresh(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
RefreshList();
return TRUE;
}
void CDebugDMALogView::OnExitSizeMove(void)
{
SaveWindowPos();
@ -194,11 +198,6 @@ void CDebugDMALogView::OnExitSizeMove(void)
LRESULT CDebugDMALogView::OnDestroy(void)
{
if (m_AutoRefreshThread != NULL)
{
TerminateThread(m_AutoRefreshThread, 0);
CloseHandle(m_AutoRefreshThread);
}
return 0;
}

View File

@ -23,9 +23,16 @@ public:
CDebugDMALogView(CDebuggerUI * debugger);
virtual ~CDebugDMALogView(void);
void RefreshList();
void RefreshDMALogWindow(void);
private:
enum
{
WM_REFRESH = WM_USER + 1
};
void RefreshList(void);
CDMALog* m_DMALog;
int m_nLastStartIndex;
@ -34,9 +41,6 @@ private:
bool m_bUniqueRomAddresses;
bool m_bFilterChanged;
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
// Return true if entry meets requirements
bool FilterEntry(int dmaLogIndex);
@ -48,6 +52,7 @@ private:
bool m_bCustomDrawClrNext;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnRefresh(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
@ -57,6 +62,7 @@ private:
void OnExitSizeMove(void);
BEGIN_MSG_MAP_EX(CDebugDMALogView)
MESSAGE_HANDLER(WM_REFRESH, OnRefresh)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
@ -65,7 +71,7 @@ private:
NOTIFY_HANDLER_EX(IDC_DMA_LIST, NM_CUSTOMDRAW, OnCustomDrawList)
CHAIN_MSG_MAP(CDialogResize<CDebugDMALogView>)
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
END_MSG_MAP()
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugDMALogView)
DLGRESIZE_CONTROL(IDC_DMA_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)

View File

@ -254,6 +254,14 @@ void CDebuggerUI::Debug_RefreshTLBWindow(void)
}
}
void CDebuggerUI::Debug_RefreshDMALogWindow(void)
{
if (m_DMALogView)
{
m_DMALogView->RefreshDMALogWindow();
}
}
void CDebuggerUI::OpenMemorySearch()
{
if (m_MemorySearch == NULL)
@ -647,7 +655,8 @@ void CDebuggerUI::HandleCartToRamDMA(void)
uint32_t dmaLen = opInfo.GetStoreValueUnsigned() + 1;
m_DMALog->AddEntry(dmaRomAddr, dmaRamAddr, dmaLen);
Debug_RefreshDMALogWindow();
// break if write breakpoint exists anywhere in target buffer
if (m_Breakpoints->WriteBPExistsInChunk(dmaRamAddr, dmaLen))
{

View File

@ -60,6 +60,7 @@ public:
void Debug_RefreshStackWindow(void);
void Debug_RefreshStackTraceWindow(void);
void OpenDMALogWindow(void);
void Debug_RefreshDMALogWindow(void);
void OpenCPULogWindow(void);
void Debug_RefreshCPULogWindow(void);
void OpenExcBreakpointsWindow(void);