mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Debugger : fixed Breakpoint "toolbar", re-enabled a couple of host messages for dialog updates and other stuff, breakpoints in memory view are now memory checks instead of PPC breakpoints
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4337 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -16,16 +16,21 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Debugger.h"
|
||||
#include "Common.h"
|
||||
|
||||
#include "BreakpointView.h"
|
||||
#include "Debugger/Debugger_SymbolMap.h"
|
||||
#include "PowerPC/PPCSymbolDB.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
#include "HW/Memmap.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(CBreakPointView, wxListCtrl)
|
||||
#include <wx/mstream.h>
|
||||
|
||||
extern "C" {
|
||||
#include "../resources/toolbar_add_breakpoint.c"
|
||||
#include "../resources/toolbar_add_memorycheck.c"
|
||||
#include "../resources/toolbar_delete.c"
|
||||
}
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CBreakPointView::CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxListCtrl(parent, id, pos, size, style)
|
||||
@ -120,3 +125,46 @@ void CBreakPointView::DeleteCurrentSelection()
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CBreakPointBar::CBreakPointBar(CBreakPointWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxListCtrl((wxWindow*)parent, id, pos, size, style)
|
||||
{
|
||||
BPWindow = parent;
|
||||
|
||||
SetBackgroundColour(wxColour(0x555555));
|
||||
SetForegroundColour(wxColour(0xffffff));
|
||||
|
||||
// load orignal size 48x48
|
||||
wxMemoryInputStream st1(toolbar_delete_png, sizeof(toolbar_delete_png));
|
||||
wxMemoryInputStream st2(toolbar_add_breakpoint_png, sizeof(toolbar_add_breakpoint_png));
|
||||
wxMemoryInputStream st3(toolbar_add_memcheck_png, sizeof(toolbar_add_memcheck_png));
|
||||
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxImage(st1, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
|
||||
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxImage(st2, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
|
||||
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxImage(st3, wxBITMAP_TYPE_ANY, -1).Rescale(24,24), -1);
|
||||
|
||||
m_imageListNormal = new wxImageList(24, 24);
|
||||
m_imageListNormal->Add(m_Bitmaps[Toolbar_Delete]);
|
||||
m_imageListNormal->Add(m_Bitmaps[Toolbar_Add_BP]);
|
||||
m_imageListNormal->Add(m_Bitmaps[Toolbar_Add_MC]);
|
||||
SetImageList(m_imageListNormal, wxIMAGE_LIST_NORMAL);
|
||||
|
||||
PopulateBar();
|
||||
}
|
||||
|
||||
|
||||
void CBreakPointBar::PopulateBar()
|
||||
{
|
||||
long Index = InsertItem(IDM_DELETE, _T("Delete"), 0);
|
||||
InsertItem(IDM_CLEAR, _T("Clear all"), 0);
|
||||
|
||||
InsertItem(IDM_ADD_BREAKPOINT, _T("Add BP..."), 1);
|
||||
InsertItem(IDM_ADD_BREAKPOINTMANY, _T("Add BPs..."), 1);
|
||||
|
||||
// just add memory breakpoints if you can use them
|
||||
if (Memory::AreMemoryBreakpointsActivated())
|
||||
{
|
||||
InsertItem(IDM_ADD_MEMORYCHECK, _T("Add MC..."), 2);
|
||||
InsertItem(IDM_ADD_MEMORYCHECKMANY, _T("Add MCs..."), 2);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "BreakpointWindow.h"
|
||||
|
||||
class CBreakPointView
|
||||
: public wxListCtrl
|
||||
@ -30,12 +31,31 @@ class CBreakPointView
|
||||
CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
|
||||
void Update();
|
||||
|
||||
void DeleteCurrentSelection();
|
||||
};
|
||||
|
||||
class CBreakPointBar
|
||||
: public wxListCtrl
|
||||
{
|
||||
public:
|
||||
|
||||
CBreakPointBar(CBreakPointWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
|
||||
void PopulateBar();
|
||||
|
||||
private:
|
||||
void OnSelectItem(wxListEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
enum
|
||||
{
|
||||
Toolbar_Delete,
|
||||
Toolbar_Add_BP,
|
||||
Toolbar_Add_MC,
|
||||
Bitmaps_max
|
||||
};
|
||||
|
||||
CBreakPointWindow* BPWindow;
|
||||
wxBitmap m_Bitmaps[Bitmaps_max];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,6 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Debugger.h"
|
||||
#include "BreakpointWindow.h"
|
||||
#include "BreakpointView.h"
|
||||
#include "CodeWindow.h"
|
||||
#include "HW/Memmap.h"
|
||||
@ -25,23 +24,11 @@
|
||||
#include "Host.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
|
||||
#include <wx/mstream.h>
|
||||
|
||||
extern "C" {
|
||||
#include "../resources/toolbar_add_breakpoint.c"
|
||||
#include "../resources/toolbar_add_memorycheck.c"
|
||||
#include "../resources/toolbar_delete.c"
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
|
||||
EVT_CLOSE(CBreakPointWindow::OnClose)
|
||||
EVT_MENU(IDM_DELETE, CBreakPointWindow::OnDelete)
|
||||
EVT_MENU(IDM_CLEAR, CBreakPointWindow::OnClear)
|
||||
EVT_MENU(IDM_ADD_BREAKPOINT, CBreakPointWindow::OnAddBreakPoint)
|
||||
EVT_MENU(IDM_ADD_BREAKPOINTMANY, CBreakPointWindow::OnAddBreakPointMany)
|
||||
EVT_MENU(IDM_ADD_MEMORYCHECK, CBreakPointWindow::OnAddMemoryCheck)
|
||||
EVT_MENU(IDM_ADD_MEMORYCHECKMANY, CBreakPointWindow::OnAddMemoryCheckMany)
|
||||
EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated)
|
||||
EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated)
|
||||
EVT_LIST_ITEM_SELECTED(ID_TOOLBAR, CBreakPointWindow::OnSelectItem)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
||||
@ -49,81 +36,51 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
|
||||
, m_BreakPointListView(NULL)
|
||||
, m_pCodeWindow(_pCodeWindow)
|
||||
{
|
||||
InitBitmaps();
|
||||
|
||||
CreateGUIControls();
|
||||
|
||||
// Create the toolbar
|
||||
RecreateToolbar();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::CreateGUIControls()
|
||||
{
|
||||
// SetTitle(wxT("Breakpoints"));
|
||||
// SetIcon(wxNullIcon);
|
||||
SetSize(8, 8, 400, 370);
|
||||
Center();
|
||||
|
||||
m_BreakPointListView = new CBreakPointView(this, ID_BPS, wxDefaultPosition, GetSize(),
|
||||
m_BreakPointBar = new CBreakPointBar(this, ID_TOOLBAR, wxDefaultPosition, wxSize(0, 55),
|
||||
wxLC_ICON | wxSUNKEN_BORDER | wxLC_SINGLE_SEL);
|
||||
m_BreakPointListView = new CBreakPointView(this, ID_BPS, wxDefaultPosition, wxDefaultSize,
|
||||
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
|
||||
|
||||
wxBoxSizer* sizerH = new wxBoxSizer(wxVERTICAL);
|
||||
sizerH->Add(m_BreakPointBar, 0, wxALL | wxEXPAND);
|
||||
sizerH->Add((wxListCtrl*)m_BreakPointListView, 1, wxEXPAND);
|
||||
|
||||
NotifyUpdate();
|
||||
SetSizer(sizerH);
|
||||
}
|
||||
|
||||
void CBreakPointWindow::PopulateToolbar(wxToolBar* toolBar)
|
||||
void CBreakPointWindow::OnSelectItem(wxListEvent& event)
|
||||
{
|
||||
int w = m_Bitmaps[Toolbar_Delete].GetWidth(),
|
||||
h = m_Bitmaps[Toolbar_Delete].GetHeight();
|
||||
|
||||
toolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
toolBar->AddTool(IDM_DELETE, _T("Delete"), m_Bitmaps[Toolbar_Delete], _T("Delete the selected BreakPoint or MemoryCheck"));
|
||||
toolBar->AddTool(IDM_CLEAR, _T("Clear all"), m_Bitmaps[Toolbar_Delete], _T("Clear all BreakPoints and MemoryChecks"));
|
||||
|
||||
toolBar->AddSeparator();
|
||||
|
||||
toolBar->AddTool(IDM_ADD_BREAKPOINT, _T("BP"), m_Bitmaps[Toolbar_Add_BreakPoint], _T("Add BreakPoint..."));
|
||||
toolBar->AddTool(IDM_ADD_BREAKPOINTMANY, _T("BPs"), m_Bitmaps[Toolbar_Add_BreakPoint], _T("Add BreakPoints..."));
|
||||
|
||||
// just add memory breakpoints if you can use them
|
||||
if (Memory::AreMemoryBreakpointsActivated())
|
||||
{
|
||||
toolBar->AddTool(IDM_ADD_MEMORYCHECK, _T("MC"), m_Bitmaps[Toolbar_Add_Memcheck], _T("Add MemoryCheck..."));
|
||||
toolBar->AddTool(IDM_ADD_MEMORYCHECKMANY, _T("MCs"), m_Bitmaps[Toolbar_Add_Memcheck], _T("Add MemoryChecks..."));
|
||||
}
|
||||
|
||||
// after adding the buttons to the toolbar, must call Realize() to reflect
|
||||
// the changes
|
||||
toolBar->Realize();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::RecreateToolbar()
|
||||
{
|
||||
// FIXME: what do we do with this?
|
||||
// delete and recreate the toolbar
|
||||
// wxToolBarBase* toolBar = GetToolBar();
|
||||
// long style = toolBar ? toolBar->GetWindowStyle() : wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
|
||||
|
||||
// delete toolBar;
|
||||
// SetToolBar(NULL);
|
||||
|
||||
// style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP);
|
||||
// wxToolBar* theToolBar = CreateToolBar(style, ID_TOOLBAR);
|
||||
|
||||
// PopulateToolbar(theToolBar);
|
||||
// SetToolBar(theToolBar);
|
||||
}
|
||||
|
||||
void CBreakPointWindow::InitBitmaps()
|
||||
{
|
||||
// load orignal size 48x48
|
||||
m_Bitmaps[Toolbar_Delete] = wxGetBitmapFromMemory(toolbar_delete_png);
|
||||
m_Bitmaps[Toolbar_Add_BreakPoint] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png);
|
||||
m_Bitmaps[Toolbar_Add_Memcheck] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
|
||||
|
||||
// scale to 24x24 for toolbar
|
||||
for (size_t n = Toolbar_Delete; n < WXSIZEOF(m_Bitmaps); n++)
|
||||
switch(event.GetItem().GetId())
|
||||
{
|
||||
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(16, 16));
|
||||
case IDM_DELETE:
|
||||
OnDelete();
|
||||
m_BreakPointBar->SetItemState(event.GetItem().GetId(), 0, wxLIST_STATE_FOCUSED);
|
||||
break;
|
||||
case IDM_CLEAR:
|
||||
OnClear();
|
||||
m_BreakPointBar->SetItemState(event.GetItem().GetId(), 0, wxLIST_STATE_FOCUSED);
|
||||
break;
|
||||
case IDM_ADD_BREAKPOINT:
|
||||
OnAddBreakPoint();
|
||||
break;
|
||||
case IDM_ADD_BREAKPOINTMANY:
|
||||
OnAddBreakPointMany();
|
||||
break;
|
||||
case IDM_ADD_MEMORYCHECK:
|
||||
OnAddMemoryCheck();
|
||||
break;
|
||||
case IDM_ADD_MEMORYCHECKMANY:
|
||||
OnAddMemoryCheckMany();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +94,7 @@ void CBreakPointWindow::NotifyUpdate()
|
||||
if (m_BreakPointListView != NULL) m_BreakPointListView->Update();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::OnDelete(wxCommandEvent& event)
|
||||
void CBreakPointWindow::OnDelete()
|
||||
{
|
||||
if (m_BreakPointListView)
|
||||
{
|
||||
@ -163,19 +120,20 @@ void CBreakPointWindow::OnActivated(wxListEvent& event)
|
||||
// ---------------------
|
||||
|
||||
// Clear all breakpoints
|
||||
void CBreakPointWindow::OnClear(wxCommandEvent& event)
|
||||
void CBreakPointWindow::OnClear()
|
||||
{
|
||||
PowerPC::breakpoints.Clear();
|
||||
PowerPC::memchecks.Clear();
|
||||
NotifyUpdate();
|
||||
}
|
||||
// Add one breakpoint
|
||||
void CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& event)
|
||||
void CBreakPointWindow::OnAddBreakPoint()
|
||||
{
|
||||
BreakPointDlg bpDlg(this, this);
|
||||
bpDlg.ShowModal();
|
||||
}
|
||||
// Load breakpoints from file
|
||||
void CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
|
||||
void CBreakPointWindow::OnAddBreakPointMany()
|
||||
{
|
||||
// load ini
|
||||
IniFile ini;
|
||||
@ -211,19 +169,17 @@ void CBreakPointWindow::OnAddBreakPointMany(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Memory check actions
|
||||
// ---------------------
|
||||
void
|
||||
CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& event)
|
||||
CBreakPointWindow::OnAddMemoryCheck()
|
||||
{
|
||||
MemoryCheckDlg memDlg(this);
|
||||
memDlg.ShowModal();
|
||||
}
|
||||
|
||||
// Load memory checks from file
|
||||
void CBreakPointWindow::OnAddMemoryCheckMany(wxCommandEvent& event)
|
||||
void CBreakPointWindow::OnAddMemoryCheckMany()
|
||||
{
|
||||
// load ini
|
||||
IniFile ini;
|
||||
|
@ -18,11 +18,24 @@
|
||||
#ifndef __BREAKPOINTWINDOW_h__
|
||||
#define __BREAKPOINTWINDOW_h__
|
||||
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
class CBreakPointView;
|
||||
class CBreakPointBar;
|
||||
class CCodeWindow;
|
||||
class wxListEvent;
|
||||
class IniFile;
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_DELETE = 0,
|
||||
IDM_CLEAR,
|
||||
IDM_ADD_BREAKPOINT,
|
||||
IDM_ADD_BREAKPOINTMANY,
|
||||
IDM_ADD_MEMORYCHECK,
|
||||
IDM_ADD_MEMORYCHECKMANY
|
||||
};
|
||||
|
||||
class CBreakPointWindow
|
||||
: public wxPanel
|
||||
{
|
||||
@ -37,6 +50,12 @@ class CBreakPointWindow
|
||||
long style = wxNO_BORDER);
|
||||
|
||||
void NotifyUpdate();
|
||||
void OnDelete();
|
||||
void OnClear();
|
||||
void OnAddBreakPoint();
|
||||
void OnAddBreakPointMany();
|
||||
void OnAddMemoryCheck();
|
||||
void OnAddMemoryCheckMany();
|
||||
|
||||
private:
|
||||
|
||||
@ -44,40 +63,19 @@ class CBreakPointWindow
|
||||
{
|
||||
ID_TOOLBAR = 501,
|
||||
ID_BPS = 1002,
|
||||
IDM_DELETE,
|
||||
IDM_CLEAR,
|
||||
IDM_ADD_BREAKPOINT,
|
||||
IDM_ADD_BREAKPOINTMANY,
|
||||
IDM_ADD_MEMORYCHECK,
|
||||
IDM_ADD_MEMORYCHECKMANY
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Toolbar_Delete,
|
||||
Toolbar_Add_BreakPoint,
|
||||
Toolbar_Add_Memcheck,
|
||||
Bitmaps_max
|
||||
};
|
||||
|
||||
CBreakPointBar* m_BreakPointBar;
|
||||
CBreakPointView* m_BreakPointListView;
|
||||
CCodeWindow* m_pCodeWindow;
|
||||
|
||||
wxBitmap m_Bitmaps[Bitmaps_max];
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
// void RecreateToolbar();
|
||||
// void PopulateToolbar(wxToolBar* toolBar);
|
||||
// void InitBitmaps();
|
||||
void CreateGUIControls();
|
||||
|
||||
void RecreateToolbar();
|
||||
void PopulateToolbar(wxToolBar* toolBar);
|
||||
void InitBitmaps();
|
||||
|
||||
void OnDelete(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void OnAddBreakPoint(wxCommandEvent& event);
|
||||
void OnAddBreakPointMany(wxCommandEvent& event);
|
||||
void OnAddMemoryCheck(wxCommandEvent& event);
|
||||
void OnAddMemoryCheckMany(wxCommandEvent& event);
|
||||
void OnSelectItem(wxListEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnActivated(wxListEvent& event);
|
||||
};
|
||||
|
||||
|
@ -142,7 +142,7 @@ EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
|
||||
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
|
||||
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
|
||||
|
||||
//EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
|
||||
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
|
||||
|
||||
//EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
|
||||
|
||||
|
Reference in New Issue
Block a user