Public Member Functions | |
std::string | GetName () const |
virtual bool | IsMangledString (const std::string &name)=0 |
Determine if a given name is mangled and this demangler can process it. | |
virtual bool | Demangle (Ref< Architecture > arch, const std::string &name, Ref< Type > &outType, QualifiedName &outVarName, Ref< BinaryView > view=nullptr)=0 |
Demangle a raw name into a Type and QualifiedName. | |
Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNDemangler > | |
StaticCoreRefCountObject () | |
virtual | ~StaticCoreRefCountObject () |
BNDemangler * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Static Public Member Functions | |
static void | Register (Demangler *demangler) |
Register a custom Demangler. | |
static std::vector< Ref< Demangler > > | GetList () |
Get the list of currently registered demanglers, sorted by lowest to highest priority. | |
static Ref< Demangler > | GetByName (const std::string &name) |
static void | Promote (Ref< Demangler > demangler) |
Promote a demangler to the highest-priority position. | |
Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNDemangler > | |
static BNDemangler * | GetObject (StaticCoreRefCountObject *obj) |
Protected Member Functions | |
Demangler (const std::string &name) | |
Demangler (BNDemangler *demangler) | |
virtual | ~Demangler ()=default |
Static Protected Member Functions | |
static bool | IsMangledStringCallback (void *ctxt, const char *name) |
static bool | DemangleCallback (void *ctxt, BNArchitecture *arch, const char *name, BNType **outType, BNQualifiedName *outVarName, BNBinaryView *view) |
static void | FreeVarNameCallback (void *ctxt, BNQualifiedName *name) |
Additional Inherited Members | |
Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNDemangler > | |
std::atomic< int > | m_refs |
BNDemangler * | m_object |
|
explicitprotected |
|
protected |
|
protectedvirtualdefault |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
Register a custom Demangler.
Newly registered demanglers will get priority over previously registered demanglers and built-in demanglers.
Get the list of currently registered demanglers, sorted by lowest to highest priority.
Promote a demangler to the highest-priority position.
demangler | Demangler to promote |
std::string BinaryNinja::Demangler::GetName | ( | ) | const |
|
pure virtual |
Determine if a given name is mangled and this demangler can process it.
The most recently registered demangler that claims a name is a mangled string (returns true from this function), and then returns a value from Demangle will determine the result of a call to DemangleGeneric. Returning True from this does not require the demangler to succeed the call to Demangle, but simply implies that it may succeed.
name | Raw mangled name string |
Implemented in BinaryNinja::CoreDemangler.
|
pure virtual |
Demangle a raw name into a Type and QualifiedName.
Any unresolved named types referenced by the resulting Type will be created as empty structures or void typedefs in the view, if the result is used on a data structure in the view. Given this, the call to Demangle should NOT cause any side-effects creating types in the view trying to resolve this and instead just return a type with unresolved named type references.
The most recently registered demangler that claims a name is a mangled string (returns true from IsMangledString), and then returns a value from this function will determine the result of a call to DemangleGeneric. If this call returns None, the next most recently used demangler(s) will be tried instead.
If the mangled name has no type information, but a name is still possible to extract, this function may return a successful result with outType=nullptr, which will be accepted.
arch | Architecture for context in which the name exists, eg for pointer sizes |
name | Raw mangled name |
outType | Resulting type, if one can be deduced, will be written here. Otherwise nullptr will be written |
outVarName | Resulting variable name |
view | (Optional) BinaryView context in which the name exists, eg for type lookup |
Implemented in BinaryNinja::CoreDemangler.