2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project 64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2010-06-07 02:23:58 +00:00
|
|
|
#include "stdafx.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
#include "Debugger UI.h"
|
|
|
|
|
|
|
|
CPj64Module _Module;
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
CDebuggerUI::CDebuggerUI () :
|
|
|
|
m_MemoryDump(NULL),
|
|
|
|
m_MemoryView(NULL),
|
|
|
|
m_MemorySearch(NULL),
|
|
|
|
m_DebugTLB(NULL)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
|
|
|
g_Debugger = this;
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
CDebuggerUI::~CDebuggerUI (void)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
|
|
|
Debug_Reset();
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::GameReset ( CDebuggerUI * _this )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
if (!g_Settings->LoadBool(GameRunning_InReset))
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
return;
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
2015-11-06 21:22:02 +00:00
|
|
|
_this->Debug_Reset();
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::Debug_Reset ( void )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
if (m_MemoryDump)
|
|
|
|
{
|
|
|
|
m_MemoryDump->HideWindow();
|
|
|
|
delete m_MemoryDump;
|
|
|
|
m_MemoryDump = NULL;
|
|
|
|
}
|
|
|
|
if (m_MemoryView)
|
|
|
|
{
|
|
|
|
m_MemoryView->HideWindow();
|
|
|
|
delete m_MemoryView;
|
|
|
|
m_MemoryView = NULL;
|
|
|
|
}
|
|
|
|
if (m_MemorySearch)
|
|
|
|
{
|
|
|
|
m_MemorySearch->HideWindow();
|
|
|
|
delete m_MemorySearch;
|
|
|
|
m_MemorySearch = NULL;
|
|
|
|
}
|
|
|
|
if (m_DebugTLB)
|
|
|
|
{
|
|
|
|
m_DebugTLB->HideWindow();
|
|
|
|
delete m_DebugTLB;
|
|
|
|
m_DebugTLB = NULL;
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::Debug_ShowMemoryDump()
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
if (g_MMU == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (m_MemoryDump == NULL)
|
|
|
|
{
|
|
|
|
m_MemoryDump = new CDumpMemory(this);
|
|
|
|
}
|
|
|
|
if (m_MemoryDump)
|
|
|
|
{
|
|
|
|
m_MemoryDump->ShowWindow();
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::Debug_ShowMemoryWindow ( void )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
if (g_MMU == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (m_MemoryView == NULL)
|
|
|
|
{
|
|
|
|
m_MemoryView = new CDebugMemoryView(this);
|
|
|
|
}
|
|
|
|
if (m_MemoryView)
|
|
|
|
{
|
|
|
|
m_MemoryView->ShowWindow();
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
Debug_ShowMemoryWindow();
|
|
|
|
if (m_MemoryView)
|
|
|
|
{
|
|
|
|
m_MemoryView->ShowAddress(Address,VAddr);
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::Debug_ShowTLBWindow (void)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
if (g_MMU == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (m_DebugTLB == NULL)
|
|
|
|
{
|
|
|
|
m_DebugTLB = new CDebugTlb(this);
|
|
|
|
}
|
|
|
|
if (m_DebugTLB)
|
|
|
|
{
|
|
|
|
m_DebugTLB->ShowWindow();
|
|
|
|
}
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
2015-11-06 21:22:02 +00:00
|
|
|
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
2015-11-06 21:22:02 +00:00
|
|
|
if (m_DebugTLB)
|
|
|
|
{
|
|
|
|
m_DebugTLB->RefreshTLBWindow();
|
|
|
|
}
|
2015-01-31 19:27:27 +00:00
|
|
|
}
|
2015-11-06 21:22:02 +00:00
|
|
|
|
|
|
|
void CDebuggerUI::Debug_ShowMemorySearch()
|
|
|
|
{
|
|
|
|
if (m_MemorySearch == NULL)
|
|
|
|
{
|
|
|
|
m_MemorySearch = new CDebugMemorySearch(this);
|
|
|
|
}
|
|
|
|
if (m_MemorySearch)
|
|
|
|
{
|
|
|
|
m_MemorySearch->ShowWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::TLBChanged()
|
|
|
|
{
|
|
|
|
Debug_RefreshTLBWindow();
|
|
|
|
}
|