cutter/src/common/Decompiler.h

57 lines
1.2 KiB
C
Raw Normal View History

#ifndef DECOMPILER_H
#define DECOMPILER_H
#include "CutterCommon.h"
#include "R2Task.h"
2020-10-28 12:28:04 +00:00
#include <rz_util/rz_annotated_code.h>
#include <QString>
#include <QObject>
/**
* Implements a decompiler that can be registered using CutterCore::registerDecompiler()
*/
class CUTTER_EXPORT Decompiler: public QObject
{
Q_OBJECT
private:
const QString id;
const QString name;
public:
Decompiler(const QString &id, const QString &name, QObject *parent = nullptr);
virtual ~Decompiler() = default;
2020-10-28 12:28:04 +00:00
static RzAnnotatedCode *makeWarning(QString warningMessage);
QString getId() const { return id; }
QString getName() const { return name; }
virtual bool isRunning() { return false; }
virtual bool isCancelable() { return false; }
virtual void decompileAt(RVA addr) =0;
virtual void cancel() {}
signals:
2020-10-28 12:28:04 +00:00
void finished(RzAnnotatedCode *codeDecompiled);
};
class R2DecDecompiler: public Decompiler
{
Q_OBJECT
private:
R2Task *task;
public:
explicit R2DecDecompiler(QObject *parent = nullptr);
void decompileAt(RVA addr) override;
bool isRunning() override { return task != nullptr; }
static bool isAvailable();
};
#endif //DECOMPILER_H