Loading...
Searching...
No Matches
BinaryNinja::CoreDemangler Class Reference

Public Member Functions

 CoreDemangler (BNDemangler *demangler)
virtual ~CoreDemangler ()=default
virtual bool IsMangledString (const std::string &name)
 Determine if a given name is mangled and this demangler can process it.
virtual std::optional< ResultDemangle (const std::string &name, const Config &config)
 Demangle a raw name into a Type and QualifiedName.
Public Member Functions inherited from BinaryNinja::Demangler
std::string GetName () const
Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNDemangler >
 StaticCoreRefCountObject ()
virtual ~StaticCoreRefCountObject ()
BNDemanglerGetObject () const
void AddRef ()
void Release ()
void AddRefForRegistration ()
void AddRefForCallback ()
void ReleaseForCallback ()

Additional Inherited Members

Public Types inherited from BinaryNinja::Demangler
using Config = DemanglerConfig
using Result = DemanglerResult
Static Public Member Functions inherited from BinaryNinja::Demangler
static bool 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< DemanglerGetByName (const std::string &demanglerName)
static bool Promote (const Ref< Demangler > &demangler)
 Promote a demangler to the highest-priority position.
static std::optional< ResultDemangleAny (const std::string &mangledName, const Config &config=DemanglerConfig::Default())
 Attempt to demangle a mangled name, trying all relevant demanglers and using whichever one accepts it.
Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNDemangler >
std::atomic< int > m_refs
BNDemanglerm_object
Protected Member Functions inherited from BinaryNinja::Demangler
 Demangler (std::string demanglerName)
 Demangler (BNDemangler *demangler)
virtual ~Demangler ()=default
Static Protected Member Functions inherited from BinaryNinja::Demangler
static bool IsMangledStringCallback (void *ctxt, const char *mangledName)
static bool DemangleCallback (void *ctxt, const char *mangledName, const BNDemanglerConfig *config, BNDemanglerResult *result)
static void FreeResultCallback (void *ctxt, BNDemanglerResult *result)

Constructor & Destructor Documentation

◆ CoreDemangler()

BinaryNinja::CoreDemangler::CoreDemangler ( BNDemangler * demangler)

◆ ~CoreDemangler()

virtual BinaryNinja::CoreDemangler::~CoreDemangler ( )
virtualdefault

Member Function Documentation

◆ IsMangledString()

bool BinaryNinja::CoreDemangler::IsMangledString ( const std::string & mangledName)
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 DemangleAny. Returning True from this does not require the demangler to succeed the call to Demangle, but simply implies that it may succeed.

Parameters
mangledNameRaw mangled name string
Returns
True if the demangler thinks it can handle the name

Implements BinaryNinja::Demangler.

◆ Demangle()

std::optional< Demangler::Result > BinaryNinja::CoreDemangler::Demangle ( const std::string & mangledName,
const Config & config )
virtual

Demangle a raw name into a Type and QualifiedName.

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 DemangleAny. 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.

Parameters
mangledNameRaw mangled name
configPlatform/view/options used while demangling
Returns
Demangled type/name if successful

Implements BinaryNinja::Demangler.