2014-07-02 15:16:36 -04:00
|
|
|
#include <QAbstractItemModel>
|
2014-03-31 22:26:50 -04:00
|
|
|
#include <QDockWidget>
|
2014-06-22 16:37:07 -04:00
|
|
|
#include "ui_disassembler.h"
|
2014-03-31 22:26:50 -04:00
|
|
|
|
2014-04-10 20:50:10 -04:00
|
|
|
#include "common/common.h"
|
|
|
|
#include "common/break_points.h"
|
2014-03-31 22:26:50 -04:00
|
|
|
|
|
|
|
class QAction;
|
|
|
|
class EmuThread;
|
|
|
|
|
2014-07-02 15:16:36 -04:00
|
|
|
class DisassemblerModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
DisassemblerModel(QObject* parent);
|
|
|
|
|
|
|
|
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
QModelIndex parent(const QModelIndex& child) const override;
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
QModelIndex IndexFromAbsoluteAddress(unsigned int address) const;
|
|
|
|
const BreakPoints& GetBreakPoints() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void ParseFromAddress(unsigned int address);
|
|
|
|
void OnSelectionChanged(const QModelIndex&);
|
|
|
|
void OnSetOrUnsetBreakpoint();
|
|
|
|
void SetNextInstruction(unsigned int address);
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned int base_address;
|
|
|
|
unsigned int code_size;
|
|
|
|
unsigned int program_counter;
|
|
|
|
|
|
|
|
QModelIndex selection;
|
|
|
|
|
|
|
|
// TODO: Make BreakPoints less crappy (i.e. const-correct) so that this needn't be mutable.
|
|
|
|
mutable BreakPoints breakpoints;
|
|
|
|
};
|
|
|
|
|
2014-04-18 18:30:53 -04:00
|
|
|
class DisassemblerWidget : public QDockWidget
|
2014-03-31 22:26:50 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-04-18 18:30:53 -04:00
|
|
|
DisassemblerWidget(QWidget* parent, EmuThread& emu_thread);
|
2014-03-31 22:26:50 -04:00
|
|
|
|
2014-04-03 21:24:07 -04:00
|
|
|
void Init();
|
|
|
|
|
2014-03-31 22:26:50 -04:00
|
|
|
public slots:
|
2014-04-03 21:24:07 -04:00
|
|
|
void OnContinue();
|
2014-03-31 22:26:50 -04:00
|
|
|
void OnStep();
|
2014-04-03 21:24:07 -04:00
|
|
|
void OnStepInto();
|
2014-03-31 22:26:50 -04:00
|
|
|
void OnPause();
|
2014-04-03 21:24:07 -04:00
|
|
|
void OnToggleStartStop();
|
2014-03-31 22:26:50 -04:00
|
|
|
|
|
|
|
void OnCPUStepped();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// returns -1 if no row is selected
|
|
|
|
int SelectedRow();
|
|
|
|
|
|
|
|
Ui::DockWidget disasm_ui;
|
|
|
|
|
2014-07-02 15:16:36 -04:00
|
|
|
DisassemblerModel* model;
|
2014-03-31 22:26:50 -04:00
|
|
|
|
2014-07-02 15:16:36 -04:00
|
|
|
u32 base_addr;
|
2014-03-31 22:26:50 -04:00
|
|
|
|
|
|
|
EmuThread& emu_thread;
|
|
|
|
};
|