mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Some changes to the debugger, added a DSP HLE debugging window. I moved the initialization of DLLdebugger from Core.cpp to the debugging window. (I hope this doesn't break the LLE debugger in any way, or does it have to be started right after LoadPlugin?). Also added a ShowOnStart saved setting to the debugger. And a MainWindow saved setting that set the position and size of the main window when it's started. I may have broken things in the debugger by allowing disabling of for example the Jit window. Please accept my apologies if that is the case.
There's an annoying problem with the DSP HLE wx window that blocks some input and places it in a queue. For example if you have loaded the window and press X on the main window, that action is blocked an placed in some kind of queue and not executed until you have closed the debugging window. This is also why the main Dolphin-Debugger window does not show up until you close the sound window. If someone find a fix to this I guess it could be convenient. There is another way to show the window, m_frame->Show() that is normally supposed to remove this kind of on-focus lock, but in a dll it seemingly breaks because it makes Dllmain call DLL_PROCESS_DETACH immediately after DLL_PROCESS_ATTACH so the window has to be killed or we crash. Also, otherwise unnecessarily I had to disable the new DSP HLE debug window in Release mode because I could not access the SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str() string that I need to start it (if I tried it crashed). Very annoying and strange. I could not access m_strDSPPlugin or m_strVideoPlugin either, but all other values in m_LocalCoreStartupParameter seemed to work fine. I'll have to leave it to someone else to figure out why. TODO: Later I'll add function to the debugging buttons, currently only update have a function. I'll add some option to show a custom console window (that actually worked better that the wx window to show the current parameters status, it had less flicker on frequent updates). I'll also add some custom log file saving option. Also, the reason I placed Logging.cpp in its own dir is because I plan to add more files to it. There were problems with some build modes, win32 with debugging crashed on booting a game, I don't know if it's my fault. And I could not build Debug win64 because of some wx linking problem. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@722 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -55,6 +55,14 @@
|
||||
#include "PowerPC/Jit64/Jit.h"
|
||||
#include "PowerPC/Jit64/JitCache.h"
|
||||
|
||||
#include "Plugins/Plugin_DSP.h" // new stuff, to let us open the DLLDebugger
|
||||
#include "../../DolphinWX/src/PluginManager.h"
|
||||
#include "../../DolphinWX/src/Config.h"
|
||||
|
||||
// and here are the classes
|
||||
class CPluginInfo;
|
||||
class CPluginManager;
|
||||
|
||||
extern "C" {
|
||||
#include "../resources/toolbar_play.c"
|
||||
#include "../resources/toolbar_pause.c"
|
||||
@ -75,6 +83,8 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
|
||||
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
|
||||
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
|
||||
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
|
||||
EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleJitWindow)
|
||||
EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleSoundWindow)
|
||||
|
||||
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnInterpreter)
|
||||
|
||||
@ -110,11 +120,18 @@ inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
|
||||
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
|
||||
}
|
||||
|
||||
// =======================================================================================
|
||||
// WARNING: If you create a new dialog window you must add m_dialog(NULL) below otherwise
|
||||
// m_dialog = true and things will crash.
|
||||
// ----------------
|
||||
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, wxWindowID id,
|
||||
const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxFrame(parent, id, title, pos, size, style)
|
||||
, m_LogWindow(NULL)
|
||||
, m_RegisterWindow(NULL)
|
||||
, m_BreakpointWindow(NULL)
|
||||
, m_MemoryWindow(NULL)
|
||||
, m_JitWindow(NULL)
|
||||
{
|
||||
InitBitmaps();
|
||||
|
||||
@ -138,7 +155,9 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
|
||||
if (m_LogWindow) m_LogWindow->Load(file);
|
||||
if (m_RegisterWindow) m_RegisterWindow->Load(file);
|
||||
if (m_MemoryWindow) m_MemoryWindow->Load(file);
|
||||
if (m_JitWindow) m_JitWindow->Load(file);
|
||||
}
|
||||
// ===============
|
||||
|
||||
|
||||
CCodeWindow::~CCodeWindow()
|
||||
@ -151,6 +170,7 @@ CCodeWindow::~CCodeWindow()
|
||||
if (m_LogWindow) m_LogWindow->Save(file);
|
||||
if (m_RegisterWindow) m_RegisterWindow->Save(file);
|
||||
if (m_MemoryWindow) m_MemoryWindow->Save(file);
|
||||
if (m_JitWindow) m_JitWindow->Save(file);
|
||||
|
||||
file.Save("Debugger.ini");
|
||||
}
|
||||
@ -175,11 +195,36 @@ void CCodeWindow::Save(IniFile &file) const
|
||||
file.Set("Code", "h", GetSize().GetHeight());
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// I don't know when you're supposed to be able to use pRegister->Check(true) so I had
|
||||
// to set these here. It kept crashing if I placed it after m_LogWindow->Show() below.
|
||||
bool bLogWindow = true;
|
||||
bool bRegisterWindow = true;
|
||||
bool bBreakpointWindow = true;
|
||||
bool bMemoryWindow = true;
|
||||
bool bJitWindow = true;
|
||||
bool bSoundWindow = false;
|
||||
// -------------------
|
||||
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
|
||||
{
|
||||
// =======================================================================================
|
||||
// Decide what windows to use
|
||||
// --------------
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
|
||||
ini.Get("ShowOnStart", "LogWindow", &bLogWindow, true);
|
||||
ini.Get("ShowOnStart", "RegisterWindow", &bRegisterWindow, true);
|
||||
ini.Get("ShowOnStart", "BreakpointWindow", &bBreakpointWindow, true);
|
||||
ini.Get("ShowOnStart", "MemoryWindow", &bMemoryWindow, true);
|
||||
ini.Get("ShowOnStart", "JitWindow", &bJitWindow, true);
|
||||
ini.Get("ShowOnStart", "SoundWindow", &bSoundWindow, false);
|
||||
// ===============
|
||||
|
||||
CreateMenu(_LocalCoreStartupParameter);
|
||||
|
||||
// =======================================================================================
|
||||
// Configure the code window
|
||||
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
@ -202,30 +247,59 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
|
||||
sizerBig->Fit(this);
|
||||
|
||||
sync_event.Init();
|
||||
// =================
|
||||
|
||||
|
||||
// additional dialogs
|
||||
if (IsLoggingActivated())
|
||||
if (IsLoggingActivated() && bLogWindow)
|
||||
{
|
||||
m_LogWindow = new CLogWindow(this);
|
||||
m_LogWindow->Show(true);
|
||||
}
|
||||
|
||||
m_RegisterWindow = new CRegisterWindow(this);
|
||||
m_RegisterWindow->Show(true);
|
||||
if (bRegisterWindow)
|
||||
{
|
||||
m_RegisterWindow = new CRegisterWindow(this);
|
||||
m_RegisterWindow->Show(true);
|
||||
}
|
||||
|
||||
m_BreakpointWindow = new CBreakPointWindow(this, this);
|
||||
m_BreakpointWindow->Show(true);
|
||||
if(bBreakpointWindow)
|
||||
{
|
||||
m_BreakpointWindow = new CBreakPointWindow(this, this);
|
||||
m_BreakpointWindow->Show(true);
|
||||
}
|
||||
|
||||
m_MemoryWindow = new CMemoryWindow(this);
|
||||
m_MemoryWindow->Show(true);
|
||||
if(bMemoryWindow)
|
||||
{
|
||||
m_MemoryWindow = new CMemoryWindow(this);
|
||||
m_MemoryWindow->Show(true);
|
||||
}
|
||||
|
||||
m_JitWindow = new CJitWindow(this);
|
||||
m_JitWindow->Show(true);
|
||||
if(bJitWindow)
|
||||
{
|
||||
m_JitWindow = new CJitWindow(this);
|
||||
m_JitWindow->Show(true);
|
||||
}
|
||||
|
||||
if(IsLoggingActivated() && bSoundWindow)
|
||||
{
|
||||
// no if() check here?
|
||||
CPluginManager::GetInstance().OpenDebug(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter)
|
||||
{
|
||||
|
||||
// =======================================================================================
|
||||
// Windowses
|
||||
// ---------------
|
||||
wxMenuBar* pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
|
||||
|
||||
{
|
||||
@ -245,19 +319,29 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
||||
if (IsLoggingActivated())
|
||||
{
|
||||
wxMenuItem* pLogWindow = pDebugDialogs->Append(IDM_LOGWINDOW, _T("&LogManager"), wxEmptyString, wxITEM_CHECK);
|
||||
pLogWindow->Check(true);
|
||||
pLogWindow->Check(bLogWindow);
|
||||
}
|
||||
|
||||
wxMenuItem* pRegister = pDebugDialogs->Append(IDM_REGISTERWINDOW, _T("&Registers"), wxEmptyString, wxITEM_CHECK);
|
||||
pRegister->Check(true);
|
||||
pRegister->Check(bRegisterWindow);
|
||||
|
||||
wxMenuItem* pBreakPoints = pDebugDialogs->Append(IDM_BREAKPOINTWINDOW, _T("&BreakPoints"), wxEmptyString, wxITEM_CHECK);
|
||||
pBreakPoints->Check(true);
|
||||
pBreakPoints->Check(bBreakpointWindow);
|
||||
|
||||
wxMenuItem* pMemory = pDebugDialogs->Append(IDM_MEMORYWINDOW, _T("&Memory"), wxEmptyString, wxITEM_CHECK);
|
||||
pMemory->Check(true);
|
||||
pMemory->Check(bMemoryWindow);
|
||||
|
||||
wxMenuItem* pJit = pDebugDialogs->Append(IDM_JITWINDOW, _T("&Jit"), wxEmptyString, wxITEM_CHECK);
|
||||
pJit->Check(bJitWindow);
|
||||
|
||||
if (IsLoggingActivated()) {
|
||||
wxMenuItem* pSound = pDebugDialogs->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString, wxITEM_CHECK);
|
||||
pSound->Check(bSoundWindow);}
|
||||
|
||||
pMenuBar->Append(pDebugDialogs, _T("&Views"));
|
||||
}
|
||||
// ===============
|
||||
|
||||
|
||||
{
|
||||
wxMenu *pSymbolsMenu = new wxMenu;
|
||||
@ -665,10 +749,18 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
||||
|
||||
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
|
||||
{
|
||||
|
||||
if (IsLoggingActivated())
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
// this may be a little ugly to have these here - you're more than welcome to
|
||||
// turn this into the same fancy class stuff like the load windows positions
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
ini.Set("ShowOnStart", "LogWindow", show);
|
||||
ini.Save("Debugger.ini");
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (!m_LogWindow)
|
||||
@ -699,6 +791,11 @@ void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
ini.Set("ShowOnStart", "RegisterWindow", show);
|
||||
ini.Save("Debugger.ini");
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (!m_RegisterWindow)
|
||||
@ -723,10 +820,79 @@ void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Toggle Sound Debugging Window
|
||||
// ------------
|
||||
void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
ini.Set("ShowOnStart", "SoundWindow", show);
|
||||
ini.Save("Debugger.ini");
|
||||
|
||||
|
||||
if (IsLoggingActivated() && show)
|
||||
{
|
||||
// TODO: add some kind of if?
|
||||
CPluginManager::GetInstance().OpenDebug(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
|
||||
);
|
||||
}
|
||||
else // hide
|
||||
{
|
||||
// can we close the dll window from here?
|
||||
}
|
||||
}
|
||||
// ===========
|
||||
|
||||
|
||||
void CCodeWindow::OnToggleJitWindow(wxCommandEvent& event)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
ini.Set("ShowOnStart", "JitWindow", show);
|
||||
ini.Save("Debugger.ini");
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (!m_JitWindow)
|
||||
{
|
||||
m_JitWindow = new CJitWindow(this);
|
||||
}
|
||||
|
||||
m_JitWindow->Show(true);
|
||||
}
|
||||
else // hide
|
||||
{
|
||||
// If m_dialog is NULL, then possibly the system
|
||||
// didn't report the checked menu item status correctly.
|
||||
// It should be true just after the menu item was selected,
|
||||
// if there was no modeless dialog yet.
|
||||
wxASSERT(m_JitWindow != NULL);
|
||||
|
||||
if (m_JitWindow)
|
||||
{
|
||||
m_JitWindow->Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCodeWindow::OnToggleBreakPointWindow(wxCommandEvent& event)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
ini.Set("ShowOnStart", "BreakpointWindow", show);
|
||||
ini.Save("Debugger.ini");
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (!m_BreakpointWindow)
|
||||
@ -754,6 +920,11 @@ void CCodeWindow::OnToggleBreakPointWindow(wxCommandEvent& event)
|
||||
void CCodeWindow::OnToggleMemoryWindow(wxCommandEvent& event)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
IniFile ini;
|
||||
ini.Load("Debugger.ini");
|
||||
ini.Set("ShowOnStart", "MemoryWindow", show);
|
||||
ini.Save("Debugger.ini");
|
||||
|
||||
if (show)
|
||||
{
|
||||
@ -803,7 +974,6 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||
{
|
||||
m_RegisterWindow->NotifyUpdate();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IDM_UPDATEBREAKPOINTS:
|
||||
|
Reference in New Issue
Block a user