Classes | |
struct | BinaryNinja::ParsedType |
struct | BinaryNinja::TypeParserResult |
struct | BinaryNinja::TypeParserError |
class | BinaryNinja::TypeParser |
class | BinaryNinja::CoreTypeParser |
struct BinaryNinja::ParsedType |
Public Member Functions | |
ParsedType ()=default | |
ParsedType (const std::string &name, const Ref< Type > &type, bool isUser) | |
ParsedType (const QualifiedName &name, const Ref< Type > &type, bool isUser) | |
bool | operator< (const ParsedType &other) const |
Public Attributes | |
QualifiedName | name |
Ref< Type > | type |
bool | isUser |
|
default |
|
inline |
|
inline |
|
inline |
QualifiedName BinaryNinja::ParsedType::name |
bool BinaryNinja::ParsedType::isUser |
struct BinaryNinja::TypeParserResult |
Class Members | ||
---|---|---|
vector< ParsedType > | types | |
vector< ParsedType > | variables | |
vector< ParsedType > | functions |
struct BinaryNinja::TypeParserError |
Public Member Functions | |
TypeParserError ()=default | |
TypeParserError (BNTypeParserErrorSeverity severity, const std::string &message) | |
Public Attributes | |
BNTypeParserErrorSeverity | severity |
std::string | message |
std::string | fileName |
uint64_t | line |
uint64_t | column |
|
default |
|
inline |
BNTypeParserErrorSeverity BinaryNinja::TypeParserError::severity |
std::string BinaryNinja::TypeParserError::message |
std::string BinaryNinja::TypeParserError::fileName |
uint64_t BinaryNinja::TypeParserError::line |
uint64_t BinaryNinja::TypeParserError::column |
class BinaryNinja::TypeParser |
Public Member Functions | |
std::string | GetName () const |
Get the Type Parser's registered name. | |
virtual bool | GetOptionText (BNTypeParserOption option, std::string value, std::string &result) const |
virtual bool | PreprocessSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, std::string &output, std::vector< TypeParserError > &errors)=0 |
Preprocess a block of source, returning the source that would be parsed. | |
virtual bool | ParseTypesFromSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors)=0 |
Parse an entire block of source into types, variables, and functions. | |
bool | ParseTypesFromSourceFile (const std::string &fileName, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors) |
Parse an entire source file into types, variables, and functions. | |
virtual bool | ParseTypeString (const std::string &source, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, QualifiedNameAndType &result, std::vector< TypeParserError > &errors)=0 |
Parse a single type and name from a string containing their definition. | |
Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser > | |
StaticCoreRefCountObject () | |
virtual | ~StaticCoreRefCountObject () |
BNTypeParser * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Static Public Member Functions | |
static void | Register (TypeParser *parser) |
static std::vector< Ref< TypeParser > > | GetList () |
static Ref< TypeParser > | GetByName (const std::string &name) |
static Ref< TypeParser > | GetDefault () |
static std::vector< std::string > | ParseOptionsText (const std::string &optionsText) |
Parse a space-separated string of options into a list. | |
static std::string | FormatParseErrors (const std::vector< TypeParserError > &errors) |
Format a list of parser errors into a big string. | |
Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser > | |
static BNTypeParser * | GetObject (StaticCoreRefCountObject *obj) |
Protected Member Functions | |
TypeParser (const std::string &name) | |
TypeParser (BNTypeParser *parser) | |
Static Protected Member Functions | |
static bool | GetOptionTextCallback (void *ctxt, BNTypeParserOption option, const char *value, char **result) |
static bool | PreprocessSourceCallback (void *ctxt, const char *source, const char *fileName, BNPlatform *platform, BNTypeContainer *existingTypes, const char *const *options, size_t optionCount, const char *const *includeDirs, size_t includeDirCount, char **output, BNTypeParserError **errors, size_t *errorCount) |
static bool | ParseTypesFromSourceCallback (void *ctxt, const char *source, const char *fileName, BNPlatform *platform, BNTypeContainer *existingTypes, const char *const *options, size_t optionCount, const char *const *includeDirs, size_t includeDirCount, const char *autoTypeSource, BNTypeParserResult *result, BNTypeParserError **errors, size_t *errorCount) |
static bool | ParseTypeStringCallback (void *ctxt, const char *source, BNPlatform *platform, BNTypeContainer *existingTypes, BNQualifiedNameAndType *result, BNTypeParserError **errors, size_t *errorCount) |
static void | FreeStringCallback (void *ctxt, char *result) |
static void | FreeResultCallback (void *ctxt, BNTypeParserResult *result) |
static void | FreeErrorListCallback (void *ctxt, BNTypeParserError *errors, size_t errorCount) |
Additional Inherited Members | |
Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser > | |
std::atomic< int > | m_refs |
BNTypeParser * | m_object |
|
explicitprotected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
|
static |
|
static |
|
static |
|
static |
Parse a space-separated string of options into a list.
optionsText | Space-separated options text |
|
static |
Format a list of parser errors into a big string.
errors | List of errors |
std::string TypeParser::GetName | ( | ) | const |
Get the Type Parser's registered name.
|
virtual |
Get the string representation of an option for passing to ParseTypes*
option | Option type |
value | Option value |
result | String representing the option |
Reimplemented in BinaryNinja::CoreTypeParser.
|
pure virtual |
Preprocess a block of source, returning the source that would be parsed.
source | Source code to process |
fileName | Name of the file containing the source (does not need to exist on disk) |
platform | Platform to assume the source is relevant to |
existingTypes | Container of all existing types to use for parsing context |
options | String arguments to pass as options, e.g. command line arguments |
includeDirs | List of directories to include in the header search path |
output | Reference to a string into which the preprocessed source will be written |
errors | Reference to a list into which any parse errors will be written |
Implemented in BinaryNinja::CoreTypeParser.
|
pure virtual |
Parse an entire block of source into types, variables, and functions.
source | Source code to parse |
fileName | Name of the file containing the source (optional: exists on disk) |
platform | Platform to assume the types are relevant to |
existingTypes | Container of all existing types to use for parsing context |
options | String arguments to pass as options, e.g. command line arguments |
includeDirs | List of directories to include in the header search path |
autoTypeSource | Optional source of types if used for automatically generated types |
result | Reference to structure into which the results will be written |
errors | Reference to a list into which any parse errors will be written |
Implemented in BinaryNinja::CoreTypeParser.
bool TypeParser::ParseTypesFromSourceFile | ( | const std::string & | fileName, |
Ref< Platform > | platform, | ||
std::optional< TypeContainer > | existingTypes, | ||
const std::vector< std::string > & | options, | ||
const std::vector< std::string > & | includeDirs, | ||
const std::string & | autoTypeSource, | ||
TypeParserResult & | result, | ||
std::vector< TypeParserError > & | errors ) |
Parse an entire source file into types, variables, and functions.
fileName | Name of the file on disk containing the source |
platform | Platform to assume the types are relevant to |
existingTypes | Container of all existing types to use for parsing context |
options | String arguments to pass as options, e.g. command line arguments |
includeDirs | List of directories to include in the header search path |
autoTypeSource | Optional source of types if used for automatically generated types |
result | Reference to structure into which the results will be written |
errors | Reference to a list into which any parse errors will be written |
|
pure virtual |
Parse a single type and name from a string containing their definition.
source | Source code to parse |
platform | Platform to assume the types are relevant to |
existingTypes | Container of all existing types to use for parsing context |
result | Reference into which the resulting type and name will be written |
errors | Reference to a list into which any parse errors will be written |
Implemented in BinaryNinja::CoreTypeParser.
class BinaryNinja::CoreTypeParser |
Public Member Functions | |
CoreTypeParser (BNTypeParser *parser) | |
virtual | ~CoreTypeParser () |
virtual bool | GetOptionText (BNTypeParserOption option, std::string value, std::string &result) const override |
virtual bool | PreprocessSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, std::string &output, std::vector< TypeParserError > &errors) override |
Preprocess a block of source, returning the source that would be parsed. | |
virtual bool | ParseTypesFromSource (const std::string &source, const std::string &fileName, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors) override |
Parse an entire block of source into types, variables, and functions. | |
virtual bool | ParseTypeString (const std::string &source, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, QualifiedNameAndType &result, std::vector< TypeParserError > &errors) override |
Parse a single type and name from a string containing their definition. | |
Public Member Functions inherited from BinaryNinja::TypeParser | |
std::string | GetName () const |
Get the Type Parser's registered name. | |
bool | ParseTypesFromSourceFile (const std::string &fileName, Ref< Platform > platform, std::optional< TypeContainer > existingTypes, const std::vector< std::string > &options, const std::vector< std::string > &includeDirs, const std::string &autoTypeSource, TypeParserResult &result, std::vector< TypeParserError > &errors) |
Parse an entire source file into types, variables, and functions. | |
Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser > | |
StaticCoreRefCountObject () | |
virtual | ~StaticCoreRefCountObject () |
BNTypeParser * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Additional Inherited Members | |
Static Public Member Functions inherited from BinaryNinja::TypeParser | |
static void | Register (TypeParser *parser) |
static std::vector< Ref< TypeParser > > | GetList () |
static Ref< TypeParser > | GetByName (const std::string &name) |
static Ref< TypeParser > | GetDefault () |
static std::vector< std::string > | ParseOptionsText (const std::string &optionsText) |
Parse a space-separated string of options into a list. | |
static std::string | FormatParseErrors (const std::vector< TypeParserError > &errors) |
Format a list of parser errors into a big string. | |
Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser > | |
static BNTypeParser * | GetObject (StaticCoreRefCountObject *obj) |
Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNTypeParser > | |
std::atomic< int > | m_refs |
BNTypeParser * | m_object |
Protected Member Functions inherited from BinaryNinja::TypeParser | |
TypeParser (const std::string &name) | |
TypeParser (BNTypeParser *parser) | |
Static Protected Member Functions inherited from BinaryNinja::TypeParser | |
static bool | GetOptionTextCallback (void *ctxt, BNTypeParserOption option, const char *value, char **result) |
static bool | PreprocessSourceCallback (void *ctxt, const char *source, const char *fileName, BNPlatform *platform, BNTypeContainer *existingTypes, const char *const *options, size_t optionCount, const char *const *includeDirs, size_t includeDirCount, char **output, BNTypeParserError **errors, size_t *errorCount) |
static bool | ParseTypesFromSourceCallback (void *ctxt, const char *source, const char *fileName, BNPlatform *platform, BNTypeContainer *existingTypes, const char *const *options, size_t optionCount, const char *const *includeDirs, size_t includeDirCount, const char *autoTypeSource, BNTypeParserResult *result, BNTypeParserError **errors, size_t *errorCount) |
static bool | ParseTypeStringCallback (void *ctxt, const char *source, BNPlatform *platform, BNTypeContainer *existingTypes, BNQualifiedNameAndType *result, BNTypeParserError **errors, size_t *errorCount) |
static void | FreeStringCallback (void *ctxt, char *result) |
static void | FreeResultCallback (void *ctxt, BNTypeParserResult *result) |
static void | FreeErrorListCallback (void *ctxt, BNTypeParserError *errors, size_t errorCount) |
CoreTypeParser::CoreTypeParser | ( | BNTypeParser * | parser | ) |
|
inlinevirtual |
|
overridevirtual |
Get the string representation of an option for passing to ParseTypes*
option | Option type |
value | Option value |
result | String representing the option |
Reimplemented from BinaryNinja::TypeParser.
|
overridevirtual |
Preprocess a block of source, returning the source that would be parsed.
source | Source code to process |
fileName | Name of the file containing the source (does not need to exist on disk) |
platform | Platform to assume the source is relevant to |
existingTypes | Container of all existing types to use for parsing context |
options | String arguments to pass as options, e.g. command line arguments |
includeDirs | List of directories to include in the header search path |
output | Reference to a string into which the preprocessed source will be written |
errors | Reference to a list into which any parse errors will be written |
Implements BinaryNinja::TypeParser.
|
overridevirtual |
Parse an entire block of source into types, variables, and functions.
source | Source code to parse |
fileName | Name of the file containing the source (optional: exists on disk) |
platform | Platform to assume the types are relevant to |
existingTypes | Container of all existing types to use for parsing context |
options | String arguments to pass as options, e.g. command line arguments |
includeDirs | List of directories to include in the header search path |
autoTypeSource | Optional source of types if used for automatically generated types |
result | Reference to structure into which the results will be written |
errors | Reference to a list into which any parse errors will be written |
Implements BinaryNinja::TypeParser.
|
overridevirtual |
Parse a single type and name from a string containing their definition.
source | Source code to parse |
platform | Platform to assume the types are relevant to |
existingTypes | Container of all existing types to use for parsing context |
result | Reference into which the resulting type and name will be written |
errors | Reference to a list into which any parse errors will be written |
Implements BinaryNinja::TypeParser.