class CutterCore

Inherits from QObject

Public Types

enum HexdumpFormats



Public Functions

CutterCore(QObject *parent = nullptr)
void initialize()
void loadCutterRC()
AsyncTaskManager *getAsyncTaskManager()
RVA getOffset() const
QString cmd(const char *str)

CutterCore::cmd send a command to radare2.

command output
  • str: the command you want to execute Note that if you want to seek to an address, you should use CutterCore::seek

QString cmd(const QString &str)
QString cmdRaw(const QString &str)
QJsonDocument cmdj(const char *str)
QJsonDocument cmdj(const QString &str)
QStringList cmdList(const char *str)
QStringList cmdList(const QString &str)
QString cmdTask(const QString &str)
QJsonDocument cmdjTask(const QString &str)
void cmdEsil(const char *command)
void cmdEsil(const QString &command)
QString getVersionInformation()
QJsonDocument parseJson(const char *res, const char *cmd = nullptr)
QJsonDocument parseJson(const char *res, const QString &cmd = QString())
QStringList autocomplete(const QString &cmd, RLinePromptType promptType, size_t limit = 4096)
void renameFunction(const QString &oldName, const QString &newName)
void delFunction(RVA addr)
void renameFlag(QString old_name, QString new_name)
RAnalFunction *functionAt(ut64 addr)
RVA getFunctionStart(RVA addr)

finds the start address of a function in a given address

if function exists, return its start address. Otherwise return RVA_INVALID
  • addr: - an address which belongs to a function

RVA getFunctionEnd(RVA addr)

finds the end address of a function in a given address

if function exists, return its end address. Otherwise return RVA_INVALID
  • addr: - an address which belongs to a function

RVA getLastFunctionInstruction(RVA addr)

finds the last instruction of a function in a given address

if function exists, return the address of its last instruction. Otherwise return RVA_INVALID
  • addr: - an address which belongs to a function

QString cmdFunctionAt(QString addr)
QString cmdFunctionAt(RVA addr)
QString createFunctionAt(RVA addr)
QString createFunctionAt(RVA addr, QString name)
QStringList getDisassemblyPreview(RVA address, int num_of_lines)

get a compact disassembly preview for tooltips

  • address: - the address from which to print the disassembly
  • num_of_lines: - number of instructions to print

void delFlag(RVA addr)
void delFlag(const QString &name)
void addFlag(RVA offset, QString name, RVA size)
QString nearestFlag(RVA offset, RVA *flagOffsetOut)

Get nearest flag at or before offset.

flag name
  • offset: search position
  • flagOffsetOut: adress of returned flag

void triggerFlagsChanged()
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)
void setToCode(RVA addr)
void setAsString(RVA addr)
void setToData(RVA addr, int size, int repeat = 1)
int sizeofDataMeta(RVA addr)
void setComment(RVA addr, const QString &cmt)
void delComment(RVA addr)
void setImmediateBase(const QString &r2BaseName, RVA offset = RVA_INVALID)
void setCurrentBits(int bits, RVA offset = RVA_INVALID)
void applyStructureOffset(const QString &structureOffset, RVA offset = RVA_INVALID)

Changes immediate displacement to structure offset This function makes use of the “aht” command of r2 to apply structure offset to the immediate displacement used in the given instruction.

  • structureOffset: The name of struct which will be applied
  • offset: The address of the instruction where the struct will be applied

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)
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())

CutterCore::loadFile Load initial file. TODO Maybe use the “o” commands?

  • path: File path
  • baddr: Base (RBin) address
  • mapaddr: Map address
  • perms:
  • va:
  • loadbin: Load RBin information
  • forceBinPlugin:

bool tryFile(QString path, bool rw)
bool openFile(QString path, RVA mapaddr)

Opens a file using r2 API.

  • path: Path to file
  • mapaddr: Map Address

void loadScript(const QString &scriptname)
QJsonArray getOpenedFiles()
void seek(QString thing)
void seek(ut64 offset)
void seekPrev()
void seekNext()
void updateSeek()
void showMemoryWidget()

Raise a memory widget showing current offset, prefer last active memory widget.

void seekAndShow(ut64 offset)

Seek to offset and raise a memory widget showing it.

  • offset:

void seekAndShow(QString thing)

  • thing: - addressable expression

RVA getOffset()
RVA prevOpAddr(RVA startAddr, int count)
RVA nextOpAddr(RVA startAddr, int count)
ut64 math(const QString &expr)
ut64 num(const QString &expr)
QString itoa(ut64 num, int rdx = 16)
void setConfig(const char *k, const QString &v)
void setConfig(const QString &k, const QString &v)
void setConfig(const char *k, int v)
void setConfig(const QString &k, int v)
void setConfig(const char *k, bool v)
void setConfig(const QString &k, bool v)
void setConfig(const char *k, const QVariant &v)
void setConfig(const QString &k, const QVariant &v)
int getConfigi(const char *k)
int getConfigi(const QString &k)
ut64 getConfigut64(const char *k)
ut64 getConfigut64(const QString &k)
bool getConfigb(const char *k)
bool getConfigb(const QString &k)
QString getConfig(const char *k)
QString getConfig(const QString &k)
QList<QString> getColorThemes()
QByteArray assemble(const QString &code)
QString disassemble(const QByteArray &data)
QString disassembleSingleInstruction(RVA addr)
QList<DisassemblyLine> disassembleLines(RVA offset, int lines)
QString hexdump(RVA offset, int size, HexdumpFormats format)

return hexdump of <size> from an <offset> by a given formats

  • address: - the address from which to print the hexdump
  • size: - number of bytes to print
  • format: - the type of hexdump (qwords, words. decimal, etc)

QString getHexdumpPreview(RVA offset, int size)

get a compact hexdump preview for tooltips

  • address: - the address from which to print the hexdump
  • size: - number of bytes to print

void setCPU(QString arch, QString cpu, int bits)
void setEndianness(bool big)
QList<QString> sdbList(QString path)
QList<QString> sdbListKeys(QString path)
QString sdbGet(QString path, QString key)
bool sdbSet(QString path, QString key, QString val)
QJsonDocument getRegistersInfo()
QJsonDocument getRegisterValues()
QString getRegisterName(QString registerRole)
RVA getProgramCounterValue()
void setRegister(QString regName, QString regValue)
QJsonDocument getStack(int size = 0x100)
QJsonDocument getBacktrace()
void startDebug()
void startEmulation()
void attachDebug(int pid)
void stopDebug()
void continueDebug()
void continueUntilCall()
void continueUntilSyscall()
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)
QList<Decompiler *> getDecompilers()
Decompiler *getDecompilerById(const QString &id)
bool registerDecompiler(Decompiler *decompiler)

Register a new decompiler

The decompiler must have a unique id, otherwise this method will fail. The decompiler’s parent will be set to this CutterCore instance, so it will automatically be freed later.

whether the decompiler was registered successfully

RVA getOffsetJump(RVA addr)
QJsonDocument getFileInfo()
QJsonDocument getSignatureInfo()
QJsonDocument getFileVersionInfo()
QStringList getStats()
void setGraphEmpty(bool empty)
bool isGraphEmpty()
void getOpcodes()
void setSettings()
void loadPDB(const QString &file)
QByteArray ioRead(RVA addr, int len)
QList<RVA> getSeekHistory()
QStringList getAsmPluginNames()
QStringList getAnalPluginNames()
QStringList getProjectNames()
void openProject(const QString &name)
void saveProject(const QString &name)
void deleteProject(const QString &name)
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()
QList<HeaderDescription> getAllHeaders()
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()
QList<ResourcesDescription> getAllResources()
QList<VTableDescription> getAllVTables()
QList<TypeDescription> getAllTypes()

all loaded types

QList<TypeDescription> getAllPrimitiveTypes()

all loaded primitive types

QList<TypeDescription> getAllUnions()

all loaded unions

QList<TypeDescription> getAllStructs()

all loaded structs

QList<TypeDescription> getAllEnums()

all loaded enums

QList<TypeDescription> getAllTypedefs()

all loaded typedefs

QString getTypeAsC(QString name, QString category)

Fetching the C representation of a given Type.

The type decleration as C output
  • name: - the name or the type of the given Type / Struct
  • category: - the category of the given Type (Struct, Union, Enum, …)

QString addTypes(const char *str)

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()

returns an empty QString if there was no error, else returns the error
  • str: Contains the definition of the data types

QString addTypes(const QString &str)
bool isAddressMapped(RVA addr)

Checks if the given address is mapped to a region.

true if addr is mapped, false otherwise
  • addr: The address to be checked

QList<MemoryMapDescription> getMemoryMap()
QList<SearchDescription> getAllSearch(QString search_for, QString space)
BlockStatistics getBlockStatistics(unsigned int blocksCount)
QList<BreakpointDescription> getBreakpoints()
QList<ProcessDescription> getAllProcesses()
QList<RegisterRefDescription> getRegisterRefs()
QJsonObject getRegisterJson()
QList<VariableDescription> getVariables(RVA at)
QList<XrefDescription> getXRefs(RVA addr, bool to, bool whole_function, const QString &filterType = QString())
QList<StringDescription> parseStringsJson(const QJsonDocument &doc)
void handleREvent(int type, void *data)
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()
BasicBlockHighlighter *getBBHighlighter()
BasicInstructionHighlighter *getBIHighlighter()

Public Members

bool currentlyDebugging = false
bool currentlyEmulating = false
int currentlyAttachedToPID = -1
QString currentlyOpenFile
QList<QString> opcodes
QList<QString> regs


signal CutterCore::refreshAll
signal CutterCore::functionRenamed
signal CutterCore::varsChanged
signal CutterCore::functionsChanged
signal CutterCore::flagsChanged
signal CutterCore::commentsChanged
signal CutterCore::registersChanged
signal CutterCore::instructionChanged
signal CutterCore::breakpointsChanged
signal CutterCore::refreshCodeViews
signal CutterCore::stackChanged
signal CutterCore::classNew
signal CutterCore::classDeleted
signal CutterCore::classRenamed
signal CutterCore::classAttrsChanged
signal CutterCore::projectSaved
signal CutterCore::asmOptionsChanged

emitted when config regarding disassembly display changes

signal CutterCore::graphOptionsChanged

emitted when config regarding graph display changes

signal CutterCore::seekChanged

seekChanged is emitted each time radare2 seek value is modified

  • offset:

signal CutterCore::changeDefinedView
signal CutterCore::changeDebugView
signal CutterCore::newMessage
signal CutterCore::newDebugMessage
signal CutterCore::showMemoryWidgetRequested

Public Static Functions

CutterCore *instance()
QString sanitizeStringForCommand(QString s)
QByteArray hexStringToBytes(const QString &hex)
QString bytesToHexString(const QByteArray &bytes)
bool isProjectNameValid(const QString &name)
QString ansiEscapeToHtml(const QString &text)