[Proeject64] Add execution break point in recompiler
This commit is contained in:
parent
2c802bd638
commit
0ffb6bb159
|
@ -54,6 +54,7 @@ const char * SystemEventName(SystemEvent event)
|
||||||
case SysEvent_Interrupt_DP: return "SysEvent_Interrupt_DP";
|
case SysEvent_Interrupt_DP: return "SysEvent_Interrupt_DP";
|
||||||
case SysEvent_ResetFunctionTimes: return "SysEvent_ResetFunctionTimes";
|
case SysEvent_ResetFunctionTimes: return "SysEvent_ResetFunctionTimes";
|
||||||
case SysEvent_DumpFunctionTimes: return "SysEvent_DumpFunctionTimes";
|
case SysEvent_DumpFunctionTimes: return "SysEvent_DumpFunctionTimes";
|
||||||
|
case SysEvent_ResetRecompilerCode: return "SysEvent_ResetRecompilerCode";
|
||||||
}
|
}
|
||||||
static char unknown[100];
|
static char unknown[100];
|
||||||
sprintf(unknown, "unknown(%d)", event);
|
sprintf(unknown, "unknown(%d)", event);
|
||||||
|
@ -256,6 +257,9 @@ void CSystemEvents::ExecuteEvents()
|
||||||
bPause = true;
|
bPause = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SysEvent_ResetRecompilerCode:
|
||||||
|
g_Recompiler->ResetRecompCode(true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -51,6 +51,7 @@ enum SystemEvent
|
||||||
SysEvent_Interrupt_DP,
|
SysEvent_Interrupt_DP,
|
||||||
SysEvent_ResetFunctionTimes,
|
SysEvent_ResetFunctionTimes,
|
||||||
SysEvent_DumpFunctionTimes,
|
SysEvent_DumpFunctionTimes,
|
||||||
|
SysEvent_ResetRecompilerCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * SystemEventName(SystemEvent event);
|
const char * SystemEventName(SystemEvent event);
|
||||||
|
|
|
@ -202,6 +202,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
||||||
case SysEvent_PauseCPU_FromMenu:
|
case SysEvent_PauseCPU_FromMenu:
|
||||||
case SysEvent_ResetFunctionTimes:
|
case SysEvent_ResetFunctionTimes:
|
||||||
case SysEvent_DumpFunctionTimes:
|
case SysEvent_DumpFunctionTimes:
|
||||||
|
case SysEvent_ResetRecompilerCode:
|
||||||
QueueEvent(action);
|
QueueEvent(action);
|
||||||
break;
|
break;
|
||||||
case SysEvent_PauseCPU_AppLostFocus:
|
case SysEvent_PauseCPU_AppLostFocus:
|
||||||
|
@ -1164,6 +1165,10 @@ void CN64System::SyncCPU(CN64System * const SecondCPU)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_Random.get_state() != SecondCPU->m_Random.get_state())
|
||||||
|
{
|
||||||
|
ErrorFound = true;
|
||||||
|
}
|
||||||
if (m_TLB != SecondCPU->m_TLB) { ErrorFound = true; }
|
if (m_TLB != SecondCPU->m_TLB) { ErrorFound = true; }
|
||||||
if (m_Reg.m_FPCR[0] != SecondCPU->m_Reg.m_FPCR[0]) { ErrorFound = true; }
|
if (m_Reg.m_FPCR[0] != SecondCPU->m_Reg.m_FPCR[0]) { ErrorFound = true; }
|
||||||
if (m_Reg.m_FPCR[31] != SecondCPU->m_Reg.m_FPCR[31]) { ErrorFound = true; }
|
if (m_Reg.m_FPCR[31] != SecondCPU->m_Reg.m_FPCR[31]) { ErrorFound = true; }
|
||||||
|
|
|
@ -5388,6 +5388,11 @@ void CArmRecompilerOps::CompileWriteTLBMiss(ArmReg AddressReg, ArmReg LookUpReg)
|
||||||
m_RegWorkingSet.SetArmRegProtected(TlbStoreReg, false);
|
m_RegWorkingSet.SetArmRegProtected(TlbStoreReg, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CArmRecompilerOps::CompileExecuteBP(void)
|
||||||
|
{
|
||||||
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
CRegInfo & CArmRecompilerOps::GetRegWorkingSet(void)
|
CRegInfo & CArmRecompilerOps::GetRegWorkingSet(void)
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet;
|
return m_RegWorkingSet;
|
||||||
|
|
|
@ -224,6 +224,7 @@ private:
|
||||||
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
||||||
void CompileReadTLBMiss(ArmReg AddressReg, ArmReg LookUpReg);
|
void CompileReadTLBMiss(ArmReg AddressReg, ArmReg LookUpReg);
|
||||||
void CompileWriteTLBMiss(ArmReg AddressReg, ArmReg LookUpReg);
|
void CompileWriteTLBMiss(ArmReg AddressReg, ArmReg LookUpReg);
|
||||||
|
void CompileExecuteBP(void);
|
||||||
|
|
||||||
/********* Helper Functions *********/
|
/********* Helper Functions *********/
|
||||||
typedef CRegInfo::REG_STATE REG_STATE;
|
typedef CRegInfo::REG_STATE REG_STATE;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <Project64-core/N64System/Recompiler/LoopAnalysis.h>
|
#include <Project64-core/N64System/Recompiler/LoopAnalysis.h>
|
||||||
#include <Project64-core/N64System/Recompiler/SectionInfo.h>
|
#include <Project64-core/N64System/Recompiler/SectionInfo.h>
|
||||||
#include <Project64-core/ExceptionHandler.h>
|
#include <Project64-core/ExceptionHandler.h>
|
||||||
|
#include <Project64-core/Debugger.h>
|
||||||
|
|
||||||
void InPermLoop();
|
void InPermLoop();
|
||||||
|
|
||||||
|
@ -474,6 +475,13 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
||||||
{
|
{
|
||||||
m_BlockInfo->SetVAddrLast(m_RecompilerOps->GetCurrentPC());
|
m_BlockInfo->SetVAddrLast(m_RecompilerOps->GetCurrentPC());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDebugging() && HaveExecutionBP() && g_Debugger->ExecutionBP(m_RecompilerOps->GetCurrentPC()))
|
||||||
|
{
|
||||||
|
m_RecompilerOps->CompileExecuteBP();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_RecompilerOps->PreCompileOpcode();
|
m_RecompilerOps->PreCompileOpcode();
|
||||||
|
|
||||||
switch (Opcode.op)
|
switch (Opcode.op)
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
class CCodeBlock;
|
class CCodeBlock;
|
||||||
|
|
||||||
class CCodeSection
|
class CCodeSection :
|
||||||
|
private CDebugSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::list<CCodeSection *> SECTION_LIST;
|
typedef std::list<CCodeSection *> SECTION_LIST;
|
||||||
|
|
|
@ -222,4 +222,5 @@ public:
|
||||||
virtual void PreCompileOpcode(void) = 0;
|
virtual void PreCompileOpcode(void) = 0;
|
||||||
virtual void PostCompileOpcode(void) = 0;
|
virtual void PostCompileOpcode(void) = 0;
|
||||||
virtual void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false) = 0;
|
virtual void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false) = 0;
|
||||||
|
virtual void CompileExecuteBP(void) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h>
|
#include <Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include <Project64-core/ExceptionHandler.h>
|
#include <Project64-core/ExceptionHandler.h>
|
||||||
|
#include <Project64-core/Debugger.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
CCodeSection * CX86RecompilerOps::m_Section = NULL;
|
CCodeSection * CX86RecompilerOps::m_Section = NULL;
|
||||||
|
@ -46,6 +47,46 @@ g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
void x86_compiler_Break_Point()
|
||||||
|
{
|
||||||
|
g_Settings->SaveBool(Debugger_SteppingOps, true);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
g_Debugger->WaitForStep();
|
||||||
|
if (CDebugSettings::SkipOp())
|
||||||
|
{
|
||||||
|
// Skip command if instructed by the debugger
|
||||||
|
g_Settings->SaveBool(Debugger_SkipOp, false);
|
||||||
|
g_Reg->m_PROGRAM_COUNTER += 4;
|
||||||
|
|
||||||
|
uint32_t OpcodeValue;
|
||||||
|
if (!g_MMU->LW_VAddr(g_Reg->m_PROGRAM_COUNTER, OpcodeValue))
|
||||||
|
{
|
||||||
|
g_Reg->DoTLBReadMiss(false, g_Reg->m_PROGRAM_COUNTER);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
|
||||||
|
if (g_SyncSystem)
|
||||||
|
{
|
||||||
|
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
|
||||||
|
g_System->SyncCPU(g_SyncSystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (CDebugSettings::isStepping());
|
||||||
|
|
||||||
|
if (R4300iOp::m_NextInstruction != NORMAL)
|
||||||
|
{
|
||||||
|
CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
|
||||||
|
if (g_SyncSystem)
|
||||||
|
{
|
||||||
|
g_System->UpdateSyncCPU(g_SyncSystem, g_System->CountPerOp());
|
||||||
|
g_System->SyncCPU(g_SyncSystem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CX86RecompilerOps::PreCompileOpcode(void)
|
void CX86RecompilerOps::PreCompileOpcode(void)
|
||||||
{
|
{
|
||||||
if (m_NextInstruction != DELAY_SLOT_DONE)
|
if (m_NextInstruction != DELAY_SLOT_DONE)
|
||||||
|
@ -9705,6 +9746,32 @@ void CX86RecompilerOps::CompileSystemCheck(uint32_t TargetPC, const CRegInfo & R
|
||||||
SetJump32(Jump, (uint32_t *)*g_RecompPos);
|
SetJump32(Jump, (uint32_t *)*g_RecompPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CX86RecompilerOps::CompileExecuteBP(void)
|
||||||
|
{
|
||||||
|
bool bDelay = m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT;
|
||||||
|
if (bDelay)
|
||||||
|
{
|
||||||
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
m_RegWorkingSet.WriteBackRegisters();
|
||||||
|
|
||||||
|
UpdateCounters(m_RegWorkingSet, true, true);
|
||||||
|
if (g_SyncSystem)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
MoveConstToX86reg((uint32_t)g_BaseSystem, x86_ECX);
|
||||||
|
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||||
|
#else
|
||||||
|
PushImm32((uint32_t)g_BaseSystem);
|
||||||
|
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||||
|
AddConstToX86Reg(x86_ESP, 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Call_Direct((void *)x86_compiler_Break_Point, "x86_compiler_Break_Point");
|
||||||
|
ExitCodeBlock();
|
||||||
|
m_NextInstruction = END_BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer)
|
void CX86RecompilerOps::OverflowDelaySlot(bool TestTimer)
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.WriteBackRegisters();
|
m_RegWorkingSet.WriteBackRegisters();
|
||||||
|
|
|
@ -234,6 +234,7 @@ public:
|
||||||
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
||||||
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
|
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
|
||||||
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
||||||
|
void CompileExecuteBP(void);
|
||||||
static void ChangeDefaultRoundingModel();
|
static void ChangeDefaultRoundingModel();
|
||||||
void OverflowDelaySlot(bool TestTimer);
|
void OverflowDelaySlot(bool TestTimer);
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ bool CBreakpoints::AddExecution(uint32_t address, bool bTemporary)
|
||||||
{
|
{
|
||||||
g_Settings->SaveBool(Debugger_HaveExecutionBP, true);
|
g_Settings->SaveBool(Debugger_HaveExecutionBP, true);
|
||||||
}
|
}
|
||||||
|
g_BaseSystem->ExternalEvent(SysEvent_ResetRecompilerCode);
|
||||||
return !res.second;
|
return !res.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,6 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
|
||||||
DlgResize_Init(false, true);
|
DlgResize_Init(false, true);
|
||||||
DlgToolTip_Init();
|
DlgToolTip_Init();
|
||||||
|
|
||||||
CheckCPUType();
|
|
||||||
|
|
||||||
GetWindowRect(&m_DefaultWindowRect);
|
GetWindowRect(&m_DefaultWindowRect);
|
||||||
|
|
||||||
// Setup address input
|
// Setup address input
|
||||||
|
@ -248,25 +246,6 @@ LRESULT CDebugCommandsView::OnOpKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*l
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugCommandsView::CheckCPUType()
|
|
||||||
{
|
|
||||||
CPU_TYPE cpuType;
|
|
||||||
|
|
||||||
if (g_Settings->LoadBool(Setting_ForceInterpreterCPU))
|
|
||||||
{
|
|
||||||
cpuType = CPU_Interpreter;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cpuType = g_System->CpuType();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cpuType != CPU_Interpreter)
|
|
||||||
{
|
|
||||||
MessageBox("Interpreter mode required", "Invalid CPU Type", MB_OK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if KSEG0 addr is out of bounds
|
// Check if KSEG0 addr is out of bounds
|
||||||
bool CDebugCommandsView::AddressSafe(uint32_t vaddr)
|
bool CDebugCommandsView::AddressSafe(uint32_t vaddr)
|
||||||
{
|
{
|
||||||
|
@ -1460,22 +1439,6 @@ LRESULT CDebugCommandsView::OnListBoxClicked(WORD /*wNotifyCode*/, WORD wID, HWN
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugCommandsView::OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
|
||||||
{
|
|
||||||
WORD type = LOWORD(wParam);
|
|
||||||
|
|
||||||
if (type == WA_INACTIVE)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == WA_CLICKACTIVE)
|
|
||||||
{
|
|
||||||
CheckCPUType();
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CDebugCommandsView::OnSizing(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT CDebugCommandsView::OnSizing(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
CRect listRect;
|
CRect listRect;
|
||||||
|
|
|
@ -89,7 +89,6 @@ public:
|
||||||
private:
|
private:
|
||||||
BEGIN_MSG_MAP_EX(CDebugCommandsView)
|
BEGIN_MSG_MAP_EX(CDebugCommandsView)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
|
||||||
MESSAGE_HANDLER(WM_SIZING, OnSizing)
|
MESSAGE_HANDLER(WM_SIZING, OnSizing)
|
||||||
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
|
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
|
||||||
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
|
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
|
||||||
|
@ -164,7 +163,6 @@ private:
|
||||||
static void StaticWaitingForStepChanged(CDebugCommandsView * __this) { __this->WaitingForStepChanged(); }
|
static void StaticWaitingForStepChanged(CDebugCommandsView * __this) { __this->WaitingForStepChanged(); }
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
||||||
LRESULT OnSizing(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnSizing(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
|
@ -212,7 +210,6 @@ private:
|
||||||
void EndOpEdit();
|
void EndOpEdit();
|
||||||
|
|
||||||
void GotoEnteredAddress();
|
void GotoEnteredAddress();
|
||||||
void CheckCPUType();
|
|
||||||
void RefreshBreakpointList();
|
void RefreshBreakpointList();
|
||||||
void RemoveSelectedBreakpoints();
|
void RemoveSelectedBreakpoints();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue