2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/chartype.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/image.h>
|
|
|
|
#include <wx/listbox.h>
|
|
|
|
#include <wx/menu.h>
|
|
|
|
#include <wx/menuitem.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/textdlg.h>
|
|
|
|
#include <wx/thread.h>
|
2014-08-08 22:02:35 +00:00
|
|
|
#include <wx/toolbar.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/translation.h>
|
|
|
|
#include <wx/window.h>
|
|
|
|
#include <wx/windowid.h>
|
|
|
|
#include <wx/aui/auibar.h>
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Common/BreakPoints.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/Common.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Common/StringUtil.h"
|
|
|
|
#include "Common/SymbolDB.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/Core.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Core/CoreParameter.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/Host.h"
|
|
|
|
#include "Core/Debugger/Debugger_SymbolMap.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "Core/Debugger/PPCDebugInterface.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/HW/CPU.h"
|
|
|
|
#include "Core/HW/Memmap.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "Core/PowerPC/Gekko.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/PowerPC/JitInterface.h"
|
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
|
|
|
#include "Core/PowerPC/PPCTables.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "DolphinWX/Frame.h"
|
|
|
|
#include "DolphinWX/Globals.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Debugger/BreakpointWindow.h"
|
|
|
|
#include "DolphinWX/Debugger/CodeView.h"
|
|
|
|
#include "DolphinWX/Debugger/CodeWindow.h"
|
2014-02-22 22:36:30 +00:00
|
|
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Debugger/RegisterWindow.h"
|
|
|
|
|
2009-01-05 02:52:55 +00:00
|
|
|
extern "C" // Bitmaps
|
|
|
|
{
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "DolphinWX/resources/toolbar_add_memorycheck.c" // NOLINT
|
|
|
|
#include "DolphinWX/resources/toolbar_add_breakpoint.c" // NOLINT
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2009-01-05 02:52:55 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
class DebugInterface;
|
|
|
|
|
2009-09-03 07:56:35 +00:00
|
|
|
// -------
|
2009-08-27 16:08:43 +00:00
|
|
|
// Main
|
2009-09-03 07:56:35 +00:00
|
|
|
|
2010-07-23 03:53:18 +00:00
|
|
|
BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
|
2009-08-25 01:50:27 +00:00
|
|
|
|
2009-12-28 19:34:19 +00:00
|
|
|
// Menu bar
|
2011-02-28 20:40:15 +00:00
|
|
|
EVT_MENU_RANGE(IDM_INTERPRETER, IDM_JITSROFF, CCodeWindow::OnCPUMode)
|
|
|
|
EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont)
|
|
|
|
EVT_MENU_RANGE(IDM_CLEARCODECACHE, IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
|
2011-03-15 05:12:06 +00:00
|
|
|
EVT_MENU_RANGE(IDM_CLEARSYMBOLS, IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
|
2011-02-28 20:40:15 +00:00
|
|
|
EVT_MENU_RANGE(IDM_PROFILEBLOCKS, IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
|
2009-09-03 05:24:30 +00:00
|
|
|
|
2009-12-28 19:34:19 +00:00
|
|
|
// Toolbar
|
2011-03-15 05:12:06 +00:00
|
|
|
EVT_MENU_RANGE(IDM_STEP, IDM_GOTOPC, CCodeWindow::OnCodeStep)
|
|
|
|
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
|
2009-09-03 05:24:30 +00:00
|
|
|
|
2009-12-28 19:34:19 +00:00
|
|
|
// Other
|
2014-02-17 04:51:41 +00:00
|
|
|
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
|
|
|
|
EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
|
|
|
|
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
|
|
|
|
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
|
2009-09-03 05:24:30 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
|
2009-09-03 05:24:30 +00:00
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-09-01 02:41:48 +00:00
|
|
|
// Class
|
2009-09-07 12:40:43 +00:00
|
|
|
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *parent,
|
2009-09-01 02:41:48 +00:00
|
|
|
wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name)
|
2014-07-11 00:26:08 +00:00
|
|
|
: wxPanel(parent, id, position, size, style, name)
|
2009-09-07 12:40:43 +00:00
|
|
|
, Parent(parent)
|
2014-03-09 20:14:26 +00:00
|
|
|
, m_RegisterWindow(nullptr)
|
|
|
|
, m_BreakpointWindow(nullptr)
|
|
|
|
, m_MemoryWindow(nullptr)
|
|
|
|
, m_JitWindow(nullptr)
|
|
|
|
, m_SoundWindow(nullptr)
|
|
|
|
, m_VideoWindow(nullptr)
|
|
|
|
, codeview(nullptr)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
|
|
|
InitBitmaps();
|
|
|
|
|
2011-02-28 20:40:15 +00:00
|
|
|
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
|
|
|
|
|
|
|
|
DebugInterface* di = &PowerPC::debug_interface;
|
|
|
|
|
|
|
|
codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW);
|
|
|
|
sizerBig->Add(sizerLeft, 2, wxEXPAND);
|
|
|
|
sizerBig->Add(codeview, 5, wxEXPAND);
|
|
|
|
|
|
|
|
sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST,
|
|
|
|
wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND);
|
|
|
|
sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST,
|
2014-03-09 20:14:26 +00:00
|
|
|
wxDefaultPosition, wxSize(90, 100), 0, nullptr, wxLB_SORT), 1, wxEXPAND);
|
2011-02-28 20:40:15 +00:00
|
|
|
sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition,
|
2014-03-09 20:14:26 +00:00
|
|
|
wxSize(90, 100), 0, nullptr, wxLB_SORT), 0, wxEXPAND);
|
2011-02-28 20:40:15 +00:00
|
|
|
sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition,
|
2014-03-09 20:14:26 +00:00
|
|
|
wxSize(90, 100), 0, nullptr, wxLB_SORT), 0, wxEXPAND);
|
2011-02-28 20:40:15 +00:00
|
|
|
|
|
|
|
SetSizer(sizerBig);
|
|
|
|
|
|
|
|
sizerLeft->Fit(this);
|
|
|
|
sizerBig->Fit(this);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2009-08-25 01:50:27 +00:00
|
|
|
wxMenuBar *CCodeWindow::GetMenuBar()
|
|
|
|
{
|
2009-08-27 10:10:07 +00:00
|
|
|
return Parent->GetMenuBar();
|
2009-08-25 01:50:27 +00:00
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2014-08-08 10:43:13 +00:00
|
|
|
wxToolBar *CCodeWindow::GetToolBar()
|
2009-08-25 01:50:27 +00:00
|
|
|
{
|
2014-08-09 07:56:20 +00:00
|
|
|
return Parent->m_ToolBar;
|
2009-08-26 09:19:15 +00:00
|
|
|
}
|
2009-08-25 01:50:27 +00:00
|
|
|
|
2009-09-03 07:56:35 +00:00
|
|
|
// ----------
|
2009-08-27 16:08:43 +00:00
|
|
|
// Events
|
2009-09-03 07:56:35 +00:00
|
|
|
|
2009-01-05 02:52:55 +00:00
|
|
|
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_NOTIFYMAPLOADED:
|
|
|
|
NotifyMapLoaded();
|
2011-02-25 23:15:53 +00:00
|
|
|
if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-12-28 19:34:19 +00:00
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_UPDATEDISASMDIALOG:
|
|
|
|
Update();
|
2010-01-18 13:44:40 +00:00
|
|
|
if (codeview) codeview->Center(PC);
|
2013-04-08 05:16:50 +00:00
|
|
|
if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate();
|
|
|
|
break;
|
2009-01-05 02:52:55 +00:00
|
|
|
|
|
|
|
case IDM_UPDATEBREAKPOINTS:
|
2010-07-23 03:53:18 +00:00
|
|
|
Update();
|
2009-08-27 01:30:08 +00:00
|
|
|
if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate();
|
2009-01-05 02:52:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
// The Play, Stop, Step, Skip, Go to PC and Show PC buttons go here
|
|
|
|
void CCodeWindow::OnCodeStep(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_STEP:
|
2010-08-08 06:00:22 +00:00
|
|
|
SingleStep();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-08-27 16:08:43 +00:00
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_STEPOVER:
|
2010-08-08 06:00:22 +00:00
|
|
|
StepOver();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-08-27 16:08:43 +00:00
|
|
|
|
2010-08-08 06:00:22 +00:00
|
|
|
case IDM_TOGGLE_BREAKPOINT:
|
|
|
|
ToggleBreakpoint();
|
|
|
|
break;
|
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_SKIP:
|
|
|
|
PC += 4;
|
|
|
|
Update();
|
|
|
|
break;
|
2009-08-27 16:08:43 +00:00
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_SETPC:
|
|
|
|
PC = codeview->GetSelection();
|
|
|
|
Update();
|
|
|
|
break;
|
2009-08-27 16:08:43 +00:00
|
|
|
|
2013-04-08 05:16:50 +00:00
|
|
|
case IDM_GOTOPC:
|
|
|
|
JumpToAddress(PC);
|
|
|
|
break;
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
|
2010-07-23 03:53:18 +00:00
|
|
|
UpdateButtonStates();
|
2009-08-27 16:08:43 +00:00
|
|
|
// Update all toolbars in the aui manager
|
|
|
|
Parent->UpdateGUI();
|
|
|
|
}
|
|
|
|
|
2014-07-11 03:17:38 +00:00
|
|
|
bool CCodeWindow::JumpToAddress(u32 address)
|
2009-08-27 16:08:43 +00:00
|
|
|
{
|
2014-07-11 03:17:38 +00:00
|
|
|
// Jump to anywhere in memory
|
|
|
|
if (address <= 0xFFFFFFFF)
|
|
|
|
{
|
|
|
|
codeview->Center(address);
|
|
|
|
UpdateLists();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
|
|
|
|
{
|
|
|
|
UpdateLists();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
|
|
|
|
{
|
2014-07-11 03:17:38 +00:00
|
|
|
if (!GetToolBar())
|
|
|
|
return;
|
2009-08-27 16:08:43 +00:00
|
|
|
|
|
|
|
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX);
|
2014-07-13 18:29:03 +00:00
|
|
|
|
|
|
|
// Trim leading and trailing whitespace.
|
|
|
|
wxString txt = pAddrCtrl->GetValue().Trim().Trim(false);
|
2009-08-27 16:08:43 +00:00
|
|
|
|
2014-07-11 03:17:38 +00:00
|
|
|
bool success = false;
|
|
|
|
unsigned long addr;
|
|
|
|
if (txt.ToULong(&addr, 16))
|
2009-08-27 16:08:43 +00:00
|
|
|
{
|
2014-07-11 03:17:38 +00:00
|
|
|
if (JumpToAddress(addr))
|
|
|
|
success = true;
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
|
2014-07-11 03:17:38 +00:00
|
|
|
if (success)
|
|
|
|
pAddrCtrl->SetBackgroundColour(wxNullColour);
|
|
|
|
else
|
|
|
|
pAddrCtrl->SetBackgroundColour(*wxRED);
|
|
|
|
|
|
|
|
pAddrCtrl->Refresh();
|
|
|
|
|
2014-07-11 00:39:26 +00:00
|
|
|
event.Skip();
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnCallstackListChange(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int index = callstack->GetSelection();
|
2010-07-23 03:53:18 +00:00
|
|
|
if (index >= 0)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2009-08-27 16:08:43 +00:00
|
|
|
u32 address = (u32)(u64)(callstack->GetClientData(index));
|
|
|
|
if (address)
|
|
|
|
JumpToAddress(address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnCallersListChange(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int index = callers->GetSelection();
|
2010-07-23 03:53:18 +00:00
|
|
|
if (index >= 0)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2009-08-27 16:08:43 +00:00
|
|
|
u32 address = (u32)(u64)(callers->GetClientData(index));
|
|
|
|
if (address)
|
|
|
|
JumpToAddress(address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnCallsListChange(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int index = calls->GetSelection();
|
2010-07-23 03:53:18 +00:00
|
|
|
if (index >= 0)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2009-08-27 16:08:43 +00:00
|
|
|
u32 address = (u32)(u64)(calls->GetClientData(index));
|
|
|
|
if (address)
|
|
|
|
JumpToAddress(address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-08 06:00:22 +00:00
|
|
|
void CCodeWindow::SingleStep()
|
|
|
|
{
|
|
|
|
if (CCPU::IsStepping())
|
|
|
|
{
|
2013-02-26 19:49:00 +00:00
|
|
|
JitInterface::InvalidateICache(PC, 4);
|
2010-08-08 06:00:22 +00:00
|
|
|
CCPU::StepOpcode(&sync_event);
|
|
|
|
wxThread::Sleep(20);
|
|
|
|
// need a short wait here
|
|
|
|
JumpToAddress(PC);
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::StepOver()
|
|
|
|
{
|
|
|
|
if (CCPU::IsStepping())
|
|
|
|
{
|
|
|
|
UGeckoInstruction inst = Memory::Read_Instruction(PC);
|
|
|
|
if (inst.LK)
|
|
|
|
{
|
|
|
|
PowerPC::breakpoints.Add(PC + 4, true);
|
|
|
|
CCPU::EnableStepping(false);
|
|
|
|
JumpToAddress(PC);
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
else
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2010-08-08 06:00:22 +00:00
|
|
|
SingleStep();
|
2013-04-08 05:16:50 +00:00
|
|
|
}
|
2010-08-08 06:00:22 +00:00
|
|
|
|
|
|
|
UpdateButtonStates();
|
|
|
|
// Update all toolbars in the aui manager
|
|
|
|
Parent->UpdateGUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::ToggleBreakpoint()
|
2009-08-27 16:08:43 +00:00
|
|
|
{
|
2010-08-08 06:00:22 +00:00
|
|
|
if (CCPU::IsStepping())
|
|
|
|
{
|
|
|
|
if (codeview) codeview->ToggleBreakpoint(codeview->GetSelection());
|
|
|
|
Update();
|
|
|
|
}
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::UpdateLists()
|
|
|
|
{
|
|
|
|
callers->Clear();
|
|
|
|
u32 addr = codeview->GetSelection();
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(addr);
|
|
|
|
if (!symbol)
|
|
|
|
return;
|
2013-04-08 05:16:50 +00:00
|
|
|
|
2013-10-29 05:09:01 +00:00
|
|
|
for (auto& call : symbol->callers)
|
2009-08-27 16:08:43 +00:00
|
|
|
{
|
2013-10-29 05:09:01 +00:00
|
|
|
u32 caller_addr = call.callAddress;
|
2009-08-27 16:08:43 +00:00
|
|
|
Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
|
2010-07-23 03:53:18 +00:00
|
|
|
if (caller_symbol)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
int idx = callers->Append(StrToWxStr(StringFromFormat
|
2010-07-23 03:53:18 +00:00
|
|
|
("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str()));
|
2012-12-10 06:40:28 +00:00
|
|
|
callers->SetClientData(idx, (void*)(u64)caller_addr);
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
calls->Clear();
|
2013-10-29 05:09:01 +00:00
|
|
|
for (auto& call : symbol->calls)
|
2009-08-27 16:08:43 +00:00
|
|
|
{
|
2013-10-29 05:09:01 +00:00
|
|
|
u32 call_addr = call.function;
|
2009-08-27 16:08:43 +00:00
|
|
|
Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
|
2010-07-23 03:53:18 +00:00
|
|
|
if (call_symbol)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
int idx = calls->Append(StrToWxStr(StringFromFormat
|
2010-07-23 03:53:18 +00:00
|
|
|
("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str()));
|
2012-12-10 06:40:28 +00:00
|
|
|
calls->SetClientData(idx, (void*)(u64)call_addr);
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::UpdateCallstack()
|
|
|
|
{
|
2009-11-05 07:05:33 +00:00
|
|
|
if (Core::GetState() == Core::CORE_STOPPING) return;
|
2009-09-07 12:40:43 +00:00
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
callstack->Clear();
|
|
|
|
|
|
|
|
std::vector<Dolphin_Debugger::CallstackEntry> stack;
|
|
|
|
|
2009-10-15 15:43:51 +00:00
|
|
|
bool ret = Dolphin_Debugger::GetCallstack(stack);
|
|
|
|
|
2013-10-29 05:09:01 +00:00
|
|
|
for (auto& frame : stack)
|
2009-08-27 16:08:43 +00:00
|
|
|
{
|
2013-10-29 05:09:01 +00:00
|
|
|
int idx = callstack->Append(StrToWxStr(frame.Name));
|
|
|
|
callstack->SetClientData(idx, (void*)(u64)frame.vAddress);
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
2009-10-15 15:43:51 +00:00
|
|
|
|
|
|
|
if (!ret)
|
2013-02-28 04:37:38 +00:00
|
|
|
callstack->Append(StrToWxStr("invalid callstack"));
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
2009-09-02 21:00:45 +00:00
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
// Create CPU Mode menus
|
2013-04-08 05:16:50 +00:00
|
|
|
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-01-15 06:48:15 +00:00
|
|
|
// CPU Mode
|
2009-01-07 07:35:12 +00:00
|
|
|
wxMenu* pCoreMenu = new wxMenu;
|
|
|
|
|
2013-10-29 05:23:17 +00:00
|
|
|
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _("&Interpreter core"),
|
2014-05-17 17:17:28 +00:00
|
|
|
_("This is necessary to get break points"
|
2009-01-07 07:35:12 +00:00
|
|
|
" and stepping to work as explained in the Developer Documentation. But it can be very"
|
2013-10-29 05:23:17 +00:00
|
|
|
" slow, perhaps slower than 1 fps."),
|
2011-01-05 04:35:46 +00:00
|
|
|
wxITEM_CHECK);
|
2014-07-07 03:30:06 +00:00
|
|
|
interpreter->Check(_LocalCoreStartupParameter.iCPUCore == 0);
|
2009-01-07 07:35:12 +00:00
|
|
|
pCoreMenu->AppendSeparator();
|
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITBLOCKLINKING, _("&JIT Block Linking off"),
|
2013-10-29 05:23:17 +00:00
|
|
|
_("Provide safer execution by not linking the JIT blocks."),
|
2009-08-25 01:50:27 +00:00
|
|
|
wxITEM_CHECK);
|
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITNOBLOCKCACHE, _("&Disable JIT Cache"),
|
2013-10-29 05:23:17 +00:00
|
|
|
_("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing.\n[This option must be selected before a game is started.]"),
|
2009-08-25 01:50:27 +00:00
|
|
|
wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_CLEARCODECACHE, _("&Clear JIT cache"));
|
2009-01-20 16:52:46 +00:00
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
pCoreMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_LOGINSTRUCTIONS, _("&Log JIT instruction coverage"));
|
|
|
|
pCoreMenu->Append(IDM_SEARCHINSTRUCTION, _("&Search for an op"));
|
2009-01-20 16:52:46 +00:00
|
|
|
|
2010-07-05 02:05:47 +00:00
|
|
|
pCoreMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITOFF, _("&JIT off (JIT core)"),
|
|
|
|
_("Turn off all JIT functions, but still use the JIT core from Jit.cpp"),
|
2010-07-05 02:05:47 +00:00
|
|
|
wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITLSOFF, _("&JIT LoadStore off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITLSLBZXOFF, _(" &JIT LoadStore lbzx off"),
|
2010-07-23 03:53:18 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITLSLXZOFF, _(" &JIT LoadStore lXz off"),
|
2010-07-23 03:53:18 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITLSLWZOFF, _("&JIT LoadStore lwz off"),
|
2010-07-23 03:53:18 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITLSFOFF, _("&JIT LoadStore Floating off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITLSPOFF, _("&JIT LoadStore Paired off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITFPOFF, _("&JIT FloatingPoint off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITIOFF, _("&JIT Integer off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITPOFF, _("&JIT Paired off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2011-01-05 04:35:46 +00:00
|
|
|
pCoreMenu->Append(IDM_JITSROFF, _("&JIT SystemRegisters off"),
|
2013-04-08 05:16:50 +00:00
|
|
|
wxEmptyString, wxITEM_CHECK);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
pMenuBar->Append(pCoreMenu, _("&JIT"));
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2010-08-08 06:00:22 +00:00
|
|
|
|
|
|
|
// Debug Menu
|
|
|
|
wxMenu* pDebugMenu = new wxMenu;
|
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
pDebugMenu->Append(IDM_STEP, _("Step &Into\tF11"));
|
|
|
|
pDebugMenu->Append(IDM_STEPOVER, _("Step &Over\tF10"));
|
|
|
|
pDebugMenu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint\tF9"));
|
2014-08-09 07:42:32 +00:00
|
|
|
pDebugMenu->AppendSeparator();
|
|
|
|
|
|
|
|
wxMenu* pPerspectives = new wxMenu;
|
|
|
|
Parent->m_SavedPerspectives = new wxMenu;
|
|
|
|
pDebugMenu->AppendSubMenu(pPerspectives, _("Perspectives"), _("Edit Perspectives"));
|
|
|
|
pPerspectives->Append(IDM_SAVE_PERSPECTIVE, _("Save perspectives"), _("Save currently-toggled perspectives"));
|
|
|
|
pPerspectives->Append(IDM_EDIT_PERSPECTIVES, _("Edit perspectives"), _("Toggle editing of perspectives"), wxITEM_CHECK);
|
|
|
|
pPerspectives->AppendSeparator();
|
|
|
|
pPerspectives->Append(IDM_ADD_PERSPECTIVE, _("Create new perspective"));
|
|
|
|
pPerspectives->AppendSubMenu(Parent->m_SavedPerspectives, _("Saved perspectives"));
|
|
|
|
Parent->PopulateSavedPerspectives();
|
|
|
|
pPerspectives->AppendSeparator();
|
|
|
|
pPerspectives->Append(IDM_PERSPECTIVES_ADD_PANE, _("Add new pane"));
|
|
|
|
pPerspectives->Append(IDM_TAB_SPLIT, _("Tab split"), "", wxITEM_CHECK);
|
|
|
|
pPerspectives->Append(IDM_NO_DOCKING, _("Disable docking"), "Disable docking of perspective panes to main window", wxITEM_CHECK);
|
|
|
|
|
2010-08-08 06:00:22 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
pMenuBar->Append(pDebugMenu, _("&Debug"));
|
2010-08-08 06:00:22 +00:00
|
|
|
|
2010-07-26 03:46:14 +00:00
|
|
|
CreateMenuSymbols(pMenuBar);
|
2009-01-05 02:52:55 +00:00
|
|
|
}
|
|
|
|
|
2010-07-26 03:46:14 +00:00
|
|
|
void CCodeWindow::CreateMenuOptions(wxMenu* pMenu)
|
2009-09-03 06:54:46 +00:00
|
|
|
{
|
2011-01-05 04:35:46 +00:00
|
|
|
wxMenuItem* boottopause = pMenu->Append(IDM_BOOTTOPAUSE, _("Boot to pause"),
|
2013-10-29 05:23:17 +00:00
|
|
|
_("Start the game directly instead of booting to pause"),
|
2011-01-05 04:35:46 +00:00
|
|
|
wxITEM_CHECK);
|
2009-09-03 06:54:46 +00:00
|
|
|
boottopause->Check(bBootToPause);
|
|
|
|
|
2013-10-29 05:23:17 +00:00
|
|
|
wxMenuItem* automaticstart = pMenu->Append(IDM_AUTOMATICSTART, _("&Automatic start"),
|
2014-05-17 17:17:28 +00:00
|
|
|
_(
|
2009-09-03 06:54:46 +00:00
|
|
|
"Automatically load the Default ISO when Dolphin starts, or the last game you loaded,"
|
|
|
|
" if you have not given it an elf file with the --elf command line. [This can be"
|
2010-07-05 02:05:47 +00:00
|
|
|
" convenient if you are bug-testing with a certain game and want to rebuild"
|
2009-09-03 06:54:46 +00:00
|
|
|
" and retry it several times, either with changes to Dolphin or if you are"
|
2013-10-29 05:23:17 +00:00
|
|
|
" developing a homebrew game.]"),
|
2011-01-05 04:35:46 +00:00
|
|
|
wxITEM_CHECK);
|
2010-07-23 03:53:18 +00:00
|
|
|
automaticstart->Check(bAutomaticStart);
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2014-05-17 17:17:28 +00:00
|
|
|
pMenu->Append(IDM_FONTPICKER, _("&Font..."));
|
2009-09-03 06:54:46 +00:00
|
|
|
}
|
2009-01-05 02:52:55 +00:00
|
|
|
|
2009-01-07 07:35:12 +00:00
|
|
|
// CPU Mode and JIT Menu
|
|
|
|
void CCodeWindow::OnCPUMode(wxCommandEvent& event)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-01-07 07:35:12 +00:00
|
|
|
switch (event.GetId())
|
2009-01-05 02:52:55 +00:00
|
|
|
{
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_INTERPRETER:
|
2010-07-23 03:53:18 +00:00
|
|
|
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT);
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_BOOTTOPAUSE:
|
2010-07-23 03:53:18 +00:00
|
|
|
bBootToPause = !bBootToPause;
|
2013-04-08 05:16:50 +00:00
|
|
|
return;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_AUTOMATICSTART:
|
2010-07-23 03:53:18 +00:00
|
|
|
bAutomaticStart = !bAutomaticStart;
|
2013-04-08 05:16:50 +00:00
|
|
|
return;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITLSOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITLoadStoreOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2010-07-23 03:53:18 +00:00
|
|
|
case IDM_JITLSLXZOFF:
|
|
|
|
Core::g_CoreStartupParameter.bJITLoadStorelXzOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2010-07-23 03:53:18 +00:00
|
|
|
case IDM_JITLSLWZOFF:
|
|
|
|
Core::g_CoreStartupParameter.bJITLoadStorelwzOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2010-07-23 03:53:18 +00:00
|
|
|
case IDM_JITLSLBZXOFF:
|
|
|
|
Core::g_CoreStartupParameter.bJITLoadStorelbzxOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITLSFOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITLSPOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITLoadStorePairedOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITFPOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITFloatingPointOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITIOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITIntegerOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITPOFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITPairedOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_JITSROFF:
|
2010-07-23 03:53:18 +00:00
|
|
|
Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-05 02:52:55 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-01-07 07:35:12 +00:00
|
|
|
// Clear the JIT cache to enable these changes
|
2013-02-26 19:49:00 +00:00
|
|
|
JitInterface::ClearCache();
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2009-09-03 23:28:28 +00:00
|
|
|
// Update
|
|
|
|
UpdateButtonStates();
|
2009-08-27 16:08:43 +00:00
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
void CCodeWindow::OnJitMenu(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
2009-01-07 07:35:12 +00:00
|
|
|
case IDM_LOGINSTRUCTIONS:
|
2010-07-23 03:53:18 +00:00
|
|
|
PPCTables::LogCompiledInstructions();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-01-07 07:35:12 +00:00
|
|
|
|
|
|
|
case IDM_CLEARCODECACHE:
|
2013-02-26 19:49:00 +00:00
|
|
|
JitInterface::ClearCache();
|
2013-04-08 05:16:50 +00:00
|
|
|
break;
|
2009-06-17 19:50:59 +00:00
|
|
|
|
|
|
|
case IDM_SEARCHINSTRUCTION:
|
|
|
|
{
|
2014-05-17 17:17:28 +00:00
|
|
|
wxString str = wxGetTextFromUser("", _("Op?"), wxEmptyString, this);
|
2010-07-23 03:53:18 +00:00
|
|
|
for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4)
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2009-06-17 19:50:59 +00:00
|
|
|
const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr));
|
2013-02-28 04:37:38 +00:00
|
|
|
auto const wx_name = WxStrToStr(str);
|
|
|
|
if (name && (wx_name == name))
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
NOTICE_LOG(POWERPC, "Found %s at %08x", wx_name.c_str(), addr);
|
2010-05-26 21:07:13 +00:00
|
|
|
}
|
2009-06-17 19:50:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-03 23:28:28 +00:00
|
|
|
// Shortcuts
|
|
|
|
bool CCodeWindow::UseInterpreter()
|
|
|
|
{
|
|
|
|
return GetMenuBar()->IsChecked(IDM_INTERPRETER);
|
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2009-09-03 23:28:28 +00:00
|
|
|
bool CCodeWindow::BootToPause()
|
|
|
|
{
|
|
|
|
return GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE);
|
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2009-09-03 23:28:28 +00:00
|
|
|
bool CCodeWindow::AutomaticStart()
|
|
|
|
{
|
|
|
|
return GetMenuBar()->IsChecked(IDM_AUTOMATICSTART);
|
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2010-07-05 02:05:47 +00:00
|
|
|
bool CCodeWindow::JITNoBlockCache()
|
2009-09-03 23:28:28 +00:00
|
|
|
{
|
2010-07-05 02:05:47 +00:00
|
|
|
return GetMenuBar()->IsChecked(IDM_JITNOBLOCKCACHE);
|
2009-09-03 23:28:28 +00:00
|
|
|
}
|
2010-07-23 03:53:18 +00:00
|
|
|
|
2009-09-03 23:28:28 +00:00
|
|
|
bool CCodeWindow::JITBlockLinking()
|
|
|
|
{
|
|
|
|
return GetMenuBar()->IsChecked(IDM_JITBLOCKLINKING);
|
|
|
|
}
|
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
// Toolbar
|
|
|
|
void CCodeWindow::InitBitmaps()
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-08-27 16:08:43 +00:00
|
|
|
// load original size 48x48
|
|
|
|
m_Bitmaps[Toolbar_Step] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png);
|
|
|
|
m_Bitmaps[Toolbar_StepOver] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
|
|
|
m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
|
|
|
m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
|
|
|
m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2010-01-19 09:12:41 +00:00
|
|
|
// scale to 24x24 for toolbar
|
2013-10-29 05:09:01 +00:00
|
|
|
for (auto& bitmap : m_Bitmaps)
|
|
|
|
bitmap = wxBitmap(bitmap.ConvertToImage().Scale(24, 24));
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2014-08-08 10:43:13 +00:00
|
|
|
void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
|
2009-01-05 02:52:55 +00:00
|
|
|
{
|
2013-01-16 23:09:09 +00:00
|
|
|
int w = m_Bitmaps[0].GetWidth(),
|
|
|
|
h = m_Bitmaps[0].GetHeight();
|
2009-01-05 02:52:55 +00:00
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
toolBar->SetToolBitmapSize(wxSize(w, h));
|
2014-02-17 04:51:41 +00:00
|
|
|
toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
|
|
|
|
toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
|
|
|
|
toolBar->AddTool(IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip]);
|
2009-08-27 16:08:43 +00:00
|
|
|
toolBar->AddSeparator();
|
2014-02-17 04:51:41 +00:00
|
|
|
toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
|
|
|
|
toolBar->AddTool(IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC]);
|
2009-08-27 16:08:43 +00:00
|
|
|
toolBar->AddSeparator();
|
2014-05-17 17:17:28 +00:00
|
|
|
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, ""));
|
2009-02-23 21:27:58 +00:00
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
toolBar->Realize();
|
2009-02-23 21:27:58 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
// Update GUI
|
2009-02-23 21:27:58 +00:00
|
|
|
void CCodeWindow::Update()
|
|
|
|
{
|
2009-09-07 12:40:43 +00:00
|
|
|
if (!codeview) return;
|
|
|
|
|
2009-02-23 21:27:58 +00:00
|
|
|
codeview->Refresh();
|
|
|
|
UpdateCallstack();
|
2008-12-08 05:30:24 +00:00
|
|
|
UpdateButtonStates();
|
|
|
|
|
2010-07-23 03:53:18 +00:00
|
|
|
// Do not automatically show the current PC position when a breakpoint is hit or
|
|
|
|
// when we pause since this can be called at other times too.
|
2009-09-07 12:40:43 +00:00
|
|
|
//codeview->Center(PC);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::UpdateButtonStates()
|
|
|
|
{
|
2009-01-07 07:35:12 +00:00
|
|
|
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
|
|
|
|
bool Pause = (Core::GetState() == Core::CORE_PAUSE);
|
2009-09-03 06:54:46 +00:00
|
|
|
bool Stepping = CCPU::IsStepping();
|
2014-08-08 10:43:13 +00:00
|
|
|
wxToolBar* ToolBar = GetToolBar();
|
2009-01-07 07:35:12 +00:00
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
// Toolbar
|
2014-05-18 15:43:17 +00:00
|
|
|
if (!ToolBar)
|
|
|
|
return;
|
2009-08-25 01:50:27 +00:00
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
if (!Initialized)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-08-27 00:54:44 +00:00
|
|
|
ToolBar->EnableTool(IDM_STEPOVER, false);
|
|
|
|
ToolBar->EnableTool(IDM_SKIP, false);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-03 06:54:46 +00:00
|
|
|
if (!Stepping)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-08-27 00:54:44 +00:00
|
|
|
ToolBar->EnableTool(IDM_STEPOVER, false);
|
|
|
|
ToolBar->EnableTool(IDM_SKIP, false);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-08-27 00:54:44 +00:00
|
|
|
ToolBar->EnableTool(IDM_STEPOVER, true);
|
|
|
|
ToolBar->EnableTool(IDM_SKIP, true);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-03 23:28:28 +00:00
|
|
|
|
2010-07-23 03:53:18 +00:00
|
|
|
ToolBar->EnableTool(IDM_STEP, Initialized && Stepping);
|
2014-05-18 15:43:17 +00:00
|
|
|
ToolBar->Realize();
|
2009-01-07 07:35:12 +00:00
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
// Menu bar
|
2009-09-08 16:07:13 +00:00
|
|
|
// ------------------
|
2009-01-07 07:35:12 +00:00
|
|
|
GetMenuBar()->Enable(IDM_INTERPRETER, Pause); // CPU Mode
|
|
|
|
|
2010-07-05 02:05:47 +00:00
|
|
|
GetMenuBar()->Enable(IDM_JITNOBLOCKCACHE, !Initialized);
|
|
|
|
|
2009-01-07 07:35:12 +00:00
|
|
|
GetMenuBar()->Enable(IDM_JITOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITLSOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITLSLXZOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITLSLWZOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITLSLBZXOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITLSFOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITLSPOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITFPOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITIOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITPOFF, Pause);
|
|
|
|
GetMenuBar()->Enable(IDM_JITSROFF, Pause);
|
|
|
|
|
|
|
|
GetMenuBar()->Enable(IDM_CLEARCODECACHE, Pause); // JIT Menu
|
2009-09-03 06:54:46 +00:00
|
|
|
GetMenuBar()->Enable(IDM_SEARCHINSTRUCTION, Initialized);
|
|
|
|
|
|
|
|
GetMenuBar()->Enable(IDM_CLEARSYMBOLS, Initialized); // Symbols menu
|
|
|
|
GetMenuBar()->Enable(IDM_SCANFUNCTIONS, Initialized);
|
|
|
|
GetMenuBar()->Enable(IDM_LOADMAPFILE, Initialized);
|
|
|
|
GetMenuBar()->Enable(IDM_SAVEMAPFILE, Initialized);
|
|
|
|
GetMenuBar()->Enable(IDM_SAVEMAPFILEWITHCODES, Initialized);
|
|
|
|
GetMenuBar()->Enable(IDM_CREATESIGNATUREFILE, Initialized);
|
2010-07-23 03:53:18 +00:00
|
|
|
GetMenuBar()->Enable(IDM_RENAME_SYMBOLS, Initialized);
|
2009-09-03 06:54:46 +00:00
|
|
|
GetMenuBar()->Enable(IDM_USESIGNATUREFILE, Initialized);
|
|
|
|
GetMenuBar()->Enable(IDM_PATCHHLEFUNCTIONS, Initialized);
|
2009-02-06 18:18:20 +00:00
|
|
|
|
|
|
|
// Update Fonts
|
|
|
|
callstack->SetFont(DebuggerFont);
|
|
|
|
symbols->SetFont(DebuggerFont);
|
|
|
|
callers->SetFont(DebuggerFont);
|
|
|
|
calls->SetFont(DebuggerFont);
|
2009-08-27 00:54:44 +00:00
|
|
|
}
|