summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/debugger
diff options
context:
space:
mode:
authorMathieu Vaillancourt <vaillancourtm@gmail.com>2014-04-19 00:30:53 +0200
committerMathieu Vaillancourt <vaillancourtm@gmail.com>2014-04-19 00:34:23 +0200
commite5f09b8be65c06927164428b5d400024e2388dbc (patch)
tree0f0fd4035bcc88c0de5a47a7d3c64b4f67453897 /src/citra_qt/debugger
parentMerge branch 'hle-interface' (diff)
downloadyuzu-e5f09b8be65c06927164428b5d400024e2388dbc.tar
yuzu-e5f09b8be65c06927164428b5d400024e2388dbc.tar.gz
yuzu-e5f09b8be65c06927164428b5d400024e2388dbc.tar.bz2
yuzu-e5f09b8be65c06927164428b5d400024e2388dbc.tar.lz
yuzu-e5f09b8be65c06927164428b5d400024e2388dbc.tar.xz
yuzu-e5f09b8be65c06927164428b5d400024e2388dbc.tar.zst
yuzu-e5f09b8be65c06927164428b5d400024e2388dbc.zip
Diffstat (limited to '')
-rw-r--r--src/citra_qt/debugger/callstack.cpp66
-rw-r--r--src/citra_qt/debugger/callstack.hxx (renamed from src/citra_qt/callstack.hxx)7
-rw-r--r--src/citra_qt/debugger/callstack.ui (renamed from src/citra_qt/callstack.ui)0
-rw-r--r--src/citra_qt/debugger/disassembler.cpp (renamed from src/citra_qt/disasm.cpp)52
-rw-r--r--src/citra_qt/debugger/disassembler.hxx (renamed from src/citra_qt/disasm.hxx)6
-rw-r--r--src/citra_qt/debugger/disassembler.ui88
-rw-r--r--src/citra_qt/debugger/ramview.cpp (renamed from src/citra_qt/ramview.cpp)0
-rw-r--r--src/citra_qt/debugger/ramview.hxx (renamed from src/citra_qt/ramview.hxx)0
-rw-r--r--src/citra_qt/debugger/registers.cpp (renamed from src/citra_qt/cpu_regs.cpp)8
-rw-r--r--src/citra_qt/debugger/registers.hxx (renamed from src/citra_qt/cpu_regs.hxx)8
-rw-r--r--src/citra_qt/debugger/registers.ui (renamed from src/citra_qt/cpu_regs.ui)0
11 files changed, 202 insertions, 33 deletions
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
new file mode 100644
index 000000000..f59f2d8c8
--- /dev/null
+++ b/src/citra_qt/debugger/callstack.cpp
@@ -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++;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/citra_qt/callstack.hxx b/src/citra_qt/debugger/callstack.hxx
index 4df1b96d5..3ad2af28b 100644
--- a/src/citra_qt/callstack.hxx
+++ b/src/citra_qt/debugger/callstack.hxx
@@ -1,15 +1,14 @@
#include <QDockWidget>
-#include "ui_callstack.h"
-#include "common/platform.h"
+#include "../ui_callstack.h"
class QStandardItemModel;
-class GCallstackView : public QDockWidget
+class CallstackWidget : public QDockWidget
{
Q_OBJECT
public:
- GCallstackView(QWidget* parent = 0);
+ CallstackWidget(QWidget* parent = 0);
public slots:
void OnCPUStepped();
diff --git a/src/citra_qt/callstack.ui b/src/citra_qt/debugger/callstack.ui
index b3c4db632..b3c4db632 100644
--- a/src/citra_qt/callstack.ui
+++ b/src/citra_qt/debugger/callstack.ui
diff --git a/src/citra_qt/disasm.cpp b/src/citra_qt/debugger/disassembler.cpp
index 5f3a6058a..cc4cb13fa 100644
--- a/src/citra_qt/disasm.cpp
+++ b/src/citra_qt/debugger/disassembler.cpp
@@ -1,9 +1,9 @@
#include <QtGui>
-#include "ui_disasm.h"
-#include "disasm.hxx"
-#include "bootmanager.hxx"
-#include "hotkeys.hxx"
+#include "disassembler.hxx"
+
+#include "../bootmanager.hxx"
+#include "../hotkeys.hxx"
#include "common/common.h"
#include "core/mem_map.h"
@@ -14,7 +14,7 @@
#include "core/arm/interpreter/armdefs.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);
@@ -23,7 +23,7 @@ GDisAsmView::GDisAsmView(QWidget* parent, EmuThread& emu_thread) : QDockWidget(p
model = new QStandardItemModel(this);
model->setColumnCount(3);
disasm_ui.treeView->setModel(model);
-
+ disasm_ui.tableView->setModel(model);
RegisterHotkey("Disassembler", "Start/Stop", QKeySequence(Qt::Key_F5), Qt::ApplicationShortcut);
RegisterHotkey("Disassembler", "Step", QKeySequence(Qt::Key_F10), 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()));
}
-void GDisAsmView::Init()
+void DisassemblerWidget::Init()
{
ARM_Disasm* disasm = new ARM_Disasm();
@@ -64,13 +64,20 @@ void GDisAsmView::Init()
}
disasm_ui.treeView->resizeColumnToContents(0);
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);
disasm_ui.treeView->scrollTo(model_index);
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();
@@ -92,33 +99,33 @@ void GDisAsmView::OnSetBreakpoint()
}
}
-void GDisAsmView::OnContinue()
+void DisassemblerWidget::OnContinue()
{
emu_thread.SetCpuRunning(true);
}
-void GDisAsmView::OnStep()
+void DisassemblerWidget::OnStep()
{
OnStepInto(); // change later
}
-void GDisAsmView::OnStepInto()
+void DisassemblerWidget::OnStepInto()
{
emu_thread.SetCpuRunning(false);
emu_thread.ExecStep();
}
-void GDisAsmView::OnPause()
+void DisassemblerWidget::OnPause()
{
emu_thread.SetCpuRunning(false);
}
-void GDisAsmView::OnToggleStartStop()
+void DisassemblerWidget::OnToggleStartStop()
{
emu_thread.SetCpuRunning(!emu_thread.IsCpuRunning());
}
-void GDisAsmView::OnCPUStepped()
+void DisassemblerWidget::OnCPUStepped()
{
ARMword next_instr = Core::g_app_core->GetPC();
@@ -131,13 +138,24 @@ void GDisAsmView::OnCPUStepped()
QModelIndex model_index = model->index(index, 0);
disasm_ui.treeView->scrollTo(model_index);
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();
if (!index.isValid())
return -1;
return model->itemFromIndex(disasm_ui.treeView->selectionModel()->currentIndex())->row();
-} \ No newline at end of file
+}
+/*
+void DisassemblerWidget::paintEvent()
+{
+ QPainter painter(this);
+ painter.drawRect(10, 10, 50, 50);
+}
+*/ \ No newline at end of file
diff --git a/src/citra_qt/disasm.hxx b/src/citra_qt/debugger/disassembler.hxx
index 0c5a37cac..e5b152d20 100644
--- a/src/citra_qt/disasm.hxx
+++ b/src/citra_qt/debugger/disassembler.hxx
@@ -1,5 +1,5 @@
#include <QDockWidget>
-#include "ui_disasm.h"
+#include "../ui_disassembler.h"
#include "common/common.h"
#include "common/break_points.h"
@@ -8,12 +8,12 @@ class QAction;
class QStandardItemModel;
class EmuThread;
-class GDisAsmView : public QDockWidget
+class DisassemblerWidget : public QDockWidget
{
Q_OBJECT
public:
- GDisAsmView(QWidget* parent, EmuThread& emu_thread);
+ DisassemblerWidget(QWidget* parent, EmuThread& emu_thread);
void Init();
diff --git a/src/citra_qt/debugger/disassembler.ui b/src/citra_qt/debugger/disassembler.ui
new file mode 100644
index 000000000..e65b0aa9b
--- /dev/null
+++ b/src/citra_qt/debugger/disassembler.ui
@@ -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>
diff --git a/src/citra_qt/ramview.cpp b/src/citra_qt/debugger/ramview.cpp
index 3f899b95e..3f899b95e 100644
--- a/src/citra_qt/ramview.cpp
+++ b/src/citra_qt/debugger/ramview.cpp
diff --git a/src/citra_qt/ramview.hxx b/src/citra_qt/debugger/ramview.hxx
index 1db1546aa..1db1546aa 100644
--- a/src/citra_qt/ramview.hxx
+++ b/src/citra_qt/debugger/ramview.hxx
diff --git a/src/citra_qt/cpu_regs.cpp b/src/citra_qt/debugger/registers.cpp
index 7e54e18b0..96ceed480 100644
--- a/src/citra_qt/cpu_regs.cpp
+++ b/src/citra_qt/debugger/registers.cpp
@@ -1,9 +1,9 @@
-#include "cpu_regs.hxx"
+#include "registers.hxx"
#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);
@@ -37,7 +37,7 @@ GARM11RegsView::GARM11RegsView(QWidget* parent) : QDockWidget(parent)
CSPR->addChild(new QTreeWidgetItem(QStringList("N")));
}
-void GARM11RegsView::OnCPUStepped()
+void RegistersWidget::OnCPUStepped()
{
ARM_Interface* app_core = Core::g_app_core;
diff --git a/src/citra_qt/cpu_regs.hxx b/src/citra_qt/debugger/registers.hxx
index 27c194bde..318d95820 100644
--- a/src/citra_qt/cpu_regs.hxx
+++ b/src/citra_qt/debugger/registers.hxx
@@ -1,18 +1,16 @@
-#include "ui_cpu_regs.h"
+#include "../ui_registers.h"
#include <QDockWidget>
#include <QTreeWidgetItem>
-//#include "ui_gekko_regs.h"
-
class QTreeWidget;
-class GARM11RegsView : public QDockWidget
+class RegistersWidget : public QDockWidget
{
Q_OBJECT
public:
- GARM11RegsView(QWidget* parent = NULL);
+ RegistersWidget(QWidget* parent = NULL);
public slots:
void OnCPUStepped();
diff --git a/src/citra_qt/cpu_regs.ui b/src/citra_qt/debugger/registers.ui
index 6537c9cd6..6537c9cd6 100644
--- a/src/citra_qt/cpu_regs.ui
+++ b/src/citra_qt/debugger/registers.ui