Disable block linking while debugger stepping or if there are breakpoints

This commit is contained in:
skidau 2014-10-24 12:57:17 +11:00
parent d0a3bb7650
commit 290e1bed37
6 changed files with 144 additions and 105 deletions

View File

@ -174,13 +174,8 @@ bool Jit64::HandleFault(uintptr_t access_address, SContext* ctx)
void Jit64::Init()
{
jo.optimizeStack = true;
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
EnableBlockLink();
jo.fpAccurateFcmp = SConfig::GetInstance().m_LocalCoreStartupParameter.bFPRF;
jo.optimizeGatherPipe = true;
jo.fastInterrupts = false;
@ -521,11 +516,19 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
{
// We can link blocks as long as we are not single stepping and there are no breakpoints here
EnableBlockLink();
// Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks)
{
if (GetState() == CPU_STEPPING)
{
blockSize = 1;
// Do not link this block to other blocks While single stepping
jo.enableBlocklink = false;
}
Trace();
}
}
@ -715,6 +718,9 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING)
{
// Turn off block linking if there are breakpoints so that the Step Over command does not link this block.
jo.enableBlocklink = false;
gpr.Flush();
fpr.Flush();
@ -856,3 +862,14 @@ u32 Jit64::CallerSavedRegistersInUse()
}
return result & ABI_ALL_CALLER_SAVED;
}
void Jit64::EnableBlockLink()
{
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
}

View File

@ -64,6 +64,9 @@ public:
~Jit64() {}
void Init() override;
void EnableBlockLink();
void Shutdown() override;
bool HandleFault(uintptr_t access_address, SContext* ctx) override;

View File

@ -244,13 +244,7 @@ namespace JitILProfiler
void JitIL::Init()
{
jo.optimizeStack = true;
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
EnableBlockLink();
jo.fpAccurateFcmp = false;
jo.optimizeGatherPipe = true;
@ -509,11 +503,19 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
{
// We can link blocks as long as we are not single stepping and there are no breakpoints here
EnableBlockLink();
// Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks)
{
if (GetState() == CPU_STEPPING)
{
blockSize = 1;
// Do not link this block to other blocks While single stepping
jo.enableBlocklink = false;
}
Trace();
}
}
@ -648,6 +650,9 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING)
{
// Turn off block linking if there are breakpoints so that the Step Over command does not link this block.
jo.enableBlocklink = false;
ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address));
}
@ -702,3 +707,14 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
return normalEntry;
}
void JitIL::EnableBlockLink()
{
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
}

View File

@ -47,6 +47,9 @@ public:
// Initialization, etc
void Init() override;
void EnableBlockLink();
void Shutdown() override;
// Jit!

View File

@ -310,10 +310,10 @@ void CCodeWindow::StepOver()
{
if (CCPU::IsStepping())
{
PowerPC::breakpoints.ClearAllTemporary();
UGeckoInstruction inst = Memory::Read_Instruction(PC);
if (inst.LK)
{
PowerPC::breakpoints.ClearAllTemporary();
PowerPC::breakpoints.Add(PC + 4, true);
CCPU::EnableStepping(false);
JumpToAddress(PC);

View File

@ -36,113 +36,113 @@ class wxMenuBar;
class CCodeWindow : public wxPanel
{
public:
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
CFrame * parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
CFrame * parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
const wxString& name = _("Code"));
void Load();
void Save();
void Load();
void Save();
// Parent interaction
CFrame *Parent;
wxMenuBar * GetMenuBar();
wxToolBar * GetToolBar();
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
// Parent interaction
CFrame *Parent;
wxMenuBar * GetMenuBar();
wxToolBar * GetToolBar();
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
bool UseInterpreter();
bool BootToPause();
bool AutomaticStart();
bool JITNoBlockCache();
bool JITNoBlockLinking();
bool JumpToAddress(u32 address);
bool UseInterpreter();
bool BootToPause();
bool AutomaticStart();
bool JITNoBlockCache();
bool JITNoBlockLinking();
bool JumpToAddress(u32 address);
void Update() override;
void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxToolBar*);
void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates();
void OpenPages();
void UpdateManager();
void Update() override;
void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxToolBar*);
void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates();
void OpenPages();
void UpdateManager();
// Menu bar
// -------------------
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
// Menu bar
// -------------------
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
void ToggleCodeWindow(bool bShow);
void ToggleRegisterWindow(bool bShow);
void ToggleWatchWindow(bool bShow);
void ToggleBreakPointWindow(bool bShow);
void ToggleMemoryWindow(bool bShow);
void ToggleJitWindow(bool bShow);
void ToggleSoundWindow(bool bShow);
void ToggleVideoWindow(bool bShow);
void ToggleCodeWindow(bool bShow);
void ToggleRegisterWindow(bool bShow);
void ToggleWatchWindow(bool bShow);
void ToggleBreakPointWindow(bool bShow);
void ToggleMemoryWindow(bool bShow);
void ToggleJitWindow(bool bShow);
void ToggleSoundWindow(bool bShow);
void ToggleVideoWindow(bool bShow);
void OnChangeFont(wxCommandEvent& event);
void OnChangeFont(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);
void OnAddrBoxChange(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);
void OnAddrBoxChange(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event);
// Sub dialogs
CRegisterWindow* m_RegisterWindow;
CWatchWindow* m_WatchWindow;
CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow;
CJitWindow* m_JitWindow;
DSPDebuggerLLE* m_SoundWindow;
GFXDebuggerPanel* m_VideoWindow;
// Sub dialogs
CRegisterWindow* m_RegisterWindow;
CWatchWindow* m_WatchWindow;
CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow;
CJitWindow* m_JitWindow;
DSPDebuggerLLE* m_SoundWindow;
GFXDebuggerPanel* m_VideoWindow;
// Settings
bool bAutomaticStart; bool bBootToPause;
bool bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
int iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
// Settings
bool bAutomaticStart; bool bBootToPause;
bool bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
int iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
private:
enum
{
// Debugger GUI Objects
ID_CODEVIEW,
ID_CALLSTACKLIST,
ID_CALLERSLIST,
ID_CALLSLIST,
ID_SYMBOLLIST
};
enum
{
// Debugger GUI Objects
ID_CODEVIEW,
ID_CALLSTACKLIST,
ID_CALLERSLIST,
ID_CALLSLIST,
ID_SYMBOLLIST
};
void OnSymbolListChange(wxCommandEvent& event);
void OnSymbolListContextMenu(wxContextMenuEvent& event);
void OnCallstackListChange(wxCommandEvent& event);
void OnCallersListChange(wxCommandEvent& event);
void OnCallsListChange(wxCommandEvent& event);
void OnCodeViewChange(wxCommandEvent &event);
void OnHostMessage(wxCommandEvent& event);
void OnSymbolListChange(wxCommandEvent& event);
void OnSymbolListContextMenu(wxContextMenuEvent& event);
void OnCallstackListChange(wxCommandEvent& event);
void OnCallersListChange(wxCommandEvent& event);
void OnCallsListChange(wxCommandEvent& event);
void OnCodeViewChange(wxCommandEvent &event);
void OnHostMessage(wxCommandEvent& event);
// Debugger functions
void SingleStep();
void StepOver();
void StepOut();
void ToggleBreakpoint();
// Debugger functions
void SingleStep();
void StepOver();
void StepOut();
void ToggleBreakpoint();
void UpdateLists();
void UpdateCallstack();
void UpdateLists();
void UpdateCallstack();
void InitBitmaps();
void InitBitmaps();
CCodeView* codeview;
wxListBox* callstack;
wxListBox* symbols;
wxListBox* callers;
wxListBox* calls;
Common::Event sync_event;
CCodeView* codeview;
wxListBox* callstack;
wxListBox* symbols;
wxListBox* callers;
wxListBox* calls;
Common::Event sync_event;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};