[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)
{
if (m_hWnd)
{
SetForegroundWindow((HWND)m_hWnd);
}
else
if (m_hWnd == NULL)
{
DWORD ThreadID;
ResetEvent(m_CreatedEvent);
@ -74,5 +70,9 @@ public:
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;
}
LRESULT CAddSymbolDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& bHandled)
LRESULT CAddSymbolDlg::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
switch (wID)
{

View File

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

View File

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

View File

@ -62,7 +62,7 @@ void CDebugDMALogView::RefreshList()
bool bScrolledDown = false;
if ((scroll.nPage + scroll.nPos) - 1 == scroll.nMax)
if ((scroll.nPage + scroll.nPos) - 1 == (uint32_t)scroll.nMax)
{
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();
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);
@ -213,7 +213,7 @@ LRESULT CDebugDMALogView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL&
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)
{
@ -247,7 +247,7 @@ LRESULT CDebugDMALogView::OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWnd
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)
{

View File

@ -27,7 +27,7 @@ CDebugScripts::~CDebugScripts(void)
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);
@ -63,7 +63,6 @@ LRESULT CDebugScripts::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
void CDebugScripts::ConsolePrint(const char* text)
{
::ShowWindow(*this, SW_SHOWNOACTIVATE);
int textPos = m_ConsoleEdit.GetWindowTextLengthA();
// Get scrollbar state
SCROLLINFO scroll;
@ -77,7 +76,7 @@ void CDebugScripts::ConsolePrint(const char* text)
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();
}
@ -119,7 +118,7 @@ void CDebugScripts::ConsoleCopy()
m_ConsoleEdit.GetWindowTextA(memBuf, nChars);
GlobalUnlock(hMem);
HANDLE hRes = SetClipboardData(CF_TEXT, hMem);
SetClipboardData(CF_TEXT, hMem);
GlobalFree(hMem);
CloseClipboard();
@ -304,7 +303,7 @@ void CDebugScripts::EvaluateInSelectedInstance(char* code)
}
// 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)
{

View File

@ -66,7 +66,7 @@ LRESULT CDebugStackTrace::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
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();
return FALSE;

View File

@ -36,6 +36,7 @@ CScriptInstance* CScriptInstance::FetchInstance(duk_context* ctx)
return Cache[i];
}
}
return NULL;
}
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)
{
CScriptInstance* _this = FetchInstance(ctx);
_this->m_Debugger->Debug_ClearScriptsWindow();
FetchInstance(ctx)->m_Debugger->Debug_ClearScriptsWindow();
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();
return 1;
}

View File

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

View File

@ -36,30 +36,6 @@ public:
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:
void Debug_Reset(void);
void OpenMemoryDump(void);
@ -92,4 +68,32 @@ public:
CDMALog* DMALog();
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;
};