Merge pull request #1602 from shygoo/fix-dmalog
[Debugger] Make DMA log stable
This commit is contained in:
commit
b486f8d587
|
@ -100,12 +100,16 @@ void CDebugDMALogView::RefreshList()
|
||||||
m_DMAList.AddItem(itemIndex, 1, stdstr_f("%08X", lpEntry->ramAddr).c_str());
|
m_DMAList.AddItem(itemIndex, 1, stdstr_f("%08X", lpEntry->ramAddr).c_str());
|
||||||
m_DMAList.AddItem(itemIndex, 2, stdstr_f("%08X (%d)", lpEntry->length, lpEntry->length).c_str());
|
m_DMAList.AddItem(itemIndex, 2, stdstr_f("%08X (%d)", lpEntry->length, lpEntry->length).c_str());
|
||||||
|
|
||||||
|
char sigc[5];
|
||||||
|
memset(sigc, 0, sizeof(sigc));
|
||||||
|
|
||||||
|
if (lpEntry->romAddr < g_Rom->GetRomSize())
|
||||||
|
{
|
||||||
uint32_t sig = *(uint32_t*)&rom[lpEntry->romAddr];
|
uint32_t sig = *(uint32_t*)&rom[lpEntry->romAddr];
|
||||||
sig = _byteswap_ulong(sig);
|
sig = _byteswap_ulong(sig);
|
||||||
|
|
||||||
char sigc[5];
|
|
||||||
memcpy(sigc, &sig, 4);
|
memcpy(sigc, &sig, 4);
|
||||||
sigc[4] = '\0';
|
sigc[4] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
// Todo checkbox to display all in hex
|
// Todo checkbox to display all in hex
|
||||||
if (isalnum(sigc[0]) && isalnum(sigc[1]) && isalnum(sigc[2]) && isalnum(sigc[3]))
|
if (isalnum(sigc[0]) && isalnum(sigc[1]) && isalnum(sigc[2]) && isalnum(sigc[3]))
|
||||||
|
@ -126,16 +130,6 @@ void CDebugDMALogView::RefreshList()
|
||||||
m_nLastStartIndex = dmaLogSize;
|
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*/)
|
LRESULT CDebugDMALogView::OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
//RefreshList();
|
//RefreshList();
|
||||||
|
@ -151,6 +145,9 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
||||||
m_nLastStartIndex = 0;
|
m_nLastStartIndex = 0;
|
||||||
|
|
||||||
m_DMAList.Attach(GetDlgItem(IDC_DMA_LIST));
|
m_DMAList.Attach(GetDlgItem(IDC_DMA_LIST));
|
||||||
|
m_DMARamEdit.Attach(GetDlgItem(IDC_DMA_RAM_EDIT));
|
||||||
|
m_DMARomEdit.Attach(GetDlgItem(IDC_DMA_ROM_EDIT));
|
||||||
|
m_BlockInfo.Attach(GetDlgItem(IDC_BLOCK_INFO));
|
||||||
|
|
||||||
m_DMAList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
|
m_DMAList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
|
||||||
|
|
||||||
|
@ -169,21 +166,41 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
||||||
//m_DMAList.SetColumnWidth(4, 50);
|
//m_DMAList.SetColumnWidth(4, 50);
|
||||||
//m_DMAList.SetColumnWidth(5, 50);
|
//m_DMAList.SetColumnWidth(5, 50);
|
||||||
|
|
||||||
m_DMARamEdit.Attach(GetDlgItem(IDC_DMA_RAM_EDIT));
|
|
||||||
m_DMARamEdit.SetLimitText(8);
|
m_DMARamEdit.SetLimitText(8);
|
||||||
|
|
||||||
m_DMARomEdit.Attach(GetDlgItem(IDC_DMA_ROM_EDIT));
|
|
||||||
m_DMARomEdit.SetLimitText(8);
|
m_DMARomEdit.SetLimitText(8);
|
||||||
|
|
||||||
m_BlockInfo.Attach(GetDlgItem(IDC_BLOCK_INFO));
|
|
||||||
|
|
||||||
RefreshList();
|
RefreshList();
|
||||||
|
|
||||||
LoadWindowPos();
|
LoadWindowPos();
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
|
|
||||||
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebugDMALogView::RefreshDMALogWindow(bool bReset)
|
||||||
|
{
|
||||||
|
if (m_hWnd == NULL || m_DMAList.m_hWnd == NULL)
|
||||||
|
{
|
||||||
|
if (bReset)
|
||||||
|
{
|
||||||
|
m_DMALog->ClearEntries();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PostMessage(WM_REFRESH, bReset);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CDebugDMALogView::OnRefresh(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
bool bReset = (bool)wParam;
|
||||||
|
|
||||||
|
if (bReset)
|
||||||
|
{
|
||||||
|
m_DMALog->ClearEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshList();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,11 +211,11 @@ void CDebugDMALogView::OnExitSizeMove(void)
|
||||||
|
|
||||||
LRESULT CDebugDMALogView::OnDestroy(void)
|
LRESULT CDebugDMALogView::OnDestroy(void)
|
||||||
{
|
{
|
||||||
if (m_AutoRefreshThread != NULL)
|
m_DMAList.Detach();
|
||||||
{
|
m_DMARamEdit.Detach();
|
||||||
TerminateThread(m_AutoRefreshThread, 0);
|
m_DMARomEdit.Detach();
|
||||||
CloseHandle(m_AutoRefreshThread);
|
m_BlockInfo.Detach();
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,16 @@ public:
|
||||||
CDebugDMALogView(CDebuggerUI * debugger);
|
CDebugDMALogView(CDebuggerUI * debugger);
|
||||||
virtual ~CDebugDMALogView(void);
|
virtual ~CDebugDMALogView(void);
|
||||||
|
|
||||||
void RefreshList();
|
void RefreshDMALogWindow(bool bReset = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
WM_REFRESH = WM_USER + 1
|
||||||
|
};
|
||||||
|
|
||||||
|
void RefreshList(void);
|
||||||
|
|
||||||
CDMALog* m_DMALog;
|
CDMALog* m_DMALog;
|
||||||
|
|
||||||
int m_nLastStartIndex;
|
int m_nLastStartIndex;
|
||||||
|
@ -34,9 +41,6 @@ private:
|
||||||
bool m_bUniqueRomAddresses;
|
bool m_bUniqueRomAddresses;
|
||||||
bool m_bFilterChanged;
|
bool m_bFilterChanged;
|
||||||
|
|
||||||
HANDLE m_AutoRefreshThread;
|
|
||||||
static DWORD WINAPI AutoRefreshProc(void* _this);
|
|
||||||
|
|
||||||
// Return true if entry meets requirements
|
// Return true if entry meets requirements
|
||||||
bool FilterEntry(int dmaLogIndex);
|
bool FilterEntry(int dmaLogIndex);
|
||||||
|
|
||||||
|
@ -48,6 +52,7 @@ private:
|
||||||
bool m_bCustomDrawClrNext;
|
bool m_bCustomDrawClrNext;
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
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 OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
LRESULT OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||||
|
@ -57,6 +62,7 @@ private:
|
||||||
void OnExitSizeMove(void);
|
void OnExitSizeMove(void);
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(CDebugDMALogView)
|
BEGIN_MSG_MAP_EX(CDebugDMALogView)
|
||||||
|
MESSAGE_HANDLER(WM_REFRESH, OnRefresh)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
||||||
|
|
|
@ -93,9 +93,9 @@ void CDebuggerUI::GameReset(CDebuggerUI * _this)
|
||||||
_this->m_CommandsView->Reset();
|
_this->m_CommandsView->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->m_DMALog)
|
if (_this->m_DMALogView)
|
||||||
{
|
{
|
||||||
_this->m_DMALog->ClearEntries();
|
_this->m_DMALogView->RefreshDMALogWindow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->m_StackTrace)
|
if (_this->m_StackTrace)
|
||||||
|
@ -254,6 +254,14 @@ void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDebuggerUI::Debug_RefreshDMALogWindow(void)
|
||||||
|
{
|
||||||
|
if (m_DMALogView)
|
||||||
|
{
|
||||||
|
m_DMALogView->RefreshDMALogWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CDebuggerUI::OpenMemorySearch()
|
void CDebuggerUI::OpenMemorySearch()
|
||||||
{
|
{
|
||||||
if (m_MemorySearch == NULL)
|
if (m_MemorySearch == NULL)
|
||||||
|
@ -647,6 +655,7 @@ void CDebuggerUI::HandleCartToRamDMA(void)
|
||||||
uint32_t dmaLen = opInfo.GetStoreValueUnsigned() + 1;
|
uint32_t dmaLen = opInfo.GetStoreValueUnsigned() + 1;
|
||||||
|
|
||||||
m_DMALog->AddEntry(dmaRomAddr, dmaRamAddr, dmaLen);
|
m_DMALog->AddEntry(dmaRomAddr, dmaRamAddr, dmaLen);
|
||||||
|
Debug_RefreshDMALogWindow();
|
||||||
|
|
||||||
// break if write breakpoint exists anywhere in target buffer
|
// break if write breakpoint exists anywhere in target buffer
|
||||||
if (m_Breakpoints->WriteBPExistsInChunk(dmaRamAddr, dmaLen))
|
if (m_Breakpoints->WriteBPExistsInChunk(dmaRamAddr, dmaLen))
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
void Debug_RefreshStackWindow(void);
|
void Debug_RefreshStackWindow(void);
|
||||||
void Debug_RefreshStackTraceWindow(void);
|
void Debug_RefreshStackTraceWindow(void);
|
||||||
void OpenDMALogWindow(void);
|
void OpenDMALogWindow(void);
|
||||||
|
void Debug_RefreshDMALogWindow(void);
|
||||||
void OpenCPULogWindow(void);
|
void OpenCPULogWindow(void);
|
||||||
void Debug_RefreshCPULogWindow(void);
|
void Debug_RefreshCPULogWindow(void);
|
||||||
void OpenExcBreakpointsWindow(void);
|
void OpenExcBreakpointsWindow(void);
|
||||||
|
|
Loading…
Reference in New Issue