mirror of https://github.com/yuzu-mirror/yuzu
UI/debugger changes
parent
958bca606e
commit
e5f09b8be6
@ -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)));
|
||||
}
|
||||
*/
|
||||
}
|
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
@ -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>
|
@ -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();
|
@ -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>
|
Loading…
Reference in New Issue