2015-01-04 23:06:57 +05:30
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2015-02-04 01:15:33 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
2014-04-01 07:56:50 +05:30
|
|
|
#include <QDockWidget>
|
2014-04-11 06:20:10 +05:30
|
|
|
#include "common/break_points.h"
|
2015-05-06 12:36:12 +05:30
|
|
|
#include "common/common_types.h"
|
2016-09-20 20:51:23 +05:30
|
|
|
#include "ui_disassembler.h"
|
2014-04-01 07:56:50 +05:30
|
|
|
|
|
|
|
class QAction;
|
2015-04-29 09:31:41 +05:30
|
|
|
class EmuThread;
|
2014-04-01 07:56:50 +05:30
|
|
|
|
2016-09-18 06:08:01 +05:30
|
|
|
class DisassemblerModel : public QAbstractListModel {
|
2014-07-03 00:46:36 +05:30
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-12-11 17:52:10 +05:30
|
|
|
explicit DisassemblerModel(QObject* parent);
|
2014-07-03 00:46:36 +05:30
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2016-09-18 06:08:01 +05:30
|
|
|
class DisassemblerWidget : public QDockWidget {
|
2014-04-01 07:56:50 +05:30
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-04-29 09:31:41 +05:30
|
|
|
DisassemblerWidget(QWidget* parent, EmuThread* emu_thread);
|
2014-04-01 07:56:50 +05:30
|
|
|
|
2014-04-04 06:54:07 +05:30
|
|
|
void Init();
|
|
|
|
|
2014-04-01 07:56:50 +05:30
|
|
|
public slots:
|
2014-04-04 06:54:07 +05:30
|
|
|
void OnContinue();
|
2014-04-01 07:56:50 +05:30
|
|
|
void OnStep();
|
2014-04-04 06:54:07 +05:30
|
|
|
void OnStepInto();
|
2014-04-01 07:56:50 +05:30
|
|
|
void OnPause();
|
2014-04-04 06:54:07 +05:30
|
|
|
void OnToggleStartStop();
|
2014-04-01 07:56:50 +05:30
|
|
|
|
2015-01-07 16:44:23 +05:30
|
|
|
void OnDebugModeEntered();
|
|
|
|
void OnDebugModeLeft();
|
2014-04-01 07:56:50 +05:30
|
|
|
|
2015-05-01 05:16:50 +05:30
|
|
|
void OnEmulationStarting(EmuThread* emu_thread);
|
|
|
|
void OnEmulationStopping();
|
2015-04-29 09:31:41 +05:30
|
|
|
|
2014-04-01 07:56:50 +05:30
|
|
|
private:
|
|
|
|
// returns -1 if no row is selected
|
|
|
|
int SelectedRow();
|
|
|
|
|
|
|
|
Ui::DockWidget disasm_ui;
|
|
|
|
|
2014-07-03 00:46:36 +05:30
|
|
|
DisassemblerModel* model;
|
2014-04-01 07:56:50 +05:30
|
|
|
|
2014-07-03 00:46:36 +05:30
|
|
|
u32 base_addr;
|
2014-04-01 07:56:50 +05:30
|
|
|
|
2015-04-29 09:31:41 +05:30
|
|
|
EmuThread* emu_thread;
|
2014-04-01 07:56:50 +05:30
|
|
|
};
|