UI/debugger changes

This commit is contained in:
Mathieu Vaillancourt 2014-04-18 18:30:53 -04:00
parent 958bca606e
commit e5f09b8be6
19 changed files with 285 additions and 233 deletions

View file

@ -1,36 +0,0 @@
#include <QStandardItemModel>
#include "callstack.hxx"
//#include "debugger/debugger.h"
GCallstackView::GCallstackView(QWidget* parent): QDockWidget(parent)
{
ui.setupUi(this);
callstack_model = new QStandardItemModel(this);
callstack_model->setColumnCount(3);
callstack_model->setHeaderData(0, Qt::Horizontal, "Depth");
callstack_model->setHeaderData(1, Qt::Horizontal, "Address");
callstack_model->setHeaderData(2, Qt::Horizontal, "Function Name");
ui.treeView->setModel(callstack_model);
// TODO: Make single clicking a callstack entry jump to the corresponding disassembly position
}
void GCallstackView::OnCPUStepped()
{
/*
Debugger::Callstack callstack;
Debugger::GetCallstack(callstack);
callstack_model->setRowCount(callstack.size());
for (int i = 0; i < callstack.size(); ++i)
for (Debugger::CallstackIterator it = callstack.begin(); it != callstack.end(); ++it)
{
Debugger::CallstackEntry entry = callstack[i];
callstack_model->setItem(i, 0, new QStandardItem(QString("%1").arg(i+1)));
callstack_model->setItem(i, 1, new QStandardItem(QString("0x%1").arg(entry.addr, 8, 16, QLatin1Char('0'))));
callstack_model->setItem(i, 2, new QStandardItem(QString::fromStdString(entry.name)));
}
*/
}

View file

@ -127,27 +127,25 @@
<ClCompile Include="..\..\externals\qhexedit\qhexedit.cpp" /> <ClCompile Include="..\..\externals\qhexedit\qhexedit.cpp" />
<ClCompile Include="..\..\externals\qhexedit\qhexedit_p.cpp" /> <ClCompile Include="..\..\externals\qhexedit\qhexedit_p.cpp" />
<ClCompile Include="..\..\externals\qhexedit\xbytearray.cpp" /> <ClCompile Include="..\..\externals\qhexedit\xbytearray.cpp" />
<ClCompile Include="bootmanager.cpp" />
<ClCompile Include="callstack.cpp" />
<ClCompile Include="config\controller_config.cpp" /> <ClCompile Include="config\controller_config.cpp" />
<ClCompile Include="config\controller_config_util.cpp" /> <ClCompile Include="config\controller_config_util.cpp" />
<ClCompile Include="cpu_regs.cpp" /> <ClCompile Include="debugger\callstack.cpp" />
<ClCompile Include="disasm.cpp" /> <ClCompile Include="debugger\registers.cpp" />
<ClCompile Include="debugger\disassembler.cpp" />
<ClCompile Include="debugger\ramview.cpp" />
<ClCompile Include="bootmanager.cpp" />
<ClCompile Include="hotkeys.cpp" /> <ClCompile Include="hotkeys.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="ramview.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MOC Include="..\..\externals\qhexedit\commands.h" /> <MOC Include="..\..\externals\qhexedit\commands.h" />
<MOC Include="..\..\externals\qhexedit\qhexedit.h" /> <MOC Include="..\..\externals\qhexedit\qhexedit.h" />
<MOC Include="..\..\externals\qhexedit\qhexedit_p.h" /> <MOC Include="..\..\externals\qhexedit\qhexedit_p.h" />
<MOC Include="..\..\externals\qhexedit\xbytearray.h" /> <MOC Include="..\..\externals\qhexedit\xbytearray.h" />
<MOC Include="config\controller_config.hxx" /> <MOC Include="debugger\callstack.hxx" />
<MOC Include="config\controller_config_util.hxx" /> <MOC Include="debugger\registers.hxx" />
<MOC Include="callstack.hxx" /> <MOC Include="debugger\disassembler.hxx" />
<MOC Include="cpu_regs.hxx" /> <MOC Include="debugger\ramview.hxx" />
<MOC Include="disasm.hxx" />
<MOC Include="ramview.hxx" />
<MOC Include="bootmanager.hxx" /> <MOC Include="bootmanager.hxx" />
<MOC Include="hotkeys.hxx" /> <MOC Include="hotkeys.hxx" />
<MOC Include="main.hxx" /> <MOC Include="main.hxx" />
@ -164,25 +162,16 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="callstack.hxx" />
<ClInclude Include="config\controller_config.hxx" /> <ClInclude Include="config\controller_config.hxx" />
<ClInclude Include="config\controller_config_util.hxx" /> <ClInclude Include="config\controller_config_util.hxx" />
<ClInclude Include="cpu_regs.hxx" />
<ClInclude Include="disasm.hxx" />
<ClInclude Include="ramview.hxx" />
<ClInclude Include="ui_callstack.h" />
<ClInclude Include="ui_controller_config.h" /> <ClInclude Include="ui_controller_config.h" />
<ClInclude Include="ui_cpu_regs.h" />
<ClInclude Include="ui_disasm.h" />
<ClInclude Include="ui_hotkeys.h" />
<ClInclude Include="ui_main.h" />
<ClInclude Include="version.h" /> <ClInclude Include="version.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<UIC Include="callstack.ui" />
<UIC Include="config\controller_config.ui" /> <UIC Include="config\controller_config.ui" />
<UIC Include="cpu_regs.ui" /> <UIC Include="debugger\callstack.ui" />
<UIC Include="disasm.ui" /> <UIC Include="debugger\registers.ui" />
<UIC Include="debugger\disassembler.ui" />
<UIC Include="hotkeys.ui" /> <UIC Include="hotkeys.ui" />
<UIC Include="main.ui" /> <UIC Include="main.ui" />
</ItemGroup> </ItemGroup>

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="debugger">
<UniqueIdentifier>{1b8f77c1-61e8-4a9f-95f8-8d1c53015ad8}</UniqueIdentifier>
</Filter>
<Filter Include="qhexedit"> <Filter Include="qhexedit">
<UniqueIdentifier>{dede739c-939b-4147-9e72-4a326b97d237}</UniqueIdentifier> <UniqueIdentifier>{dede739c-939b-4147-9e72-4a326b97d237}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="config"> <Filter Include="config">
<UniqueIdentifier>{80178741-d3ab-4031-892c-ec58490ea8bf}</UniqueIdentifier> <UniqueIdentifier>{80178741-d3ab-4031-892c-ec58490ea8bf}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="debugger">
<UniqueIdentifier>{9495d0e7-87d6-4fe1-92f1-cfa1bbec7025}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\externals\qhexedit\commands.cpp"> <ClCompile Include="..\..\externals\qhexedit\commands.cpp">
@ -33,16 +33,16 @@
<ClCompile Include="config\controller_config_util.cpp"> <ClCompile Include="config\controller_config_util.cpp">
<Filter>config</Filter> <Filter>config</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="cpu_regs.cpp"> <ClCompile Include="debugger\callstack.cpp">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="disasm.cpp"> <ClCompile Include="debugger\ramview.cpp">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ramview.cpp"> <ClCompile Include="debugger\disassembler.cpp">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="callstack.cpp"> <ClCompile Include="debugger\registers.cpp">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
@ -59,12 +59,23 @@
<MOC Include="..\..\externals\qhexedit\qhexedit.h"> <MOC Include="..\..\externals\qhexedit\qhexedit.h">
<Filter>qhexedit</Filter> <Filter>qhexedit</Filter>
</MOC> </MOC>
<MOC Include="bootmanager.hxx" />
<MOC Include="hotkeys.hxx" />
<MOC Include="main.hxx" />
<MOC Include="debugger\callstack.hxx">
<Filter>debugger</Filter>
</MOC>
<MOC Include="debugger\ramview.hxx">
<Filter>debugger</Filter>
</MOC>
<MOC Include="debugger\disassembler.hxx">
<Filter>debugger</Filter>
</MOC>
<MOC Include="debugger\registers.hxx">
<Filter>debugger</Filter>
</MOC>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="hotkeys.hxx" />
<ClInclude Include="ui_hotkeys.h" />
<ClInclude Include="main.hxx" />
<ClInclude Include="ui_main.h" />
<ClInclude Include="version.h" /> <ClInclude Include="version.h" />
<ClInclude Include="config\controller_config.hxx"> <ClInclude Include="config\controller_config.hxx">
<Filter>config</Filter> <Filter>config</Filter>
@ -72,27 +83,6 @@
<ClInclude Include="config\controller_config_util.hxx"> <ClInclude Include="config\controller_config_util.hxx">
<Filter>config</Filter> <Filter>config</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="cpu_regs.hxx">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="disasm.hxx">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="ramview.hxx">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="ui_callstack.h">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="ui_cpu_regs.h">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="ui_disasm.h">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="callstack.hxx">
<Filter>debugger</Filter>
</ClInclude>
<ClInclude Include="ui_controller_config.h"> <ClInclude Include="ui_controller_config.h">
<Filter>config</Filter> <Filter>config</Filter>
</ClInclude> </ClInclude>
@ -103,13 +93,13 @@
<UIC Include="config\controller_config.ui"> <UIC Include="config\controller_config.ui">
<Filter>config</Filter> <Filter>config</Filter>
</UIC> </UIC>
<UIC Include="callstack.ui"> <UIC Include="debugger\callstack.ui">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</UIC> </UIC>
<UIC Include="cpu_regs.ui"> <UIC Include="debugger\disassembler.ui">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</UIC> </UIC>
<UIC Include="disasm.ui"> <UIC Include="debugger\registers.ui">
<Filter>debugger</Filter> <Filter>debugger</Filter>
</UIC> </UIC>
</ItemGroup> </ItemGroup>

View file

@ -0,0 +1,66 @@
#include <QStandardItemModel>
#include "callstack.hxx"
#include "core/core.h"
#include "core/arm/arm_interface.h"
#include "core/mem_map.h"
#include "common/symbols.h"
#include "core/arm/disassembler/arm_disasm.h"
CallstackWidget::CallstackWidget(QWidget* parent): QDockWidget(parent)
{
ui.setupUi(this);
callstack_model = new QStandardItemModel(this);
callstack_model->setColumnCount(4);
callstack_model->setHeaderData(0, Qt::Horizontal, "Stack pointer");
callstack_model->setHeaderData(2, Qt::Horizontal, "Return address");
callstack_model->setHeaderData(1, Qt::Horizontal, "Call address");
callstack_model->setHeaderData(3, Qt::Horizontal, "Function");
ui.treeView->setModel(callstack_model);
}
void CallstackWidget::OnCPUStepped()
{
ARM_Disasm* disasm = new ARM_Disasm();
ARM_Interface* app_core = Core::g_app_core;
u32 sp = app_core->GetReg(13); //stack pointer
u32 addr, ret_addr, call_addr, func_addr;
int counter = 0;
for (int addr = 0x10000000; addr >= sp; addr -= 4)
{
ret_addr = Memory::Read32(addr);
call_addr = ret_addr - 4; //get call address???
/* TODO (mattvail) clean me, move to debugger interface */
u32 insn = Memory::Read32(call_addr);
if (disasm->decode(insn) == OP_BL)
{
std::string name;
// ripped from disasm
uint8_t cond = (insn >> 28) & 0xf;
uint32_t i_offset = insn & 0xffffff;
// Sign-extend the 24-bit offset
if ((i_offset >> 23) & 1)
i_offset |= 0xff000000;
// Pre-compute the left-shift and the prefetch offset
i_offset <<= 2;
i_offset += 8;
func_addr = call_addr + i_offset;
callstack_model->setItem(counter, 0, new QStandardItem(QString("0x%1").arg(addr, 8, 16, QLatin1Char('0'))));
callstack_model->setItem(counter, 1, new QStandardItem(QString("0x%1").arg(ret_addr, 8, 16, QLatin1Char('0'))));
callstack_model->setItem(counter, 2, new QStandardItem(QString("0x%1").arg(call_addr, 8, 16, QLatin1Char('0'))));
name = Symbols::HasSymbol(func_addr) ? Symbols::GetSymbol(func_addr).name : "unknown";
callstack_model->setItem(counter, 3, new QStandardItem(QString("%1_%2").arg(QString::fromStdString(name))
.arg(QString("0x%1").arg(func_addr, 8, 16, QLatin1Char('0')))));
counter++;
}
}
}

View file

@ -1,15 +1,14 @@
#include <QDockWidget> #include <QDockWidget>
#include "ui_callstack.h" #include "../ui_callstack.h"
#include "common/platform.h"
class QStandardItemModel; class QStandardItemModel;
class GCallstackView : public QDockWidget class CallstackWidget : public QDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
GCallstackView(QWidget* parent = 0); CallstackWidget(QWidget* parent = 0);
public slots: public slots:
void OnCPUStepped(); void OnCPUStepped();

View file

@ -1,9 +1,9 @@
#include <QtGui> #include <QtGui>
#include "ui_disasm.h"
#include "disasm.hxx"
#include "bootmanager.hxx" #include "disassembler.hxx"
#include "hotkeys.hxx"
#include "../bootmanager.hxx"
#include "../hotkeys.hxx"
#include "common/common.h" #include "common/common.h"
#include "core/mem_map.h" #include "core/mem_map.h"
@ -14,7 +14,7 @@
#include "core/arm/interpreter/armdefs.h" #include "core/arm/interpreter/armdefs.h"
#include "core/arm/disassembler/arm_disasm.h" #include "core/arm/disassembler/arm_disasm.h"
GDisAsmView::GDisAsmView(QWidget* parent, EmuThread& emu_thread) : QDockWidget(parent), base_addr(0), emu_thread(emu_thread) DisassemblerWidget::DisassemblerWidget(QWidget* parent, EmuThread& emu_thread) : QDockWidget(parent), base_addr(0), emu_thread(emu_thread)
{ {
disasm_ui.setupUi(this); disasm_ui.setupUi(this);
@ -23,7 +23,7 @@ GDisAsmView::GDisAsmView(QWidget* parent, EmuThread& emu_thread) : QDockWidget(p
model = new QStandardItemModel(this); model = new QStandardItemModel(this);
model->setColumnCount(3); model->setColumnCount(3);
disasm_ui.treeView->setModel(model); disasm_ui.treeView->setModel(model);
disasm_ui.tableView->setModel(model);
RegisterHotkey("Disassembler", "Start/Stop", QKeySequence(Qt::Key_F5), Qt::ApplicationShortcut); RegisterHotkey("Disassembler", "Start/Stop", QKeySequence(Qt::Key_F5), Qt::ApplicationShortcut);
RegisterHotkey("Disassembler", "Step", QKeySequence(Qt::Key_F10), Qt::ApplicationShortcut); RegisterHotkey("Disassembler", "Step", QKeySequence(Qt::Key_F10), Qt::ApplicationShortcut);
RegisterHotkey("Disassembler", "Step into", QKeySequence(Qt::Key_F11), Qt::ApplicationShortcut); RegisterHotkey("Disassembler", "Step into", QKeySequence(Qt::Key_F11), Qt::ApplicationShortcut);
@ -40,7 +40,7 @@ GDisAsmView::GDisAsmView(QWidget* parent, EmuThread& emu_thread) : QDockWidget(p
connect(GetHotkey("Disassembler", "Set Breakpoint", this), SIGNAL(activated()), this, SLOT(OnSetBreakpoint())); connect(GetHotkey("Disassembler", "Set Breakpoint", this), SIGNAL(activated()), this, SLOT(OnSetBreakpoint()));
} }
void GDisAsmView::Init() void DisassemblerWidget::Init()
{ {
ARM_Disasm* disasm = new ARM_Disasm(); ARM_Disasm* disasm = new ARM_Disasm();
@ -64,13 +64,20 @@ void GDisAsmView::Init()
} }
disasm_ui.treeView->resizeColumnToContents(0); disasm_ui.treeView->resizeColumnToContents(0);
disasm_ui.treeView->resizeColumnToContents(1); disasm_ui.treeView->resizeColumnToContents(1);
disasm_ui.treeView->resizeColumnToContents(2);
disasm_ui.tableView->resizeColumnToContents(0);
disasm_ui.tableView->resizeColumnToContents(1);
disasm_ui.tableView->resizeColumnToContents(2);
QModelIndex model_index = model->index(0, 0); QModelIndex model_index = model->index(0, 0);
disasm_ui.treeView->scrollTo(model_index); disasm_ui.treeView->scrollTo(model_index);
disasm_ui.treeView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); disasm_ui.treeView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
disasm_ui.tableView->scrollTo(model_index);
disasm_ui.tableView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
} }
void GDisAsmView::OnSetBreakpoint() void DisassemblerWidget::OnSetBreakpoint()
{ {
int selected_row = SelectedRow(); int selected_row = SelectedRow();
@ -92,33 +99,33 @@ void GDisAsmView::OnSetBreakpoint()
} }
} }
void GDisAsmView::OnContinue() void DisassemblerWidget::OnContinue()
{ {
emu_thread.SetCpuRunning(true); emu_thread.SetCpuRunning(true);
} }
void GDisAsmView::OnStep() void DisassemblerWidget::OnStep()
{ {
OnStepInto(); // change later OnStepInto(); // change later
} }
void GDisAsmView::OnStepInto() void DisassemblerWidget::OnStepInto()
{ {
emu_thread.SetCpuRunning(false); emu_thread.SetCpuRunning(false);
emu_thread.ExecStep(); emu_thread.ExecStep();
} }
void GDisAsmView::OnPause() void DisassemblerWidget::OnPause()
{ {
emu_thread.SetCpuRunning(false); emu_thread.SetCpuRunning(false);
} }
void GDisAsmView::OnToggleStartStop() void DisassemblerWidget::OnToggleStartStop()
{ {
emu_thread.SetCpuRunning(!emu_thread.IsCpuRunning()); emu_thread.SetCpuRunning(!emu_thread.IsCpuRunning());
} }
void GDisAsmView::OnCPUStepped() void DisassemblerWidget::OnCPUStepped()
{ {
ARMword next_instr = Core::g_app_core->GetPC(); ARMword next_instr = Core::g_app_core->GetPC();
@ -131,9 +138,13 @@ void GDisAsmView::OnCPUStepped()
QModelIndex model_index = model->index(index, 0); QModelIndex model_index = model->index(index, 0);
disasm_ui.treeView->scrollTo(model_index); disasm_ui.treeView->scrollTo(model_index);
disasm_ui.treeView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); disasm_ui.treeView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
disasm_ui.tableView->scrollTo(model_index);
disasm_ui.tableView->selectionModel()->setCurrentIndex(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
disasm_ui.tableView->selectionModel()->select(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
} }
int GDisAsmView::SelectedRow() int DisassemblerWidget::SelectedRow()
{ {
QModelIndex index = disasm_ui.treeView->selectionModel()->currentIndex(); QModelIndex index = disasm_ui.treeView->selectionModel()->currentIndex();
if (!index.isValid()) if (!index.isValid())
@ -141,3 +152,10 @@ int GDisAsmView::SelectedRow()
return model->itemFromIndex(disasm_ui.treeView->selectionModel()->currentIndex())->row(); return model->itemFromIndex(disasm_ui.treeView->selectionModel()->currentIndex())->row();
} }
/*
void DisassemblerWidget::paintEvent()
{
QPainter painter(this);
painter.drawRect(10, 10, 50, 50);
}
*/

View file

@ -1,5 +1,5 @@
#include <QDockWidget> #include <QDockWidget>
#include "ui_disasm.h" #include "../ui_disassembler.h"
#include "common/common.h" #include "common/common.h"
#include "common/break_points.h" #include "common/break_points.h"
@ -8,12 +8,12 @@ class QAction;
class QStandardItemModel; class QStandardItemModel;
class EmuThread; class EmuThread;
class GDisAsmView : public QDockWidget class DisassemblerWidget : public QDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
GDisAsmView(QWidget* parent, EmuThread& emu_thread); DisassemblerWidget(QWidget* parent, EmuThread& emu_thread);
void Init(); void Init();

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DockWidget</class>
<widget class="QDockWidget" name="DockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>430</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
<string>Disassembly</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="button_step">
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_pause">
<property name="text">
<string>Pause</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_continue">
<property name="text">
<string>Continue</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Step Into</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_breakpoint">
<property name="text">
<string>Set Breakpoint</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="treeView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="indentation">
<number>20</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QTableView" name="tableView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,9 +1,9 @@
#include "cpu_regs.hxx" #include "registers.hxx"
#include "core/core.h" #include "core/core.h"
#include "core/arm/interpreter/armdefs.h" #include "core/arm/arm_interface.h"
GARM11RegsView::GARM11RegsView(QWidget* parent) : QDockWidget(parent) RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent)
{ {
cpu_regs_ui.setupUi(this); cpu_regs_ui.setupUi(this);
@ -37,7 +37,7 @@ GARM11RegsView::GARM11RegsView(QWidget* parent) : QDockWidget(parent)
CSPR->addChild(new QTreeWidgetItem(QStringList("N"))); CSPR->addChild(new QTreeWidgetItem(QStringList("N")));
} }
void GARM11RegsView::OnCPUStepped() void RegistersWidget::OnCPUStepped()
{ {
ARM_Interface* app_core = Core::g_app_core; ARM_Interface* app_core = Core::g_app_core;

View file

@ -1,18 +1,16 @@
#include "ui_cpu_regs.h" #include "../ui_registers.h"
#include <QDockWidget> #include <QDockWidget>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
//#include "ui_gekko_regs.h"
class QTreeWidget; class QTreeWidget;
class GARM11RegsView : public QDockWidget class RegistersWidget : public QDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
GARM11RegsView(QWidget* parent = NULL); RegistersWidget(QWidget* parent = NULL);
public slots: public slots:
void OnCPUStepped(); void OnCPUStepped();

View file

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DockWidget</class>
<widget class="QDockWidget" name="DockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>430</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
<string>Disassembly</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="button_step">
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_pause">
<property name="text">
<string>Pause</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_continue">
<property name="text">
<string>Continue</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Step Into</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_breakpoint">
<property name="text">
<string>Set Breakpoint</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="treeView">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="indentation">
<number>20</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -15,10 +15,10 @@
#include "hotkeys.hxx" #include "hotkeys.hxx"
//debugger //debugger
#include "disasm.hxx" #include "debugger/disassembler.hxx"
#include "cpu_regs.hxx" #include "debugger/registers.hxx"
#include "callstack.hxx" #include "debugger/callstack.hxx"
#include "ramview.hxx" #include "debugger/ramview.hxx"
#include "core/system.h" #include "core/system.h"
#include "core/loader.h" #include "core/loader.h"
@ -36,17 +36,22 @@ GMainWindow::GMainWindow()
ui.horizontalLayout->addWidget(render_window); ui.horizontalLayout->addWidget(render_window);
//render_window->hide(); //render_window->hide();
disasm = new GDisAsmView(this, render_window->GetEmuThread()); disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread());
addDockWidget(Qt::BottomDockWidgetArea, disasm); addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
disasm->hide(); disasmWidget->hide();
arm_regs = new GARM11RegsView(this); registersWidget = new RegistersWidget(this);
addDockWidget(Qt::RightDockWidgetArea, arm_regs); addDockWidget(Qt::RightDockWidgetArea, registersWidget);
arm_regs->hide(); registersWidget->hide();
callstackWidget = new CallstackWidget(this);
addDockWidget(Qt::RightDockWidgetArea, callstackWidget);
callstackWidget->hide();
QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
debug_menu->addAction(disasm->toggleViewAction()); debug_menu->addAction(disasmWidget->toggleViewAction());
debug_menu->addAction(arm_regs->toggleViewAction()); debug_menu->addAction(registersWidget->toggleViewAction());
debug_menu->addAction(callstackWidget->toggleViewAction());
// Set default UI state // Set default UI state
// geometry: 55% of the window contents are in the upper screen half, 45% in the lower half // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
@ -78,8 +83,9 @@ GMainWindow::GMainWindow()
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog())); connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), disasm, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection); connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), disasmWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), arm_regs, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection); connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), registersWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
// Setup hotkeys // Setup hotkeys
RegisterHotkey("Main Window", "Load Image", QKeySequence::Open); RegisterHotkey("Main Window", "Load Image", QKeySequence::Open);
@ -124,8 +130,9 @@ void GMainWindow::BootGame(const char* filename)
ERROR_LOG(BOOT, "Failed to load ROM: %s", error_str.c_str()); ERROR_LOG(BOOT, "Failed to load ROM: %s", error_str.c_str());
} }
disasm->Init(); disasmWidget->Init();
arm_regs->OnCPUStepped(); registersWidget->OnCPUStepped();
callstackWidget->OnCPUStepped();
render_window->GetEmuThread().start(); render_window->GetEmuThread().start();
} }

View file

@ -7,8 +7,9 @@
class GImageInfo; class GImageInfo;
class GRenderWindow; class GRenderWindow;
class GDisAsmView; class DisassemblerWidget;
class GARM11RegsView; class RegistersWidget;
class CallstackWidget;
class GMainWindow : public QMainWindow class GMainWindow : public QMainWindow
{ {
@ -44,8 +45,10 @@ private:
Ui::MainWindow ui; Ui::MainWindow ui;
GRenderWindow* render_window; GRenderWindow* render_window;
GDisAsmView* disasm;
GARM11RegsView* arm_regs; DisassemblerWidget* disasmWidget;
RegistersWidget* registersWidget;
CallstackWidget* callstackWidget;
}; };
#endif // _CITRA_QT_MAIN_HXX_ #endif // _CITRA_QT_MAIN_HXX_

View file

@ -1,13 +1,13 @@
/******************************************************************************** /********************************************************************************
** Form generated from reading UI file 'disasm.ui' ** Form generated from reading UI file 'disassembler.ui'
** **
** Created by: Qt User Interface Compiler version 4.8.5 ** Created by: Qt User Interface Compiler version 4.8.5
** **
** WARNING! All changes made in this file will be lost when recompiling UI file! ** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/ ********************************************************************************/
#ifndef UI_DISASM_H #ifndef UI_DISASSEMBLER_H
#define UI_DISASM_H #define UI_DISASSEMBLER_H
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtGui/QAction> #include <QtGui/QAction>
@ -17,6 +17,7 @@
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView> #include <QtGui/QHeaderView>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
#include <QtGui/QTableView>
#include <QtGui/QTreeView> #include <QtGui/QTreeView>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QWidget> #include <QtGui/QWidget>
@ -35,6 +36,7 @@ public:
QPushButton *pushButton; QPushButton *pushButton;
QPushButton *button_breakpoint; QPushButton *button_breakpoint;
QTreeView *treeView; QTreeView *treeView;
QTableView *tableView;
void setupUi(QDockWidget *DockWidget) void setupUi(QDockWidget *DockWidget)
{ {
@ -84,6 +86,12 @@ public:
verticalLayout->addWidget(treeView); verticalLayout->addWidget(treeView);
tableView = new QTableView(dockWidgetContents);
tableView->setObjectName(QString::fromUtf8("tableView"));
tableView->setAlternatingRowColors(true);
verticalLayout->addWidget(tableView);
DockWidget->setWidget(dockWidgetContents); DockWidget->setWidget(dockWidgetContents);
retranslateUi(DockWidget); retranslateUi(DockWidget);
@ -109,4 +117,4 @@ namespace Ui {
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // UI_DISASM_H #endif // UI_DISASSEMBLER_H

View file

@ -1,13 +1,13 @@
/******************************************************************************** /********************************************************************************
** Form generated from reading UI file 'cpu_regs.ui' ** Form generated from reading UI file 'registers.ui'
** **
** Created by: Qt User Interface Compiler version 4.8.5 ** Created by: Qt User Interface Compiler version 4.8.5
** **
** WARNING! All changes made in this file will be lost when recompiling UI file! ** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/ ********************************************************************************/
#ifndef UI_CPU_REGS_H #ifndef UI_REGISTERS_H
#define UI_CPU_REGS_H #define UI_REGISTERS_H
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtGui/QAction> #include <QtGui/QAction>
@ -66,4 +66,4 @@ namespace Ui {
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // UI_CPU_REGS_H #endif // UI_REGISTERS_H