Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
348 changes: 158 additions & 190 deletions binaryninjaapi.h

Large diffs are not rendered by default.

77 changes: 41 additions & 36 deletions binaryninjacore.h

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to bump ABI version (it probably got eaten by a rebase)

Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@
// Current ABI version for linking to the core. This is incremented any time
// there are changes to the API that affect linking, including new functions,
// new types, or modifications to existing functions or types.
#define BN_CURRENT_CORE_ABI_VERSION 177
#define BN_CURRENT_CORE_ABI_VERSION 178

// Minimum ABI version that is supported for loading of plugins. Plugins that
// are linked to an ABI version less than this will not be able to load and
// will require rebuilding. The minimum version is increased when there are
// incompatible changes that break binary compatibility, such as changes to
// existing types or functions.
#define BN_MINIMUM_CORE_ABI_VERSION 176
#define BN_MINIMUM_CORE_ABI_VERSION 178

#define BN_DEMANGLER_MSVC "MS"
#define BN_DEMANGLER_GNU3 "GNU3"
#define BN_DEMANGLER_LLVM "LLVM"

#ifdef __GNUC__
#ifdef BINARYNINJACORE_LIBRARY
Expand Down Expand Up @@ -3898,13 +3902,26 @@ extern "C"
void (*freeConflictList)(void* context, BNAnalysisMergeConflict** conflictList, size_t count);
} BNAnalysisMergeConflictSplitterCallbacks;

typedef struct BNDemanglerConfig
{
BNPlatform* platform;
BNBinaryView* view;
bool simplifyTemplates;
} BNDemanglerConfig;

typedef struct BNDemanglerResult
{
BNQualifiedName name;
BNType* type;
} BNDemanglerResult;

typedef struct BNDemanglerCallbacks
{
void* context;
bool (*isMangledString)(void* ctxt, const char* name);
bool (*demangle)(void* ctxt, BNArchitecture* arch, const char* name, BNType** outType,
BNQualifiedName* outVarName, BNBinaryView* view);
void (*freeVarName)(void* ctxt, BNQualifiedName* name);
bool (*demangle)(void* ctxt, const char* name, const BNDemanglerConfig* config,
BNDemanglerResult* result);
void (*freeResult)(void* ctxt, BNDemanglerResult* result);
} BNDemanglerCallbacks;

BN_ENUM(uint8_t, BNScopeType)
Expand Down Expand Up @@ -8246,37 +8263,28 @@ extern "C"
BINARYNINJACOREAPI void BNUpdateReportFlowGraph(BNReportCollection* reports, size_t i, BNFlowGraph* graph);

// Demangler
BINARYNINJACOREAPI bool BNDemangleMS(BNArchitecture* arch, const char* mangledName, BNType** outType,
char*** outVarName, size_t* outVarNameElements, const bool simplify);
BINARYNINJACOREAPI bool BNDemangleMSWithOptions(BNArchitecture* arch, const char* mangledName, BNType** outType,
char*** outVarName, size_t* outVarNameElements, const BNBinaryView* const view);
BINARYNINJACOREAPI bool BNDemangleMSPlatform(BNPlatform* platform, const char* mangledName, BNType** outType,
char*** outVarName, size_t* outVarNameElements, const bool simplify);

BINARYNINJACOREAPI bool BNIsGNU3MangledString(const char* mangledName);
BINARYNINJACOREAPI bool BNDemangleGNU3(BNArchitecture* arch, const char* mangledName, BNType** outType,
char*** outVarName, size_t* outVarNameElements, const bool simplify);
BINARYNINJACOREAPI bool BNDemangleGNU3WithOptions(BNArchitecture* arch, const char* mangledName, BNType** outType,
char*** outVarName, size_t* outVarNameElements, const BNBinaryView* const view);
BINARYNINJACOREAPI void BNFreeDemangledName(char*** name, size_t nameElements);

BINARYNINJACOREAPI bool BNDemangleLLVM(const char* mangledName,
char*** outVarName, size_t* outVarNameElements, const bool simplify);
BINARYNINJACOREAPI bool BNDemangleLLVMWithOptions(const char* mangledName,
char*** outVarName, size_t* outVarNameElements, const BNBinaryView* const view);

BINARYNINJACOREAPI BNDemangler* BNRegisterDemangler(const char* name, BNDemanglerCallbacks* callbacks);
BINARYNINJACOREAPI BNDemanglerConfig BNGetDefaultDemanglerConfig(void);
BINARYNINJACOREAPI BNDemanglerConfig BNGetDemanglerConfigForPlatform(BNPlatform* platform,
bool simplifyTemplates);
BINARYNINJACOREAPI BNDemanglerConfig BNGetDemanglerConfigForBinaryView(BNBinaryView* view);
BINARYNINJACOREAPI bool BNDemangle(const char* name, const BNDemanglerConfig* config,
BNDemanglerResult* result);
BINARYNINJACOREAPI bool BNDemangleWithDemangler(const BNDemangler* demangler, const char* name,
const BNDemanglerConfig* config, BNDemanglerResult* result);
BINARYNINJACOREAPI void BNFreeDemanglerResult(BNDemanglerResult* result);
BINARYNINJACOREAPI bool BNSimplifyDemangledTemplateName(
const BNQualifiedName* name, BNQualifiedName* result);

BINARYNINJACOREAPI BNDemangler* BNRegisterDemangler(const char* name, const BNDemanglerCallbacks* callbacks);
BINARYNINJACOREAPI BNDemangler** BNGetDemanglerList(size_t* count);
BINARYNINJACOREAPI void BNFreeDemanglerList(BNDemangler** demanglers);
BINARYNINJACOREAPI BNDemangler* BNGetDemanglerByName(const char* name);
BINARYNINJACOREAPI char* BNGetDemanglerName(BNDemangler* demangler);
BINARYNINJACOREAPI void BNPromoteDemangler(BNDemangler* demangler);

BINARYNINJACOREAPI bool BNIsDemanglerMangledName(BNDemangler* demangler, const char* name);
BINARYNINJACOREAPI bool BNDemanglerDemangle(BNDemangler* demangler, BNArchitecture* arch, const char* name,
BNType** outType, BNQualifiedName* outVarName, BNBinaryView* view);
BINARYNINJACOREAPI bool BNDemangleGeneric(BNArchitecture* arch, const char* name,
BNType** outType, BNQualifiedName* outVarName, BNBinaryView* view, bool simplify);
BINARYNINJACOREAPI BNDemangler* BNGetMSVCDemangler(void);
BINARYNINJACOREAPI BNDemangler* BNGetGNU3Demangler(void);
BINARYNINJACOREAPI BNDemangler* BNGetLLVMDemangler(void);
BINARYNINJACOREAPI char* BNGetDemanglerName(const BNDemangler* demangler);
BINARYNINJACOREAPI bool BNPromoteDemangler(const BNDemangler* demangler);
BINARYNINJACOREAPI bool BNIsDemanglerMangledName(const BNDemangler* demangler, const char* name);

// Plugin repository APIs
BINARYNINJACOREAPI char** BNPluginGetApis(BNPlugin* p, size_t* count);
Expand Down Expand Up @@ -8638,9 +8646,6 @@ extern "C"

BINARYNINJACOREAPI uint32_t BNGetAddressRenderedWidth(uint64_t addr);

BINARYNINJACOREAPI BNQualifiedName BNRustSimplifyStrToFQN(const char* const, bool);
BINARYNINJACOREAPI char* BNRustSimplifyStrToStr(const char* const);

BINARYNINJACOREAPI BNDebugInfoParser* BNRegisterDebugInfoParser(const char* name,
bool (*isValid)(void*, BNBinaryView*),
bool (*parseInfo)(void*, BNDebugInfo*, BNBinaryView*, BNBinaryView*, BNProgressFunction, void*),
Expand Down
Loading
Loading