cutter/src/Cutter.h

794 lines
21 KiB
C
Raw Normal View History

#ifndef CUTTER_H
2017-09-25 12:55:41 +00:00
#define CUTTER_H
#include "r_core.h"
2017-10-03 12:42:31 +00:00
// Workaround for compile errors on Windows
2017-03-30 03:07:34 +00:00
#ifdef _WIN32
#undef min
2017-10-03 12:42:31 +00:00
#undef max
2017-03-30 03:07:34 +00:00
#endif //_WIN32
#include <QMap>
#include <QDebug>
#include <QObject>
#include <QStringList>
#include <QMessageBox>
#include <QJsonDocument>
#include <QErrorMessage>
2017-09-25 17:51:49 +00:00
#define CutterRListForeach(list, it, type, x) \
if (list) for (it = list->head; it && ((x=static_cast<type*>(it->data))); it = it->n)
2019-01-31 16:45:58 +00:00
#define CutterRVectorForeach(vec, it, type) \
if ((vec) && (vec)->a) \
for (it = (type *)(vec)->a; (char *)it != (char *)(vec)->a + ((vec)->len * (vec)->elem_size); it = (type *)((char *)it + (vec)->elem_size))
2017-09-25 12:55:41 +00:00
#define APPNAME "Cutter"
#define Core() (CutterCore::getInstance())
/*!
* \brief Type to be used for all kinds of addresses/offsets in r2 address space.
*/
2017-10-03 18:38:34 +00:00
typedef ut64 RVA;
/*!
* \brief Maximum value of RVA. Do NOT use this for specifying invalid values, use RVA_INVALID instead.
*/
#define RVA_MAX UT64_MAX
/*!
* \brief Value for specifying an invalid RVA.
*/
#define RVA_INVALID RVA_MAX
2017-10-03 18:38:34 +00:00
2018-05-26 16:21:23 +00:00
class AsyncTaskManager;
class CutterCore;
#include "plugins/CutterPlugin.h"
2018-05-26 16:21:23 +00:00
2017-04-09 18:42:45 +00:00
class RCoreLocked
{
2017-04-09 19:55:06 +00:00
RCore *core;
2017-04-09 18:42:45 +00:00
public:
2017-04-09 19:55:06 +00:00
explicit RCoreLocked(RCore *core);
RCoreLocked(const RCoreLocked &) = delete;
RCoreLocked &operator=(const RCoreLocked &) = delete;
RCoreLocked(RCoreLocked &&);
~RCoreLocked();
2017-04-09 19:55:06 +00:00
operator RCore *() const;
RCore *operator->() const;
};
inline QString RAddressString(RVA addr)
{
return QString::asprintf("%#010llx", addr);
}
inline QString RSizeString(RVA size)
{
return QString::asprintf("%lld", size);
}
inline QString RHexString(RVA size)
{
return QString::asprintf("%#llx", size);
}
2018-03-21 20:32:32 +00:00
struct FunctionDescription {
RVA offset;
RVA size;
RVA nargs;
RVA nbbs;
RVA nlocals;
RVA cc;
QString calltype;
QString name;
RVA edges;
RVA cost;
RVA calls;
RVA stackframe;
2018-03-21 20:32:32 +00:00
bool contains(RVA addr) const
{
return addr >= offset && addr < offset + size;
}
};
2018-03-21 20:32:32 +00:00
struct ImportDescription {
RVA plt;
int ordinal;
QString bind;
QString type;
QString name;
};
2018-03-21 20:32:32 +00:00
struct ExportDescription {
RVA vaddr;
RVA paddr;
RVA size;
QString type;
QString name;
QString flag_name;
};
2018-05-21 17:34:41 +00:00
struct HeaderDescription
{
RVA vaddr;
RVA paddr;
QString value;
QString name;
};
2018-05-24 15:37:37 +00:00
struct ZignatureDescription
{
QString name;
QString bytes;
RVA cc;
RVA nbbs;
RVA edges;
RVA ebbs;
RVA offset;
QStringList refs;
};
2018-03-21 20:32:32 +00:00
struct TypeDescription {
2018-03-06 17:21:48 +00:00
QString type;
int size;
QString format;
QString category;
2018-03-06 17:21:48 +00:00
};
2018-03-21 20:32:32 +00:00
struct SearchDescription {
RVA offset;
int size;
QString code;
QString data;
};
2018-03-21 20:32:32 +00:00
struct SymbolDescription {
RVA vaddr;
QString bind;
QString type;
QString name;
};
2018-03-21 20:32:32 +00:00
struct CommentDescription {
RVA offset;
QString name;
};
2018-03-21 20:32:32 +00:00
struct RelocDescription {
RVA vaddr;
RVA paddr;
QString type;
QString name;
};
2018-03-21 20:32:32 +00:00
struct StringDescription {
RVA vaddr;
QString string;
2018-02-10 17:16:16 +00:00
QString type;
QString section;
2018-02-09 14:22:45 +00:00
ut32 length;
ut32 size;
};
2018-03-21 20:32:32 +00:00
struct FlagspaceDescription {
QString name;
};
2018-03-21 20:32:32 +00:00
struct FlagDescription {
RVA offset;
RVA size;
QString name;
};
2018-03-21 20:32:32 +00:00
struct SectionDescription {
RVA vaddr;
RVA paddr;
RVA size;
RVA vsize;
QString name;
QString flags;
2018-05-05 10:11:44 +00:00
QString entropy;
};
struct SegmentDescription {
RVA vaddr;
RVA paddr;
RVA size;
RVA vsize;
QString name;
QString perm;
};
2018-03-21 20:32:32 +00:00
struct EntrypointDescription {
RVA vaddr;
RVA paddr;
RVA baddr;
RVA laddr;
RVA haddr;
QString type;
};
2018-03-21 20:32:32 +00:00
struct XrefDescription {
2017-06-07 10:56:55 +00:00
RVA from;
2017-11-27 16:05:10 +00:00
QString from_str;
2017-06-07 10:56:55 +00:00
RVA to;
2017-11-27 16:05:10 +00:00
QString to_str;
2017-06-07 10:56:55 +00:00
QString type;
};
2018-03-21 20:32:32 +00:00
struct RBinPluginDescription {
QString name;
QString description;
QString license;
QString type;
};
2018-03-21 20:32:32 +00:00
struct RIOPluginDescription {
QString name;
QString description;
QString license;
QString permissions;
};
2018-03-21 20:32:32 +00:00
struct RCorePluginDescription {
QString name;
QString description;
};
2018-03-21 20:32:32 +00:00
struct RAsmPluginDescription {
QString name;
QString architecture;
QString author;
QString version;
QString cpus;
QString description;
QString license;
};
2018-03-21 20:32:32 +00:00
struct DisassemblyLine {
RVA offset;
QString text;
};
2019-01-31 16:45:58 +00:00
struct BinClassBaseClassDescription {
QString name;
RVA offset;
};
2019-01-31 16:45:58 +00:00
struct BinClassMethodDescription {
2017-12-23 16:42:42 +00:00
QString name;
RVA addr = RVA_INVALID;
st64 vtableOffset = -1;
2017-12-23 16:42:42 +00:00
};
2019-01-31 16:45:58 +00:00
struct BinClassFieldDescription {
2017-12-23 16:42:42 +00:00
QString name;
RVA addr = RVA_INVALID;
2017-12-23 16:42:42 +00:00
};
struct BinClassDescription {
2017-12-23 16:42:42 +00:00
QString name;
RVA addr = RVA_INVALID;
RVA vtableAddr = RVA_INVALID;
ut64 index = 0;
2019-01-31 16:45:58 +00:00
QList<BinClassBaseClassDescription> baseClasses;
QList<BinClassMethodDescription> methods;
QList<BinClassFieldDescription> fields;
};
struct AnalMethodDescription {
QString name;
RVA addr;
st64 vtableOffset;
};
struct AnalBaseClassDescription {
QString id;
RVA offset;
QString className;
};
struct AnalVTableDescription {
QString id;
ut64 offset;
ut64 addr;
2017-12-23 16:42:42 +00:00
};
2018-03-21 20:32:32 +00:00
struct ResourcesDescription {
2018-02-09 13:19:36 +00:00
int name;
2018-02-04 14:32:18 +00:00
RVA vaddr;
ut64 index;
QString type;
ut64 size;
QString lang;
};
2018-03-21 20:32:32 +00:00
struct VTableDescription {
2018-02-26 22:26:18 +00:00
RVA addr;
2019-01-31 16:45:58 +00:00
QList<BinClassMethodDescription> methods;
2018-02-26 22:26:18 +00:00
};
2018-06-29 10:34:01 +00:00
struct BlockDescription {
RVA addr;
RVA size;
int flags;
int functions;
2018-07-01 12:29:01 +00:00
int inFunctions;
2018-06-29 10:34:01 +00:00
int comments;
int symbols;
int strings;
ut8 rwx;
};
struct BlockStatistics {
RVA from;
RVA to;
RVA blocksize;
QList<BlockDescription> blocks;
};
2018-06-12 08:43:14 +00:00
struct MemoryMapDescription {
RVA addrStart;
RVA addrEnd;
QString name;
QString fileName;
QString type;
QString permission;
};
struct BreakpointDescription {
RVA addr;
int size;
QString permission;
bool hw;
bool trace;
bool enabled;
};
struct ProcessDescription {
int pid;
int uid;
QString status;
QString path;
};
2018-07-19 14:35:46 +00:00
struct RegisterRefDescription {
QString reg;
QString value;
QString ref;
};
struct VariableDescription {
enum class RefType { SP, BP, Reg };
RefType refType;
QString name;
QString type;
};
Q_DECLARE_METATYPE(FunctionDescription)
Q_DECLARE_METATYPE(ImportDescription)
Q_DECLARE_METATYPE(ExportDescription)
Q_DECLARE_METATYPE(SymbolDescription)
Q_DECLARE_METATYPE(CommentDescription)
Q_DECLARE_METATYPE(RelocDescription)
Q_DECLARE_METATYPE(StringDescription)
Q_DECLARE_METATYPE(FlagspaceDescription)
Q_DECLARE_METATYPE(FlagDescription)
Q_DECLARE_METATYPE(XrefDescription)
Q_DECLARE_METATYPE(EntrypointDescription)
Q_DECLARE_METATYPE(RBinPluginDescription)
Q_DECLARE_METATYPE(RIOPluginDescription)
Q_DECLARE_METATYPE(RCorePluginDescription)
Q_DECLARE_METATYPE(RAsmPluginDescription)
2019-01-31 16:45:58 +00:00
Q_DECLARE_METATYPE(BinClassMethodDescription)
Q_DECLARE_METATYPE(BinClassFieldDescription)
Q_DECLARE_METATYPE(BinClassDescription)
Q_DECLARE_METATYPE(const BinClassDescription *)
2019-01-31 16:45:58 +00:00
Q_DECLARE_METATYPE(const BinClassMethodDescription *)
Q_DECLARE_METATYPE(const BinClassFieldDescription *)
2019-02-01 14:51:29 +00:00
Q_DECLARE_METATYPE(AnalBaseClassDescription)
Q_DECLARE_METATYPE(AnalMethodDescription)
Q_DECLARE_METATYPE(AnalVTableDescription)
2018-02-09 13:19:36 +00:00
Q_DECLARE_METATYPE(ResourcesDescription)
2018-02-26 22:26:18 +00:00
Q_DECLARE_METATYPE(VTableDescription)
2018-03-06 17:21:48 +00:00
Q_DECLARE_METATYPE(TypeDescription)
2018-05-21 17:34:41 +00:00
Q_DECLARE_METATYPE(HeaderDescription)
2018-05-24 15:37:37 +00:00
Q_DECLARE_METATYPE(ZignatureDescription)
Q_DECLARE_METATYPE(SearchDescription)
Q_DECLARE_METATYPE(SectionDescription)
Q_DECLARE_METATYPE(SegmentDescription)
2018-06-12 08:43:14 +00:00
Q_DECLARE_METATYPE(MemoryMapDescription)
Q_DECLARE_METATYPE(BreakpointDescription)
Q_DECLARE_METATYPE(ProcessDescription)
2018-07-19 14:35:46 +00:00
Q_DECLARE_METATYPE(RegisterRefDescription)
Q_DECLARE_METATYPE(VariableDescription)
2017-09-25 12:55:41 +00:00
class CutterCore: public QObject
{
Q_OBJECT
2017-10-09 18:08:35 +00:00
friend class ccClass;
public:
explicit CutterCore(QObject *parent = nullptr);
2017-09-25 12:55:41 +00:00
~CutterCore();
static CutterCore *getInstance();
2018-05-26 18:09:20 +00:00
AsyncTaskManager *getAsyncTaskManager() { return asyncTaskManager; }
RVA getOffset() const { return core_->offset; }
2018-06-20 09:24:28 +00:00
/* Core functions (commands) */
2017-10-09 18:08:35 +00:00
static QString sanitizeStringForCommand(QString s);
QString cmd(const char *str);
QString cmd(const QString &str) { return cmd(str.toUtf8().constData()); }
QString cmdRaw(const QString &str);
QJsonDocument cmdj(const char *str);
QJsonDocument cmdj(const QString &str) { return cmdj(str.toUtf8().constData()); }
QStringList cmdList(const char *str) { return cmd(str).split('\n', QString::SkipEmptyParts); }
QStringList cmdList(const QString &str) { return cmdList(str.toUtf8().constData()); }
2018-05-29 16:19:59 +00:00
QString cmdTask(const QString &str);
QJsonDocument cmdjTask(const QString &str);
void cmdEsil(const char *command);
void cmdEsil(const QString &command) { cmdEsil(command.toUtf8().constData()); }
2018-06-20 09:24:28 +00:00
QString getVersionInformation();
QJsonDocument parseJson(const char *res, const char *cmd = nullptr);
QJsonDocument parseJson(const char *res, const QString &cmd = QString())
{
return parseJson(res, cmd.isNull() ? nullptr : cmd.toLocal8Bit().constData());
}
2018-05-29 16:19:59 +00:00
2018-06-20 09:24:28 +00:00
/* Functions methods */
void renameFunction(const QString &oldName, const QString &newName);
void delFunction(RVA addr);
2017-11-27 08:22:52 +00:00
void renameFlag(QString old_name, QString new_name);
2018-06-20 09:24:28 +00:00
RAnalFunction *functionAt(ut64 addr);
QString cmdFunctionAt(QString addr);
QString cmdFunctionAt(RVA addr);
QString createFunctionAt(RVA addr, QString name);
/* Flags */
void delFlag(RVA addr);
2018-03-11 16:40:52 +00:00
void delFlag(const QString &name);
2018-06-20 09:24:28 +00:00
void addFlag(RVA offset, QString name, RVA size);
void triggerFlagsChanged();
2018-06-20 09:24:28 +00:00
/* Edition functions */
QString getInstructionBytes(RVA addr);
QString getInstructionOpcode(RVA addr);
void editInstruction(RVA addr, const QString &inst);
void nopInstruction(RVA addr);
void jmpReverse(RVA addr);
void editBytes(RVA addr, const QString &inst);
void editBytesEndian(RVA addr, const QString &bytes);
2018-08-04 18:05:56 +00:00
/* Code/Data */
void setToCode(RVA addr);
2018-11-16 21:27:07 +00:00
void setAsString(RVA addr);
2018-08-04 18:05:56 +00:00
void setToData(RVA addr, int size, int repeat = 1);
int sizeofDataMeta(RVA addr);
2018-06-20 09:24:28 +00:00
/* Comments */
void setComment(RVA addr, const QString &cmt);
void delComment(RVA addr);
void setImmediateBase(const QString &r2BaseName, RVA offset = RVA_INVALID);
2018-02-12 09:48:06 +00:00
void setCurrentBits(int bits, RVA offset = RVA_INVALID);
/* Classes */
QList<QString> getAllAnalClasses(bool sorted);
QList<AnalMethodDescription> getAnalClassMethods(const QString &cls);
QList<AnalBaseClassDescription> getAnalClassBaseClasses(const QString &cls);
QList<AnalVTableDescription> getAnalClassVTables(const QString &cls);
void createNewClass(const QString &cls);
void renameClass(const QString &oldName, const QString &newName);
void deleteClass(const QString &cls);
bool getAnalMethod(const QString &cls, const QString &meth, AnalMethodDescription *desc);
void renameAnalMethod(const QString &className, const QString &oldMethodName, const QString &newMethodName);
void setAnalMethod(const QString &cls, const AnalMethodDescription &meth);
2018-06-20 09:24:28 +00:00
/* File related methods */
2018-09-22 16:00:21 +00:00
bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = R_PERM_R,
int va = 0, bool loadbin = false, const QString &forceBinPlugin = QString());
bool tryFile(QString path, bool rw);
bool openFile(QString path, RVA mapaddr);
2018-06-20 09:24:28 +00:00
void loadScript(const QString &scriptname);
QJsonArray getOpenedFiles();
/* Seek functions */
void seek(QString thing);
void seek(ut64 offset);
2017-10-16 19:00:47 +00:00
void seekPrev();
void seekNext();
2018-09-06 17:32:12 +00:00
void updateSeek();
2017-10-16 19:00:47 +00:00
RVA getOffset();
RVA prevOpAddr(RVA startAddr, int count);
RVA nextOpAddr(RVA startAddr, int count);
2018-06-20 09:24:28 +00:00
/* Disassembly/Graph/Hexdump/Pseudocode view priority */
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Pseudocode };
2018-03-21 20:32:32 +00:00
MemoryWidgetType getMemoryWidgetPriority() const
{
return memoryWidgetPriority;
}
void setMemoryWidgetPriority(MemoryWidgetType type)
{
memoryWidgetPriority = type;
}
void triggerRaisePrioritizedMemoryWidget()
{
emit raisePrioritizedMemoryWidget(memoryWidgetPriority);
}
2017-10-22 10:21:44 +00:00
2018-06-20 09:24:28 +00:00
/* Math functions */
ut64 math(const QString &expr);
ut64 num(const QString &expr);
QString itoa(ut64 num, int rdx = 16);
2018-06-20 09:24:28 +00:00
/* Config functions */
void setConfig(const char *k, const QString &v);
void setConfig(const QString &k, const QString &v) { setConfig(k.toUtf8().constData(), v); }
void setConfig(const char *k, int v);
void setConfig(const QString &k, int v) { setConfig(k.toUtf8().constData(), v); }
void setConfig(const char *k, bool v);
void setConfig(const QString &k, bool v) { setConfig(k.toUtf8().constData(), v); }
void setConfig(const char *k, const QVariant &v);
void setConfig(const QString &k, const QVariant &v) { setConfig(k.toUtf8().constData(), v); }
int getConfigi(const char *k);
int getConfigi(const QString &k) { return getConfigi(k.toUtf8().constData()); }
ut64 getConfigut64(const char *k);
ut64 getConfigut64(const QString &k) { return getConfigut64(k.toUtf8().constData()); }
bool getConfigb(const char *k);
bool getConfigb(const QString &k) { return getConfigb(k.toUtf8().constData()); }
QString getConfig(const char *k);
QString getConfig(const QString &k) { return getConfig(k.toUtf8().constData()); }
2018-06-20 09:24:28 +00:00
QList<QString> getColorThemes();
2018-06-20 09:24:28 +00:00
/* Assembly related methods */
QString assemble(const QString &code);
QString disassemble(const QString &hex);
2017-06-07 15:48:36 +00:00
QString disassembleSingleInstruction(RVA addr);
2018-06-20 09:24:28 +00:00
QList<DisassemblyLine> disassembleLines(RVA offset, int lines);
2018-05-05 13:20:14 +00:00
void setCPU(QString arch, QString cpu, int bits);
2018-01-20 10:35:31 +00:00
void setEndianness(bool big);
void setBBSize(int size);
2018-03-21 20:32:32 +00:00
2017-10-09 18:08:35 +00:00
/* SDB */
QList<QString> sdbList(QString path);
QList<QString> sdbListKeys(QString path);
QString sdbGet(QString path, QString key);
bool sdbSet(QString path, QString key, QString val);
2018-06-12 08:43:14 +00:00
2018-10-17 06:36:41 +00:00
/* Debug */
QJsonDocument getRegistersInfo();
QJsonDocument getRegisterValues();
QString getRegisterName(QString registerRole);
RVA getProgramCounterValue();
void setRegister(QString regName, QString regValue);
2018-07-23 23:13:23 +00:00
QJsonDocument getStack(int size = 0x100);
QJsonDocument getBacktrace();
2018-06-12 08:43:14 +00:00
void startDebug();
void startEmulation();
void attachDebug(int pid);
void stopDebug();
2018-06-12 08:43:14 +00:00
void continueDebug();
void continueUntilCall();
void continueUntilSyscall();
2018-06-12 08:43:14 +00:00
void continueUntilDebug(QString offset);
void stepDebug();
void stepOverDebug();
void stepOutDebug();
void toggleBreakpoint(RVA addr);
void toggleBreakpoint(QString addr);
void delBreakpoint(RVA addr);
void delAllBreakpoints();
void enableBreakpoint(RVA addr);
void disableBreakpoint(RVA addr);
bool isBreakpoint(const QList<RVA> &breakpoints, RVA addr);
QList<RVA> getBreakpointsAddresses();
QString getActiveDebugPlugin();
QStringList getDebugPlugins();
void setDebugPlugin(QString plugin);
bool currentlyDebugging = false;
bool currentlyEmulating = false;
int currentlyAttachedToPID = -1;
QString currentlyOpenFile;
2018-06-12 08:43:14 +00:00
2018-10-17 06:36:41 +00:00
/* Pseudocode */
2018-09-08 07:12:08 +00:00
QString getDecompiledCodePDC(RVA addr);
bool getR2DecAvailable();
QString getDecompiledCodeR2Dec(RVA addr);
2017-11-28 11:56:38 +00:00
RVA getOffsetJump(RVA addr);
QJsonDocument getFileInfo();
QJsonDocument getSignatureInfo();
QJsonDocument getFileVersionInfo();
QStringList getStats();
void setGraphEmpty(bool empty);
bool isGraphEmpty();
void getOpcodes();
QList<QString> opcodes;
QList<QString> regs;
void setSettings();
void loadPDB(const QString &file);
QList<RVA> getSeekHistory();
2018-06-20 09:24:28 +00:00
/* Plugins */
QStringList getAsmPluginNames();
QStringList getAnalPluginNames();
2018-06-20 09:24:28 +00:00
/* Projects */
QStringList getProjectNames();
void openProject(const QString &name);
void saveProject(const QString &name);
void deleteProject(const QString &name);
static bool isProjectNameValid(const QString &name);
2018-06-20 09:24:28 +00:00
/* Widgets */
QList<RBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString());
QList<RIOPluginDescription> getRIOPluginDescriptions();
QList<RCorePluginDescription> getRCorePluginDescriptions();
QList<RAsmPluginDescription> getRAsmPluginDescriptions();
QList<FunctionDescription> getAllFunctions();
QList<ImportDescription> getAllImports();
QList<ExportDescription> getAllExports();
QList<SymbolDescription> getAllSymbols();
2018-05-21 17:34:41 +00:00
QList<HeaderDescription> getAllHeaders();
2018-05-24 15:37:37 +00:00
QList<ZignatureDescription> getAllZignatures();
QList<CommentDescription> getAllComments(const QString &filterType);
QList<RelocDescription> getAllRelocs();
QList<StringDescription> getAllStrings();
QList<FlagspaceDescription> getAllFlagspaces();
QList<FlagDescription> getAllFlags(QString flagspace = QString());
QList<SectionDescription> getAllSections();
QList<SegmentDescription> getAllSegments();
QList<EntrypointDescription> getAllEntrypoint();
QList<BinClassDescription> getAllClassesFromBin();
QList<BinClassDescription> getAllClassesFromFlags();
2018-02-04 14:32:18 +00:00
QList<ResourcesDescription> getAllResources();
2018-02-26 22:26:18 +00:00
QList<VTableDescription> getAllVTables();
/*!
* \return all loaded types
*/
2018-03-06 17:21:48 +00:00
QList<TypeDescription> getAllTypes();
/*!
* \return all loaded primitive types
*/
QList<TypeDescription> getAllPrimitiveTypes();
/*!
* \return all loaded unions
*/
QList<TypeDescription> getAllUnions();
/*!
* \return all loaded structs
*/
QList<TypeDescription> getAllStructs();
/*!
* \return all loaded enums
*/
QList<TypeDescription> getAllEnums();
/*!
* \return all loaded typedefs
*/
QList<TypeDescription> getAllTypedefs();
/*!
* \brief Adds new types
* It first uses the r_parse_c_string() function from radare2 API to parse the
* supplied C file (in the form of a string). If there were errors, they are displayed.
* If there were no errors, it uses sdb_query_lines() function from radare2 API
* to save the parsed types returned by r_parse_c_string()
* \param str Contains the definition of the data types
* \return returns an empty QString if there was no error, else returns the error
*/
QString addTypes(const char *str);
QString addTypes(const QString &str) { return addTypes(str.toUtf8().constData()); }
2018-06-12 08:43:14 +00:00
QList<MemoryMapDescription> getMemoryMap();
QList<SearchDescription> getAllSearch(QString search_for, QString space);
2018-06-29 10:34:01 +00:00
BlockStatistics getBlockStatistics(unsigned int blocksCount);
QList<BreakpointDescription> getBreakpoints();
QList<ProcessDescription> getAllProcesses();
2018-07-19 14:35:46 +00:00
QList<RegisterRefDescription> getRegisterRefs();
QJsonObject getRegisterJson();
QList<VariableDescription> getVariables(RVA at);
2018-03-21 20:32:32 +00:00
QList<XrefDescription> getXRefs(RVA addr, bool to, bool whole_function,
const QString &filterType = QString::null);
2017-06-07 10:56:55 +00:00
2018-05-29 16:19:59 +00:00
QList<StringDescription> parseStringsJson(const QJsonDocument &doc);
2018-06-25 19:28:34 +00:00
QList<FunctionDescription> parseFunctionsJson(const QJsonDocument &doc);
2018-05-29 16:19:59 +00:00
void handleREvent(int type, void *data);
2018-06-20 09:24:28 +00:00
/* Signals related */
void triggerVarsChanged();
void triggerFunctionRenamed(const QString &prevName, const QString &newName);
void triggerRefreshAll();
void triggerAsmOptionsChanged();
void triggerGraphOptionsChanged();
void message(const QString &msg, bool debug = false);
QStringList getSectionList();
RCoreLocked core() const;
2019-02-15 12:33:23 +00:00
static QString ansiEscapeToHtml(const QString &text);
signals:
void refreshAll();
void functionRenamed(const QString &prev_name, const QString &new_name);
void varsChanged();
void functionsChanged();
void flagsChanged();
void commentsChanged();
2018-06-12 08:43:14 +00:00
void registersChanged();
void instructionChanged(RVA offset);
void breakpointsChanged();
void refreshCodeViews();
void stackChanged();
void classNew(const QString &cls);
void classDeleted(const QString &cls);
void classRenamed(const QString &oldName, const QString &newName);
void classAttrsChanged(const QString &cls);
void projectSaved(bool successfully, const QString &name);
/*!
* emitted when config regarding disassembly display changes
*/
void asmOptionsChanged();
/*!
* emitted when config regarding graph display changes
*/
void graphOptionsChanged();
2017-10-09 18:08:35 +00:00
/*!
* \brief seekChanged is emitted each time radare2 seek value is modified
* \param offset
*/
void seekChanged(RVA offset);
void raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType type);
void changeDefinedView();
void changeDebugView();
void newMessage(const QString &msg);
void newDebugMessage(const QString &msg);
private:
MemoryWidgetType memoryWidgetPriority;
QString notes;
RCore *core_;
2018-05-26 16:21:23 +00:00
AsyncTaskManager *asyncTaskManager;
RVA offsetPriorDebugging = RVA_INVALID;
QErrorMessage msgBox;
bool emptyGraph = false;
};
2017-10-09 18:08:35 +00:00
class ccClass : public CutterCore
{
};
2017-09-25 12:55:41 +00:00
#endif // CUTTER_H