2016-01-27 09:11:59 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "DebuggerUI.h"
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2019-01-14 09:18:43 +00:00
|
|
|
#include "CPULog.h"
|
2017-08-18 05:08:22 +00:00
|
|
|
#include "DMALog.h"
|
|
|
|
#include "Symbols.h"
|
2021-09-03 05:11:04 +00:00
|
|
|
#include <sstream>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
CPj64Module _Module;
|
|
|
|
|
2017-06-18 23:08:35 +00:00
|
|
|
CDebuggerUI::CDebuggerUI() :
|
2021-04-12 11:35:39 +00:00
|
|
|
m_MemoryDump(nullptr),
|
|
|
|
m_MemoryView(nullptr),
|
|
|
|
m_MemorySearch(nullptr),
|
|
|
|
m_DebugTLB(nullptr),
|
|
|
|
m_CommandsView(nullptr),
|
|
|
|
m_Scripts(nullptr),
|
|
|
|
m_Symbols(nullptr),
|
|
|
|
m_Breakpoints(nullptr),
|
|
|
|
m_ScriptSystem(nullptr),
|
|
|
|
m_StackTrace(nullptr),
|
|
|
|
m_StackView(nullptr),
|
|
|
|
m_DMALogView(nullptr),
|
|
|
|
m_CPULogView(nullptr),
|
|
|
|
m_ExcBreakpoints(nullptr),
|
|
|
|
m_DMALog(nullptr),
|
|
|
|
m_CPULog(nullptr),
|
|
|
|
m_SymbolTable(nullptr),
|
2018-01-16 21:26:54 +00:00
|
|
|
m_StepEvent(false)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
g_Debugger = this;
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2017-09-13 12:00:53 +00:00
|
|
|
m_Breakpoints = new CBreakpoints();
|
|
|
|
m_ScriptSystem = new CScriptSystem(this);
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2017-09-13 12:00:53 +00:00
|
|
|
m_DMALog = new CDMALog();
|
2019-01-14 09:18:43 +00:00
|
|
|
m_CPULog = new CCPULog();
|
2019-12-25 00:41:20 +00:00
|
|
|
m_SymbolTable = new CSymbolTable(this);
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2017-06-18 23:08:35 +00:00
|
|
|
g_Settings->RegisterChangeCB(GameRunning_InReset, this, (CSettings::SettingChangedFunc)GameReset);
|
2018-01-18 12:25:36 +00:00
|
|
|
g_Settings->RegisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)SteppingOpsChanged);
|
2019-04-03 18:56:45 +00:00
|
|
|
g_Settings->RegisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunningChanged);
|
|
|
|
g_Settings->RegisterChangeCB(Game_GameName, this, (CSettings::SettingChangedFunc)GameNameChanged);
|
2021-09-03 05:11:04 +00:00
|
|
|
g_Settings->RegisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePausedChanged);
|
|
|
|
g_Settings->RegisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)WaitingForStepChanged);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2017-06-18 23:08:35 +00:00
|
|
|
CDebuggerUI::~CDebuggerUI(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2018-01-18 12:25:36 +00:00
|
|
|
g_Settings->UnregisterChangeCB(Debugger_SteppingOps, this, (CSettings::SettingChangedFunc)SteppingOpsChanged);
|
2017-06-18 23:08:35 +00:00
|
|
|
g_Settings->UnregisterChangeCB(GameRunning_InReset, this, (CSettings::SettingChangedFunc)GameReset);
|
2019-04-03 18:56:45 +00:00
|
|
|
g_Settings->RegisterChangeCB(GameRunning_CPU_Running, this, (CSettings::SettingChangedFunc)GameCpuRunningChanged);
|
|
|
|
g_Settings->UnregisterChangeCB(Game_GameName, this, (CSettings::SettingChangedFunc)GameNameChanged);
|
2021-09-03 05:11:04 +00:00
|
|
|
g_Settings->UnregisterChangeCB(GameRunning_CPU_Paused, this, (CSettings::SettingChangedFunc)GamePausedChanged);
|
|
|
|
g_Settings->UnregisterChangeCB(Debugger_WaitingForStep, this, (CSettings::SettingChangedFunc)WaitingForStepChanged);
|
2016-01-27 09:11:59 +00:00
|
|
|
Debug_Reset();
|
2017-09-13 12:00:53 +00:00
|
|
|
delete m_MemoryView;
|
|
|
|
delete m_CommandsView;
|
|
|
|
delete m_Scripts;
|
|
|
|
delete m_ScriptSystem;
|
|
|
|
delete m_Breakpoints;
|
|
|
|
delete m_Symbols;
|
|
|
|
delete m_MemorySearch;
|
|
|
|
delete m_StackTrace;
|
|
|
|
delete m_DMALogView;
|
2019-01-14 09:18:43 +00:00
|
|
|
delete m_CPULogView;
|
2019-01-17 09:34:24 +00:00
|
|
|
delete m_ExcBreakpoints;
|
2017-09-13 12:00:53 +00:00
|
|
|
delete m_DMALog;
|
2019-01-14 09:18:43 +00:00
|
|
|
delete m_CPULog;
|
2019-12-25 00:41:20 +00:00
|
|
|
delete m_SymbolTable;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2018-01-18 12:25:36 +00:00
|
|
|
void CDebuggerUI::SteppingOpsChanged(CDebuggerUI * _this)
|
|
|
|
{
|
|
|
|
if (g_Settings->LoadBool(Debugger_SteppingOps))
|
|
|
|
{
|
2021-09-03 05:11:04 +00:00
|
|
|
if (!g_Settings->LoadBool(Debugger_SilentBreak))
|
|
|
|
{
|
|
|
|
_this->OpenCommandWindow();
|
|
|
|
}
|
|
|
|
g_Settings->SaveBool(Debugger_SilentBreak, false);
|
2018-01-18 12:25:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-03 18:56:45 +00:00
|
|
|
void CDebuggerUI::GameCpuRunningChanged(CDebuggerUI * _this)
|
|
|
|
{
|
|
|
|
if (!g_Settings->LoadBool(GameRunning_CPU_Running))
|
|
|
|
{
|
|
|
|
if (_this->m_MemorySearch)
|
|
|
|
{
|
|
|
|
_this->m_MemorySearch->GameReset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::GameNameChanged(CDebuggerUI * _this)
|
|
|
|
{
|
|
|
|
if (_this->m_MemorySearch)
|
|
|
|
{
|
|
|
|
_this->m_MemorySearch->GameReset();
|
|
|
|
}
|
2021-09-03 05:11:04 +00:00
|
|
|
|
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_LOADED_ROM;
|
|
|
|
_this->m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::GamePausedChanged(CDebuggerUI * _this)
|
|
|
|
{
|
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = g_Settings->LoadBool(GameRunning_CPU_Paused) ? JS_EMU_PAUSED : JS_EMU_RESUMED;
|
|
|
|
_this->m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::WaitingForStepChanged(CDebuggerUI* _this)
|
|
|
|
{
|
|
|
|
if (g_Settings->LoadBool(Debugger_WaitingForStep))
|
|
|
|
{
|
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_DEBUG_PAUSED;
|
|
|
|
_this->ScriptSystem()->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_DEBUG_RESUMED;
|
|
|
|
_this->ScriptSystem()->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
|
|
|
}
|
2019-04-03 18:56:45 +00:00
|
|
|
}
|
|
|
|
|
2017-06-18 23:08:35 +00:00
|
|
|
void CDebuggerUI::GameReset(CDebuggerUI * _this)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
if (!g_Settings->LoadBool(GameRunning_InReset))
|
|
|
|
{
|
2021-09-03 05:11:04 +00:00
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_RESET;
|
|
|
|
_this->m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
2017-09-13 12:00:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_RESETTING;
|
|
|
|
_this->m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
|
|
|
|
2017-09-13 12:00:53 +00:00
|
|
|
if (_this->m_CommandsView)
|
|
|
|
{
|
|
|
|
_this->m_CommandsView->Reset();
|
|
|
|
}
|
|
|
|
|
2019-04-02 19:16:39 +00:00
|
|
|
if (_this->m_DMALogView)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
2019-04-02 19:16:39 +00:00
|
|
|
_this->m_DMALogView->RefreshDMALogWindow(true);
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_this->m_StackTrace)
|
|
|
|
{
|
|
|
|
_this->m_StackTrace->ClearEntries();
|
|
|
|
}
|
|
|
|
|
2019-12-25 00:41:20 +00:00
|
|
|
if (_this->m_SymbolTable)
|
|
|
|
{
|
|
|
|
_this->m_SymbolTable->Load();
|
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
|
|
|
if (_this->m_Symbols)
|
|
|
|
{
|
|
|
|
_this->m_Symbols->Refresh();
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2017-06-18 23:08:35 +00:00
|
|
|
void CDebuggerUI::Debug_Reset(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
if (m_MemoryDump)
|
|
|
|
{
|
|
|
|
m_MemoryDump->HideWindow();
|
|
|
|
delete m_MemoryDump;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_MemoryDump = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
if (m_MemorySearch)
|
|
|
|
{
|
|
|
|
m_MemorySearch->HideWindow();
|
|
|
|
delete m_MemorySearch;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_MemorySearch = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
if (m_DebugTLB)
|
|
|
|
{
|
|
|
|
m_DebugTLB->HideWindow();
|
|
|
|
delete m_DebugTLB;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_DebugTLB = nullptr;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
if (m_MemoryView)
|
|
|
|
{
|
|
|
|
m_MemoryView->HideWindow();
|
|
|
|
delete m_MemoryView;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_MemoryView = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
if (m_CommandsView)
|
|
|
|
{
|
|
|
|
m_CommandsView->HideWindow();
|
|
|
|
delete m_CommandsView;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_CommandsView = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
if (m_Scripts)
|
|
|
|
{
|
|
|
|
m_Scripts->HideWindow();
|
|
|
|
delete m_Scripts;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_Scripts = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
if (m_Symbols)
|
|
|
|
{
|
|
|
|
m_Symbols->HideWindow();
|
|
|
|
delete m_Symbols;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_Symbols = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
if (m_DMALogView)
|
|
|
|
{
|
|
|
|
m_DMALogView->HideWindow();
|
|
|
|
delete m_DMALogView;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_DMALogView = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
2019-01-14 09:18:43 +00:00
|
|
|
if (m_CPULogView)
|
|
|
|
{
|
|
|
|
m_CPULogView->HideWindow();
|
|
|
|
delete m_CPULogView;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_CPULogView = nullptr;
|
2019-01-14 09:18:43 +00:00
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
if (m_StackTrace)
|
|
|
|
{
|
|
|
|
m_StackTrace->HideWindow();
|
|
|
|
delete m_StackTrace;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_StackTrace = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
if (m_StackView)
|
|
|
|
{
|
|
|
|
m_StackView->HideWindow();
|
|
|
|
delete m_StackView;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_StackView = nullptr;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
2019-01-17 09:34:24 +00:00
|
|
|
if (m_ExcBreakpoints)
|
|
|
|
{
|
|
|
|
m_ExcBreakpoints->HideWindow();
|
|
|
|
delete m_ExcBreakpoints;
|
2021-04-12 11:35:39 +00:00
|
|
|
m_ExcBreakpoints = nullptr;
|
2019-01-17 09:34:24 +00:00
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenMemoryDump()
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (g_MMU == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_MemoryDump == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
m_MemoryDump = new CDumpMemory(this);
|
|
|
|
}
|
|
|
|
if (m_MemoryDump)
|
|
|
|
{
|
|
|
|
m_MemoryDump->ShowWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenMemoryWindow(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_MemoryView == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
m_MemoryView = new CDebugMemoryView(this);
|
|
|
|
}
|
|
|
|
if (m_MemoryView)
|
|
|
|
{
|
|
|
|
m_MemoryView->ShowWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-18 23:08:35 +00:00
|
|
|
void CDebuggerUI::Debug_ShowMemoryLocation(uint32_t Address, bool VAddr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2018-01-10 07:05:57 +00:00
|
|
|
OpenMemoryWindow();
|
2016-01-27 09:11:59 +00:00
|
|
|
if (m_MemoryView)
|
|
|
|
{
|
2017-06-18 23:08:35 +00:00
|
|
|
m_MemoryView->ShowAddress(Address, VAddr);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenTLBWindow(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (g_MMU == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_DebugTLB == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
m_DebugTLB = new CDebugTlb(this);
|
|
|
|
}
|
|
|
|
if (m_DebugTLB)
|
|
|
|
{
|
|
|
|
m_DebugTLB->ShowWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
|
|
|
{
|
|
|
|
if (m_DebugTLB)
|
|
|
|
{
|
|
|
|
m_DebugTLB->RefreshTLBWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-02 18:28:46 +00:00
|
|
|
void CDebuggerUI::Debug_RefreshDMALogWindow(void)
|
|
|
|
{
|
|
|
|
if (m_DMALogView)
|
|
|
|
{
|
|
|
|
m_DMALogView->RefreshDMALogWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenMemorySearch()
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_MemorySearch == nullptr)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
m_MemorySearch = new CDebugMemorySearch(this);
|
|
|
|
}
|
|
|
|
if (m_MemorySearch)
|
|
|
|
{
|
|
|
|
m_MemorySearch->ShowWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenCommandWindow()
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_CommandsView == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
2018-01-16 21:26:54 +00:00
|
|
|
m_CommandsView = new CDebugCommandsView(this, m_StepEvent);
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
|
|
|
m_CommandsView->ShowWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_ShowCommandsLocation(uint32_t address, bool top)
|
|
|
|
{
|
2018-01-10 07:05:57 +00:00
|
|
|
OpenCommandWindow();
|
2017-09-13 12:00:53 +00:00
|
|
|
if (m_CommandsView)
|
|
|
|
{
|
|
|
|
m_CommandsView->ShowAddress(address, top);
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenScriptsWindow()
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_Scripts == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_Scripts = new CDebugScripts(this);
|
|
|
|
}
|
|
|
|
m_Scripts->ShowWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_RefreshScriptsWindow()
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_Scripts != nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_Scripts->RefreshList();
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_LogScriptsWindow(const char* text)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_Scripts != nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_Scripts->ConsolePrint(text);
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_ClearScriptsWindow()
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_Scripts != nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_Scripts->ConsoleClear();
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenSymbolsWindow()
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_Symbols == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_Symbols = new CDebugSymbols(this);
|
|
|
|
}
|
|
|
|
m_Symbols->ShowWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_RefreshSymbolsWindow()
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_Symbols != nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_Symbols->Refresh();
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenDMALogWindow(void)
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_DMALogView == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_DMALogView = new CDebugDMALogView(this);
|
|
|
|
}
|
|
|
|
m_DMALogView->ShowWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2019-01-14 09:18:43 +00:00
|
|
|
void CDebuggerUI::OpenCPULogWindow(void)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_CPULogView == nullptr)
|
2019-01-14 09:18:43 +00:00
|
|
|
{
|
|
|
|
m_CPULogView = new CDebugCPULogView(this);
|
|
|
|
}
|
|
|
|
m_CPULogView->ShowWindow();
|
|
|
|
}
|
|
|
|
|
2019-01-17 09:34:24 +00:00
|
|
|
void CDebuggerUI::OpenExcBreakpointsWindow(void)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_ExcBreakpoints == nullptr)
|
2019-01-17 09:34:24 +00:00
|
|
|
{
|
|
|
|
m_ExcBreakpoints = new CDebugExcBreakpoints(this);
|
|
|
|
}
|
|
|
|
m_ExcBreakpoints->ShowWindow();
|
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenStackTraceWindow(void)
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_StackTrace == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_StackTrace = new CDebugStackTrace(this);
|
|
|
|
}
|
|
|
|
m_StackTrace->ShowWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2018-01-10 07:05:57 +00:00
|
|
|
void CDebuggerUI::OpenStackViewWindow(void)
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_StackView == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_StackView = new CDebugStackView(this);
|
|
|
|
}
|
|
|
|
m_StackView->ShowWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::Debug_RefreshStackWindow(void)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_StackView != nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_StackView->Refresh();
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2017-08-30 04:54:06 +00:00
|
|
|
void CDebuggerUI::Debug_RefreshStackTraceWindow(void)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_StackTrace != nullptr && m_StackTrace->m_hWnd != nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_StackTrace->Refresh();
|
|
|
|
}
|
2017-08-30 04:54:06 +00:00
|
|
|
}
|
|
|
|
|
2019-01-14 09:18:43 +00:00
|
|
|
void CDebuggerUI::Debug_RefreshCPULogWindow(void)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_CPULogView != nullptr)
|
2019-01-14 09:18:43 +00:00
|
|
|
{
|
|
|
|
m_CPULogView->RefreshList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-18 05:08:22 +00:00
|
|
|
CBreakpoints* CDebuggerUI::Breakpoints()
|
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
return m_Breakpoints;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CScriptSystem* CDebuggerUI::ScriptSystem()
|
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
return m_ScriptSystem;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CDebugScripts* CDebuggerUI::ScriptConsole()
|
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
return m_Scripts;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CDMALog* CDebuggerUI::DMALog()
|
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
return m_DMALog;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2019-01-14 09:18:43 +00:00
|
|
|
CCPULog* CDebuggerUI::CPULog()
|
|
|
|
{
|
|
|
|
return m_CPULog;
|
|
|
|
}
|
|
|
|
|
2019-12-25 00:41:20 +00:00
|
|
|
CSymbolTable* CDebuggerUI::SymbolTable()
|
|
|
|
{
|
|
|
|
return m_SymbolTable;
|
|
|
|
}
|
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
SyncEvent& CDebuggerUI::StepEvent()
|
|
|
|
{
|
|
|
|
return m_StepEvent;
|
|
|
|
}
|
|
|
|
|
2017-08-18 05:08:22 +00:00
|
|
|
// CDebugger implementation
|
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
void CDebuggerUI::TLBChanged()
|
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
Debug_RefreshTLBWindow();
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// Exception handling - break on exception vector if exception breakpoint is set
|
2019-01-14 09:18:43 +00:00
|
|
|
void CDebuggerUI::HandleCPUException(void)
|
|
|
|
{
|
2019-01-17 09:34:24 +00:00
|
|
|
int exc = (g_Reg->CAUSE_REGISTER >> 2) & 0x1F;
|
2019-08-20 22:20:49 +00:00
|
|
|
int intr = (g_Reg->CAUSE_REGISTER >> 8) & 0xFF;
|
|
|
|
int fpExc = (g_Reg->m_FPCR[31] >> 12) & 0x3F;
|
|
|
|
int rcpIntr = g_Reg->MI_INTR_REG & 0x2F;
|
|
|
|
|
|
|
|
if ((ExceptionBreakpoints() & (1 << exc)))
|
2019-01-14 09:18:43 +00:00
|
|
|
{
|
2021-03-18 03:50:34 +00:00
|
|
|
if (exc == 15) // Floating-point exception
|
2019-08-20 22:20:49 +00:00
|
|
|
{
|
|
|
|
if (fpExc & FpExceptionBreakpoints())
|
|
|
|
{
|
|
|
|
goto have_bp;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2021-03-18 03:50:34 +00:00
|
|
|
else if (exc == 0) // Interrupt exception
|
2019-08-20 22:20:49 +00:00
|
|
|
{
|
|
|
|
if (intr & IntrBreakpoints())
|
|
|
|
{
|
|
|
|
if (intr & 0x04) // RCP interrupt (IP2)
|
|
|
|
{
|
|
|
|
if (rcpIntr & RcpIntrBreakpoints())
|
|
|
|
{
|
|
|
|
goto have_bp;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2021-03-18 03:50:34 +00:00
|
|
|
else // Other interrupts
|
2019-08-20 22:20:49 +00:00
|
|
|
{
|
|
|
|
goto have_bp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2021-03-18 03:50:34 +00:00
|
|
|
else // Other exceptions
|
2019-01-14 09:18:43 +00:00
|
|
|
{
|
2019-08-20 22:20:49 +00:00
|
|
|
goto have_bp;
|
2019-01-14 09:18:43 +00:00
|
|
|
}
|
2019-08-20 22:20:49 +00:00
|
|
|
}
|
2019-01-14 09:18:43 +00:00
|
|
|
|
2019-08-20 22:20:49 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
have_bp:
|
|
|
|
if (bCPULoggingEnabled())
|
|
|
|
{
|
|
|
|
g_Debugger->OpenCPULogWindow();
|
2019-01-14 09:18:43 +00:00
|
|
|
}
|
2019-08-20 22:20:49 +00:00
|
|
|
|
|
|
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
2019-01-14 09:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::HandleCartToRamDMA(void)
|
|
|
|
{
|
|
|
|
COpInfo opInfo(R4300iOp::m_Opcode);
|
|
|
|
|
|
|
|
uint32_t dmaRomAddr = g_Reg->PI_CART_ADDR_REG & 0x0FFFFFFF;
|
|
|
|
uint32_t dmaRamAddr = g_Reg->PI_DRAM_ADDR_REG | 0x80000000;
|
|
|
|
uint32_t dmaLen = opInfo.GetStoreValueUnsigned() + 1;
|
|
|
|
|
|
|
|
m_DMALog->AddEntry(dmaRomAddr, dmaRamAddr, dmaLen);
|
2019-04-02 18:28:46 +00:00
|
|
|
Debug_RefreshDMALogWindow();
|
|
|
|
|
2021-03-18 03:50:34 +00:00
|
|
|
// Break if write breakpoint exists anywhere in target buffer
|
2019-01-14 09:18:43 +00:00
|
|
|
if (m_Breakpoints->WriteBPExistsInChunk(dmaRamAddr, dmaLen))
|
|
|
|
{
|
|
|
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-18 05:08:22 +00:00
|
|
|
// Called from the interpreter core at the beginning of every CPU step
|
2018-01-17 11:36:28 +00:00
|
|
|
void CDebuggerUI::CPUStepStarted()
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2019-01-19 20:14:26 +00:00
|
|
|
if (isStepping() && bCPULoggingEnabled())
|
|
|
|
{
|
|
|
|
Debug_RefreshCPULogWindow();
|
|
|
|
}
|
|
|
|
|
2021-10-11 03:08:48 +00:00
|
|
|
if(m_Breakpoints->NumMemLocks() > 0)
|
2019-01-14 09:18:43 +00:00
|
|
|
{
|
2021-10-11 03:08:48 +00:00
|
|
|
COpInfo opInfo(R4300iOp::m_Opcode);
|
|
|
|
bool bStoreOp = opInfo.IsStoreCommand();
|
|
|
|
|
|
|
|
if (bStoreOp)
|
2019-01-14 09:18:43 +00:00
|
|
|
{
|
2021-10-11 03:08:48 +00:00
|
|
|
uint32_t storeAddress = bStoreOp ? opInfo.GetLoadStoreAddress() : 0;
|
|
|
|
if (m_Breakpoints->MemLockExists(storeAddress, opInfo.NumBytesToStore()))
|
|
|
|
{
|
|
|
|
// Memory is locked, skip op
|
|
|
|
g_Settings->SaveBool(Debugger_SkipOp, true);
|
|
|
|
return;
|
|
|
|
}
|
2019-01-14 09:18:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-10-11 03:08:48 +00:00
|
|
|
if (m_ScriptSystem->HaveAppCallbacks())
|
|
|
|
{
|
|
|
|
JSHookCpuStepEnv hookEnv;
|
|
|
|
hookEnv.pc = g_Reg->m_PROGRAM_COUNTER;
|
|
|
|
hookEnv.opInfo = COpInfo(R4300iOp::m_Opcode);
|
|
|
|
|
|
|
|
if(m_ScriptSystem->HaveCpuExecCallbacks(hookEnv.pc))
|
|
|
|
{
|
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_CPU_EXEC, (void*)&hookEnv);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hookEnv.opInfo.IsLoadCommand() &&
|
|
|
|
m_ScriptSystem->HaveCpuReadCallbacks(hookEnv.opInfo.GetLoadStoreAddress()))
|
|
|
|
{
|
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_CPU_READ, (void*)&hookEnv);
|
|
|
|
}
|
|
|
|
else if (hookEnv.opInfo.IsStoreCommand() &&
|
|
|
|
m_ScriptSystem->HaveCpuWriteCallbacks(hookEnv.opInfo.GetLoadStoreAddress()))
|
|
|
|
{
|
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_CPU_WRITE, (void*)&hookEnv);
|
|
|
|
}
|
|
|
|
}
|
2019-12-01 10:10:36 +00:00
|
|
|
|
2019-01-17 09:34:24 +00:00
|
|
|
if (CDebugSettings::ExceptionBreakpoints() != 0)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
2021-10-11 03:08:48 +00:00
|
|
|
uint32_t pc = g_Reg->m_PROGRAM_COUNTER;
|
|
|
|
|
2019-01-17 09:34:24 +00:00
|
|
|
if (pc == 0x80000000 || pc == 0x80000080 ||
|
|
|
|
pc == 0xA0000100 || pc == 0x80000180)
|
|
|
|
{
|
2021-03-18 03:50:34 +00:00
|
|
|
if ((g_Reg->STATUS_REGISTER >> 1) & 3) // If EXL/ERL bits are set
|
2019-08-20 22:20:49 +00:00
|
|
|
{
|
|
|
|
HandleCPUException();
|
|
|
|
}
|
2019-01-17 09:34:24 +00:00
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
2019-01-20 08:52:49 +00:00
|
|
|
|
2019-12-01 10:10:36 +00:00
|
|
|
if (m_Breakpoints->HaveRegBP())
|
2019-01-20 08:52:49 +00:00
|
|
|
{
|
2021-10-11 03:08:48 +00:00
|
|
|
COpInfo opInfo(R4300iOp::m_Opcode);
|
|
|
|
|
2019-12-01 10:10:36 +00:00
|
|
|
if (m_Breakpoints->HaveAnyGPRWriteBP())
|
2019-01-20 08:52:49 +00:00
|
|
|
{
|
2019-12-01 10:10:36 +00:00
|
|
|
int nReg = 0;
|
|
|
|
opInfo.WritesGPR(&nReg);
|
|
|
|
|
|
|
|
if (nReg != 0 && m_Breakpoints->HaveGPRWriteBP(nReg))
|
|
|
|
{
|
|
|
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
|
|
|
}
|
2019-01-20 08:52:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-01 10:10:36 +00:00
|
|
|
if (m_Breakpoints->HaveAnyGPRReadBP())
|
|
|
|
{
|
|
|
|
int nReg1 = 0, nReg2 = 0;
|
|
|
|
opInfo.ReadsGPR(&nReg1, &nReg2);
|
2019-01-20 08:52:49 +00:00
|
|
|
|
2019-12-01 10:10:36 +00:00
|
|
|
if ((nReg1 != 0 && m_Breakpoints->HaveGPRReadBP(nReg1)) ||
|
|
|
|
(nReg2 != 0 && m_Breakpoints->HaveGPRReadBP(nReg2)))
|
|
|
|
{
|
|
|
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_Breakpoints->HaveHIWriteBP() && opInfo.WritesHI() ||
|
|
|
|
m_Breakpoints->HaveLOWriteBP() && opInfo.WritesLO() ||
|
|
|
|
m_Breakpoints->HaveHIReadBP() && opInfo.ReadsHI() ||
|
|
|
|
m_Breakpoints->HaveLOReadBP() && opInfo.ReadsLO())
|
2019-01-20 08:52:49 +00:00
|
|
|
{
|
|
|
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
|
|
|
}
|
|
|
|
}
|
2019-01-17 09:34:24 +00:00
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2019-01-17 09:34:24 +00:00
|
|
|
// Called before opcode is executed (not called if SkipOp is set)
|
|
|
|
void CDebuggerUI::CPUStep()
|
|
|
|
{
|
2019-01-14 09:18:43 +00:00
|
|
|
if (bCPULoggingEnabled())
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
2019-01-14 09:18:43 +00:00
|
|
|
m_CPULog->PushState();
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2019-01-17 09:34:24 +00:00
|
|
|
// Called after opcode has been executed
|
|
|
|
void CDebuggerUI::CPUStepEnded()
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (m_StackTrace == nullptr)
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
2019-12-01 10:10:36 +00:00
|
|
|
return;
|
2017-09-13 12:00:53 +00:00
|
|
|
}
|
2019-12-01 10:10:36 +00:00
|
|
|
|
|
|
|
OPCODE Opcode = R4300iOp::m_Opcode;
|
|
|
|
uint32_t op = Opcode.op;
|
|
|
|
uint32_t funct = Opcode.funct;
|
2017-09-13 12:00:53 +00:00
|
|
|
|
|
|
|
if (op == R4300i_JAL || ((op == R4300i_SPECIAL) && (funct == R4300i_SPECIAL_JALR) && (Opcode.rd == 31))) // JAL or JALR RA, x
|
|
|
|
{
|
|
|
|
m_StackTrace->PushEntry(R4300iOp::m_JumpToLocation, g_Reg->m_PROGRAM_COUNTER);
|
|
|
|
}
|
|
|
|
else if (funct == R4300i_SPECIAL_JR && Opcode.rs == 31) // JR RA
|
|
|
|
{
|
|
|
|
m_StackTrace->PopEntry();
|
|
|
|
}
|
2021-03-18 03:50:34 +00:00
|
|
|
else if (op == R4300i_CP0 && funct == R4300i_COP0_CO_ERET) // TODO: may need more work
|
2017-09-13 12:00:53 +00:00
|
|
|
{
|
|
|
|
m_StackTrace->ClearEntries();
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::FrameDrawn()
|
|
|
|
{
|
2021-09-03 05:11:04 +00:00
|
|
|
//RenderWindow* mainWindow = g_Plugins->MainWindow();
|
|
|
|
//HWND hMainWnd = (HWND)mainWindow->GetWindowHandle();
|
|
|
|
// todo: m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_GFXUPDATE, ...);
|
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
void CDebuggerUI::PIFReadStarted(void)
|
|
|
|
{
|
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_PIFREAD);
|
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
void CDebuggerUI::RSPReceivedTask(void)
|
|
|
|
{
|
|
|
|
JSHookSpTaskEnv env;
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
DebugLoad_VAddr(0xA4000FC0, env.taskType);
|
|
|
|
DebugLoad_VAddr(0xA4000FC4, env.taskFlags);
|
|
|
|
DebugLoad_VAddr(0xA4000FC8, env.ucodeBootAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FCC, env.ucodeBootSize);
|
|
|
|
DebugLoad_VAddr(0xA4000FD0, env.ucodeAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FD4, env.ucodeSize);
|
|
|
|
DebugLoad_VAddr(0xA4000FD8, env.ucodeDataAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FDC, env.ucodeDataSize);
|
|
|
|
DebugLoad_VAddr(0xA4000FE0, env.dramStackAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FE4, env.dramStackSize);
|
|
|
|
DebugLoad_VAddr(0xA4000FE8, env.outputBuffAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FEC, env.outputBuffSize);
|
|
|
|
DebugLoad_VAddr(0xA4000FF0, env.dataAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FF4, env.dataSize);
|
|
|
|
DebugLoad_VAddr(0xA4000FF8, env.yieldDataAddress);
|
|
|
|
DebugLoad_VAddr(0xA4000FFC, env.yieldDataSize);
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_RSPTASK, &env);
|
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
void CDebuggerUI::PIDMAReadStarted(void)
|
|
|
|
{
|
|
|
|
JSHookPiDmaEnv env;
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
env.direction = 1;
|
|
|
|
DebugLoad_VAddr(0xA4600000, env.dramAddress);
|
|
|
|
DebugLoad_VAddr(0xA4600004, env.cartAddress);
|
|
|
|
DebugLoad_VAddr(0xA4600008, env.length);
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_PIDMA, &env);
|
|
|
|
}
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
void CDebuggerUI::PIDMAWriteStarted(void)
|
|
|
|
{
|
|
|
|
JSHookPiDmaEnv env;
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
env.direction = 0;
|
|
|
|
DebugLoad_VAddr(0xA4600000, env.dramAddress);
|
|
|
|
DebugLoad_VAddr(0xA4600004, env.cartAddress);
|
|
|
|
DebugLoad_VAddr(0xA460000C, env.length);
|
2017-09-13 12:00:53 +00:00
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_PIDMA, &env);
|
|
|
|
|
|
|
|
HandleCartToRamDMA();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::EmulationStarted(void)
|
|
|
|
{
|
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_STARTED;
|
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::EmulationStopped(void)
|
|
|
|
{
|
|
|
|
JSHookEmuStateChangeEnv env;
|
|
|
|
env.state = JS_EMU_STOPPED;
|
|
|
|
m_ScriptSystem->InvokeAppCallbacks(JS_HOOK_EMUSTATECHANGE, &env);
|
2018-01-16 21:26:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebuggerUI::WaitForStep(void)
|
|
|
|
{
|
|
|
|
g_Settings->SaveBool(Debugger_WaitingForStep, true);
|
|
|
|
m_StepEvent.IsTriggered(SyncEvent::INFINITE_TIMEOUT);
|
|
|
|
g_Settings->SaveBool(Debugger_WaitingForStep, false);
|
|
|
|
}
|
|
|
|
|
2021-09-03 05:11:04 +00:00
|
|
|
void CDebuggerUI::StartAutorunScripts(void)
|
|
|
|
{
|
|
|
|
if (m_ScriptSystem == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_ScriptSystem->ExecAutorunList();
|
|
|
|
}
|
|
|
|
|
2018-01-16 21:26:54 +00:00
|
|
|
bool CDebuggerUI::ExecutionBP(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->ExecutionBPExists(address, true) != CBreakpoints::BP_NOT_SET;
|
2018-01-16 21:26:54 +00:00
|
|
|
}
|
2018-02-01 17:28:08 +00:00
|
|
|
|
2018-02-05 06:43:46 +00:00
|
|
|
bool CDebuggerUI::ReadBP8(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists8(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-05 06:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDebuggerUI::ReadBP16(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists16(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-05 06:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDebuggerUI::ReadBP32(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists32(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-05 06:43:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDebuggerUI::ReadBP64(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->ReadBPExists64(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-05 06:43:46 +00:00
|
|
|
}
|
|
|
|
|
2018-02-01 17:28:08 +00:00
|
|
|
bool CDebuggerUI::WriteBP8(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists8(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-01 17:28:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDebuggerUI::WriteBP16(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists16(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-01 17:28:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDebuggerUI::WriteBP32(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists32(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-01 17:28:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CDebuggerUI::WriteBP64(uint32_t address)
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
return m_Breakpoints != nullptr && m_Breakpoints->WriteBPExists64(address) != CBreakpoints::BP_NOT_SET;
|
2018-02-01 17:28:08 +00:00
|
|
|
}
|