summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/debugger')
-rw-r--r--src/citra_qt/debugger/callstack.cpp85
-rw-r--r--src/citra_qt/debugger/callstack.h28
-rw-r--r--src/citra_qt/debugger/callstack.ui39
3 files changed, 0 insertions, 152 deletions
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
deleted file mode 100644
index 08d2e7a22..000000000
--- a/src/citra_qt/debugger/callstack.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <QStandardItemModel>
6#include "citra_qt/debugger/callstack.h"
7#include "common/common_types.h"
8#include "common/symbols.h"
9#include "core/arm/arm_interface.h"
10#include "core/arm/disassembler/arm_disasm.h"
11#include "core/core.h"
12#include "core/memory.h"
13
14CallstackWidget::CallstackWidget(QWidget* parent) : QDockWidget(parent) {
15 ui.setupUi(this);
16
17 callstack_model = new QStandardItemModel(this);
18 callstack_model->setColumnCount(4);
19 callstack_model->setHeaderData(0, Qt::Horizontal, "Stack Pointer");
20 callstack_model->setHeaderData(2, Qt::Horizontal, "Return Address");
21 callstack_model->setHeaderData(1, Qt::Horizontal, "Call Address");
22 callstack_model->setHeaderData(3, Qt::Horizontal, "Function");
23 ui.treeView->setModel(callstack_model);
24}
25
26void CallstackWidget::OnDebugModeEntered() {
27 // Stack pointer
28 const u32 sp = Core::CPU().GetReg(13);
29
30 Clear();
31
32 int counter = 0;
33 for (u32 addr = 0x10000000; addr >= sp; addr -= 4) {
34 if (!Memory::IsValidVirtualAddress(addr))
35 break;
36
37 const u32 ret_addr = Memory::Read32(addr);
38 const u32 call_addr = ret_addr - 4; // get call address???
39
40 if (!Memory::IsValidVirtualAddress(call_addr))
41 break;
42
43 /* TODO (mattvail) clean me, move to debugger interface */
44 u32 insn = Memory::Read32(call_addr);
45 if (ARM_Disasm::Decode(insn) == OP_BL) {
46 std::string name;
47 // ripped from disasm
48 u32 i_offset = insn & 0xffffff;
49 // Sign-extend the 24-bit offset
50 if ((i_offset >> 23) & 1)
51 i_offset |= 0xff000000;
52
53 // Pre-compute the left-shift and the prefetch offset
54 i_offset <<= 2;
55 i_offset += 8;
56 const u32 func_addr = call_addr + i_offset;
57
58 callstack_model->setItem(
59 counter, 0, new QStandardItem(QString("0x%1").arg(addr, 8, 16, QLatin1Char('0'))));
60 callstack_model->setItem(counter, 1, new QStandardItem(QString("0x%1").arg(
61 ret_addr, 8, 16, QLatin1Char('0'))));
62 callstack_model->setItem(counter, 2, new QStandardItem(QString("0x%1").arg(
63 call_addr, 8, 16, QLatin1Char('0'))));
64
65 name = Symbols::HasSymbol(func_addr) ? Symbols::GetSymbol(func_addr).name : "unknown";
66 callstack_model->setItem(
67 counter, 3, new QStandardItem(
68 QString("%1_%2")
69 .arg(QString::fromStdString(name))
70 .arg(QString("0x%1").arg(func_addr, 8, 16, QLatin1Char('0')))));
71
72 counter++;
73 }
74 }
75}
76
77void CallstackWidget::OnDebugModeLeft() {}
78
79void CallstackWidget::Clear() {
80 for (int row = 0; row < callstack_model->rowCount(); row++) {
81 for (int column = 0; column < callstack_model->columnCount(); column++) {
82 callstack_model->setItem(row, column, new QStandardItem());
83 }
84 }
85}
diff --git a/src/citra_qt/debugger/callstack.h b/src/citra_qt/debugger/callstack.h
deleted file mode 100644
index f04ab9c7e..000000000
--- a/src/citra_qt/debugger/callstack.h
+++ /dev/null
@@ -1,28 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <QDockWidget>
8#include "ui_callstack.h"
9
10class QStandardItemModel;
11
12class CallstackWidget : public QDockWidget {
13 Q_OBJECT
14
15public:
16 explicit CallstackWidget(QWidget* parent = nullptr);
17
18public slots:
19 void OnDebugModeEntered();
20 void OnDebugModeLeft();
21
22private:
23 Ui::CallStack ui;
24 QStandardItemModel* callstack_model;
25
26 /// Clears the callstack widget while keeping the column widths the same
27 void Clear();
28};
diff --git a/src/citra_qt/debugger/callstack.ui b/src/citra_qt/debugger/callstack.ui
deleted file mode 100644
index 248ea3dd7..000000000
--- a/src/citra_qt/debugger/callstack.ui
+++ /dev/null
@@ -1,39 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>CallStack</class>
4 <widget class="QDockWidget" name="CallStack">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Call Stack</string>
15 </property>
16 <widget class="QWidget" name="dockWidgetContents">
17 <layout class="QVBoxLayout" name="verticalLayout">
18 <item>
19 <widget class="QTreeView" name="treeView">
20 <property name="editTriggers">
21 <set>QAbstractItemView::NoEditTriggers</set>
22 </property>
23 <property name="alternatingRowColors">
24 <bool>true</bool>
25 </property>
26 <property name="rootIsDecorated">
27 <bool>false</bool>
28 </property>
29 <property name="itemsExpandable">
30 <bool>false</bool>
31 </property>
32 </widget>
33 </item>
34 </layout>
35 </widget>
36 </widget>
37 <resources/>
38 <connections/>
39</ui>