[Debugger] clean up warnings and code

This commit is contained in:
zilmar 2018-01-18 17:53:07 +11:00
parent 3d7e9b40b0
commit 73944b2636
10 changed files with 63 additions and 68 deletions

View File

@ -60,11 +60,7 @@ public:
void ShowWindow(void) void ShowWindow(void)
{ {
if (m_hWnd) if (m_hWnd == NULL)
{
SetForegroundWindow((HWND)m_hWnd);
}
else
{ {
DWORD ThreadID; DWORD ThreadID;
ResetEvent(m_CreatedEvent); ResetEvent(m_CreatedEvent);
@ -74,5 +70,9 @@ public:
WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification"); WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification");
} }
} }
if (m_hWnd)
{
SetForegroundWindow((HWND)m_hWnd);
}
} }
}; };

View File

@ -56,7 +56,7 @@ LRESULT CAddSymbolDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*l
return FALSE; return FALSE;
} }
LRESULT CAddSymbolDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& bHandled) LRESULT CAddSymbolDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
switch (wID) switch (wID)
{ {

View File

@ -497,7 +497,7 @@ const char* CDebugCommandsView::GetCodeAddressNotes(uint32_t vAddr)
return NULL; return NULL;
} }
void CDebugCommandsView::ShowAddress(DWORD address, BOOL top) void CDebugCommandsView::ShowAddress(uint32_t address, bool top)
{ {
if (top == TRUE) if (top == TRUE)
{ {
@ -710,25 +710,20 @@ LRESULT CDebugCommandsView::OnCustomDrawList(NMHDR* pNMHDR)
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR); NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
DWORD drawStage = pLVCD->nmcd.dwDrawStage; DWORD drawStage = pLVCD->nmcd.dwDrawStage;
HDC hDC = pLVCD->nmcd.hdc;
switch (drawStage) switch (drawStage)
{ {
case CDDS_PREPAINT: case CDDS_PREPAINT: return (CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT);
return (CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT); case CDDS_ITEMPREPAINT: return CDRF_NOTIFYSUBITEMDRAW;
case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): break;
case CDDS_POSTPAINT: case CDDS_POSTPAINT:
DrawBranchArrows(hDC); DrawBranchArrows(pLVCD->nmcd.hdc);
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
case CDDS_ITEMPREPAINT:
return CDRF_NOTIFYSUBITEMDRAW;
case (CDDS_ITEMPREPAINT | CDDS_SUBITEM):
break;
default: default:
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
} }
DWORD nItem = pLVCD->nmcd.dwItemSpec; uint32_t nItem = (uint32_t)pLVCD->nmcd.dwItemSpec;
DWORD nSubItem = pLVCD->iSubItem; uint32_t nSubItem = pLVCD->iSubItem;
uint32_t address = m_StartAddress + (nItem * 4); uint32_t address = m_StartAddress + (nItem * 4);
uint32_t pc = (g_Reg != NULL) ? g_Reg->m_PROGRAM_COUNTER : 0; uint32_t pc = (g_Reg != NULL) ? g_Reg->m_PROGRAM_COUNTER : 0;
@ -756,7 +751,7 @@ LRESULT CDebugCommandsView::OnCustomDrawList(NMHDR* pNMHDR)
{ {
// breakpoint // breakpoint
pLVCD->clrTextBk = RGB(0x44, 0x00, 0x00); pLVCD->clrTextBk = RGB(0x44, 0x00, 0x00);
pLVCD->clrText = (address == pc) ? pLVCD->clrText = (address == pc && isDebugging()) ?
RGB(0xFF, 0xFF, 0x00) : // breakpoint & current pc RGB(0xFF, 0xFF, 0x00) : // breakpoint & current pc
RGB(0xFF, 0xCC, 0xCC); RGB(0xFF, 0xCC, 0xCC);
} }
@ -764,7 +759,7 @@ LRESULT CDebugCommandsView::OnCustomDrawList(NMHDR* pNMHDR)
{ {
// breakpoint // breakpoint
pLVCD->clrTextBk = RGB(0x66, 0x44, 0x00); pLVCD->clrTextBk = RGB(0x66, 0x44, 0x00);
pLVCD->clrText = (address == pc) ? pLVCD->clrText = (address == pc && isDebugging()) ?
RGB(0xFF, 0xFF, 0x00) : // breakpoint & current pc RGB(0xFF, 0xFF, 0x00) : // breakpoint & current pc
RGB(0xFF, 0xEE, 0xCC); RGB(0xFF, 0xEE, 0xCC);
} }
@ -780,7 +775,6 @@ LRESULT CDebugCommandsView::OnCustomDrawList(NMHDR* pNMHDR)
pLVCD->clrTextBk = RGB(0xEE, 0xEE, 0xEE); pLVCD->clrTextBk = RGB(0xEE, 0xEE, 0xEE);
pLVCD->clrText = RGB(0x44, 0x44, 0x44); pLVCD->clrText = RGB(0x44, 0x44, 0x44);
} }
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
} }
@ -1562,7 +1556,6 @@ void CDebugCommandsView::SteppingOpsChanged(void)
} }
} }
void CDebugCommandsView::Reset() void CDebugCommandsView::Reset()
{ {
ClearEditedOps(); ClearEditedOps();

View File

@ -81,7 +81,7 @@ public:
CDebugCommandsView(CDebuggerUI * debugger, SyncEvent &StepEvent); CDebugCommandsView(CDebuggerUI * debugger, SyncEvent &StepEvent);
virtual ~CDebugCommandsView(void); virtual ~CDebugCommandsView(void);
void ShowAddress(DWORD address, BOOL top); void ShowAddress(uint32_t address, bool top);
void ShowPIRegTab(); void ShowPIRegTab();
void Reset(); void Reset();
@ -246,7 +246,7 @@ private:
CAddBreakpointDlg m_AddBreakpointDlg; CAddBreakpointDlg m_AddBreakpointDlg;
CAddSymbolDlg m_AddSymbolDlg; CAddSymbolDlg m_AddSymbolDlg;
DWORD m_StartAddress; uint32_t m_StartAddress;
CRect m_DefaultWindowRect; CRect m_DefaultWindowRect;
CEditNumber32 m_PCEdit; CEditNumber32 m_PCEdit;

View File

@ -62,7 +62,7 @@ void CDebugDMALogView::RefreshList()
bool bScrolledDown = false; bool bScrolledDown = false;
if ((scroll.nPage + scroll.nPos) - 1 == scroll.nMax) if ((scroll.nPage + scroll.nPos) - 1 == (uint32_t)scroll.nMax)
{ {
bScrolledDown = true; bScrolledDown = true;
} }
@ -136,13 +136,13 @@ DWORD WINAPI CDebugDMALogView::AutoRefreshProc(void* _this)
} }
} }
LRESULT CDebugDMALogView::OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CDebugDMALogView::OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
//RefreshList(); //RefreshList();
return FALSE; return FALSE;
} }
LRESULT CDebugDMALogView::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
DlgResize_Init(false, true); DlgResize_Init(false, true);
@ -213,7 +213,7 @@ LRESULT CDebugDMALogView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL&
return FALSE; return FALSE;
} }
LRESULT CDebugDMALogView::OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) LRESULT CDebugDMALogView::OnRamAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
if (m_bConvertingAddress) if (m_bConvertingAddress)
{ {
@ -247,7 +247,7 @@ LRESULT CDebugDMALogView::OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWnd
return FALSE; return FALSE;
} }
LRESULT CDebugDMALogView::OnRomAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) LRESULT CDebugDMALogView::OnRomAddrChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ {
if (m_bConvertingAddress) if (m_bConvertingAddress)
{ {

View File

@ -27,7 +27,7 @@ CDebugScripts::~CDebugScripts(void)
free(m_SelectedScriptName); free(m_SelectedScriptName);
} }
LRESULT CDebugScripts::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CDebugScripts::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
DlgResize_Init(false, true); DlgResize_Init(false, true);
@ -63,7 +63,6 @@ LRESULT CDebugScripts::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
void CDebugScripts::ConsolePrint(const char* text) void CDebugScripts::ConsolePrint(const char* text)
{ {
::ShowWindow(*this, SW_SHOWNOACTIVATE); ::ShowWindow(*this, SW_SHOWNOACTIVATE);
int textPos = m_ConsoleEdit.GetWindowTextLengthA();
// Get scrollbar state // Get scrollbar state
SCROLLINFO scroll; SCROLLINFO scroll;
@ -77,7 +76,7 @@ void CDebugScripts::ConsolePrint(const char* text)
m_ConsoleEdit.SetRedraw(TRUE); m_ConsoleEdit.SetRedraw(TRUE);
if ((scroll.nPage + scroll.nPos) - 1 == scroll.nMax) if ((scroll.nPage + scroll.nPos) - 1 == (uint32_t)scroll.nMax)
{ {
m_ConsoleEdit.ScrollCaret(); m_ConsoleEdit.ScrollCaret();
} }
@ -119,7 +118,7 @@ void CDebugScripts::ConsoleCopy()
m_ConsoleEdit.GetWindowTextA(memBuf, nChars); m_ConsoleEdit.GetWindowTextA(memBuf, nChars);
GlobalUnlock(hMem); GlobalUnlock(hMem);
HANDLE hRes = SetClipboardData(CF_TEXT, hMem); SetClipboardData(CF_TEXT, hMem);
GlobalFree(hMem); GlobalFree(hMem);
CloseClipboard(); CloseClipboard();
@ -304,7 +303,7 @@ void CDebugScripts::EvaluateInSelectedInstance(char* code)
} }
// Console input // Console input
LRESULT CEditEval::OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CEditEval::OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
{ {
if (wParam == VK_UP) if (wParam == VK_UP)
{ {

View File

@ -66,7 +66,7 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
return TRUE; return TRUE;
} }
LRESULT CDebugStackTrace::OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CDebugStackTrace::OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ {
Refresh(); Refresh();
return FALSE; return FALSE;

View File

@ -36,6 +36,7 @@ CScriptInstance* CScriptInstance::FetchInstance(duk_context* ctx)
return Cache[i]; return Cache[i];
} }
} }
return NULL;
} }
CScriptInstance::CScriptInstance(CDebuggerUI* debugger) CScriptInstance::CScriptInstance(CDebuggerUI* debugger)
@ -1374,14 +1375,12 @@ duk_ret_t CScriptInstance::js_ConsolePrint(duk_context* ctx)
duk_ret_t CScriptInstance::js_ConsoleClear(duk_context* ctx) duk_ret_t CScriptInstance::js_ConsoleClear(duk_context* ctx)
{ {
CScriptInstance* _this = FetchInstance(ctx); FetchInstance(ctx)->m_Debugger->Debug_ClearScriptsWindow();
_this->m_Debugger->Debug_ClearScriptsWindow();
return 1; return 1;
} }
duk_ret_t CScriptInstance::js_Pause(duk_context* ctx) duk_ret_t CScriptInstance::js_Pause(duk_context* /*ctx*/)
{ {
CScriptInstance* _this = FetchInstance(ctx);
g_System->Pause(); g_System->Pause();
return 1; return 1;
} }

View File

@ -145,7 +145,7 @@ void CSymbols::Load()
} }
char* endptr; char* endptr;
address = strtoull(m_ParserToken, &endptr, 16); address = (uint32_t)strtoull(m_ParserToken, &endptr, 16);
if (endptr == m_ParserToken) if (endptr == m_ParserToken)
{ {
@ -304,7 +304,7 @@ void CSymbols::GetValueString(char* dest, CSymbolEntry* lpSymbol)
break; break;
case TYPE_U64: case TYPE_U64:
g_MMU->LD_VAddr(address, v64); g_MMU->LD_VAddr(address, v64);
sprintf(dest, "%ull", v64); sprintf(dest, "%I64u", v64);
break; break;
case TYPE_S8: case TYPE_S8:
g_MMU->LB_VAddr(address, v8); g_MMU->LB_VAddr(address, v8);
@ -320,7 +320,7 @@ void CSymbols::GetValueString(char* dest, CSymbolEntry* lpSymbol)
break; break;
case TYPE_S64: case TYPE_S64:
g_MMU->LD_VAddr(address, v64); g_MMU->LD_VAddr(address, v64);
sprintf(dest, "%ill", v64); sprintf(dest, "%I64i", v64);
break; break;
case TYPE_FLOAT: case TYPE_FLOAT:
g_MMU->LW_VAddr(address, *(uint32_t*)&vf); g_MMU->LW_VAddr(address, *(uint32_t*)&vf);
@ -353,7 +353,7 @@ void CSymbols::Reset()
const char* CSymbols::GetNameByAddress(uint32_t address) const char* CSymbols::GetNameByAddress(uint32_t address)
{ {
int len = GetCount(); uint32_t len = GetCount();
for (uint32_t i = 0; i < len; i++) for (uint32_t i = 0; i < len; i++)
{ {
if (m_Symbols[i]->m_Address == address) if (m_Symbols[i]->m_Address == address)

View File

@ -36,30 +36,6 @@ public:
CDebuggerUI(); CDebuggerUI();
~CDebuggerUI(); ~CDebuggerUI();
private:
CDumpMemory * m_MemoryDump;
CDebugMemoryView * m_MemoryView;
CDebugMemorySearch * m_MemorySearch;
CDebugTlb * m_DebugTLB;
CDebugCommandsView * m_CommandsView;
CDebugScripts * m_Scripts;
CDebugSymbols * m_Symbols;
CDebugDMALogView * m_DMALogView;
CDebugStackTrace * m_StackTrace;
CDebugStackView * m_StackView;
CBreakpoints * m_Breakpoints;
CScriptSystem * m_ScriptSystem;
CDMALog * m_DMALog;
SyncEvent m_StepEvent;
protected:
void TLBChanged(void);
void CPUStepStarted(void);
void CPUStep(void);
void FrameDrawn(void);
public: public:
void Debug_Reset(void); void Debug_Reset(void);
void OpenMemoryDump(void); void OpenMemoryDump(void);
@ -92,4 +68,32 @@ public:
CDMALog* DMALog(); CDMALog* DMALog();
static void GameReset(CDebuggerUI * _this); static void GameReset(CDebuggerUI * _this);
protected:
void TLBChanged(void);
void CPUStepStarted(void);
void CPUStep(void);
void FrameDrawn(void);
private:
CDebuggerUI(const CDebuggerUI&); // Disable copy constructor
CDebuggerUI& operator=(const CDebuggerUI&); // Disable assignment
CDumpMemory * m_MemoryDump;
CDebugMemoryView * m_MemoryView;
CDebugMemorySearch * m_MemorySearch;
CDebugTlb * m_DebugTLB;
CDebugCommandsView * m_CommandsView;
CDebugScripts * m_Scripts;
CDebugSymbols * m_Symbols;
CDebugDMALogView * m_DMALogView;
CDebugStackTrace * m_StackTrace;
CDebugStackView * m_StackView;
CBreakpoints * m_Breakpoints;
CScriptSystem * m_ScriptSystem;
CDMALog * m_DMALog;
SyncEvent m_StepEvent;
}; };