diff options
| author | 2017-05-07 14:44:43 -0700 | |
|---|---|---|
| committer | 2017-05-07 15:32:47 -0700 | |
| commit | 4af2a1a3d74eb5e77b59e4557c50e230d453d7d9 (patch) | |
| tree | eeecf3ec67b666805db0aaa9e91af407c7b29773 /src/citra_qt/debugger/callstack.cpp | |
| parent | citra-qt: Remove disassembler widget (diff) | |
| download | yuzu-4af2a1a3d74eb5e77b59e4557c50e230d453d7d9.tar.gz yuzu-4af2a1a3d74eb5e77b59e4557c50e230d453d7d9.tar.xz yuzu-4af2a1a3d74eb5e77b59e4557c50e230d453d7d9.zip | |
citra-qt: Remove callstack widget
Appears to be currently broken, and given the complexity of doing this
for ARM code without debugging information, should probably be left to
an external tool or library. Use the GDB stub instead.
Closes #586
Diffstat (limited to 'src/citra_qt/debugger/callstack.cpp')
| -rw-r--r-- | src/citra_qt/debugger/callstack.cpp | 85 |
1 files changed, 0 insertions, 85 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 | |||
| 14 | CallstackWidget::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 | |||
| 26 | void 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 | |||
| 77 | void CallstackWidget::OnDebugModeLeft() {} | ||
| 78 | |||
| 79 | void 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 | } | ||