typeparser module

binaryninja.typeparser.BasicTypeParserResult(...)

binaryninja.typeparser.CoreTypeParser([handle])

binaryninja.typeparser.ParsedType(name, ...)

binaryninja.typeparser.QualifiedNameTypeAndId(...)

binaryninja.typeparser.Settings([...])

Settings provides a way to define and access settings in a hierarchical fashion.

binaryninja.typeparser.TypeParser([handle])

binaryninja.typeparser.TypeParserError(...)

binaryninja.typeparser.TypeParserResult(...)

class BasicTypeParserResult(types: Dict[ForwardRef('types.QualifiedName'), ForwardRef('types.Type')], variables: Dict[ForwardRef('types.QualifiedName'), ForwardRef('types.Type')], functions: Dict[ForwardRef('types.QualifiedName'), ForwardRef('types.Type')])[source]

Bases: object

Parameters
Return type

None

functions: Dict[QualifiedName, Type]
types: Dict[QualifiedName, Type]
variables: Dict[QualifiedName, Type]
class CoreTypeParser(handle=None)[source]

Bases: binaryninja.typeparser.TypeParser

parse_type_string(source: str, platform: Platform, existing_types: Optional[List[QualifiedNameTypeAndId]] = None) Tuple[Optional[Tuple[Union[Iterable[Union[str, bytes]], str, QualifiedName], Type]], List[TypeParserError]][source]
Parameters
Return type

Tuple[Optional[Tuple[Union[Iterable[Union[str, bytes]], str, QualifiedName], Type]], List[TypeParserError]]

parse_types_from_source(source: str, file_name: str, platform: Platform, existing_types: Optional[List[QualifiedNameTypeAndId]] = None, options: Optional[List[str]] = None, include_dirs: Optional[List[str]] = None, auto_type_source: str = '') Tuple[Optional[TypeParserResult], List[TypeParserError]][source]
Parameters
Return type

Tuple[Optional[TypeParserResult], List[TypeParserError]]

preprocess_source(source: str, file_name: str, platform: Platform, existing_types: Optional[List[QualifiedNameTypeAndId]] = None, options: Optional[List[str]] = None, include_dirs: Optional[List[str]] = None) Tuple[Optional[str], List[TypeParserError]][source]
Parameters
Return type

Tuple[Optional[str], List[TypeParserError]]

class ParsedType(name: 'types.QualifiedNameType', type: 'types.Type', is_user: bool)[source]

Bases: object

Parameters
Return type

None

is_user: bool
name: Union[Iterable[Union[str, bytes]], str, QualifiedName]
type: Type
class QualifiedNameTypeAndId(name: 'types.QualifiedNameType', id: str, type: 'types.Type')[source]

Bases: object

Parameters
Return type

None

id: str
name: Union[Iterable[Union[str, bytes]], str, QualifiedName]
type: Type
class TypeParser(handle=None)[source]

Bases: object

parse_type_string(source: str, platform: Platform, existing_types: Optional[List[QualifiedNameTypeAndId]] = None) Tuple[Optional[Tuple[Union[Iterable[Union[str, bytes]], str, QualifiedName], Type]], List[TypeParserError]][source]
Parameters
Return type

Tuple[Optional[Tuple[Union[Iterable[Union[str, bytes]], str, QualifiedName], Type]], List[TypeParserError]]

parse_types_from_source(source: str, file_name: str, platform: Platform, existing_types: Optional[List[QualifiedNameTypeAndId]] = None, options: Optional[List[str]] = None, include_dirs: Optional[List[str]] = None, auto_type_source: str = '') Tuple[Optional[TypeParserResult], List[TypeParserError]][source]
Parameters
Return type

Tuple[Optional[TypeParserResult], List[TypeParserError]]

preprocess_source(source: str, file_name: str, platform: Platform, existing_types: Optional[List[QualifiedNameTypeAndId]] = None, options: Optional[List[str]] = None, include_dirs: Optional[List[str]] = None) Tuple[Optional[str], List[TypeParserError]][source]
Parameters
Return type

Tuple[Optional[str], List[TypeParserError]]

register()[source]
name = None
class TypeParserError(severity: TypeParserErrorSeverity, message: str, file_name: str, line: int, column: int)[source]

Bases: object

Parameters
Return type

None

column: int
file_name: str
line: int
message: str
severity: TypeParserErrorSeverity
class TypeParserResult(types: Dict[ForwardRef('types.QualifiedName'), binaryninja.typeparser.ParsedType], variables: Dict[ForwardRef('types.QualifiedName'), binaryninja.typeparser.ParsedType], functions: Dict[ForwardRef('types.QualifiedName'), binaryninja.typeparser.ParsedType])[source]

Bases: object

Parameters
Return type

None

functions: Dict[QualifiedName, ParsedType]
types: Dict[QualifiedName, ParsedType]
variables: Dict[QualifiedName, ParsedType]
preprocess_source(source: str, filename: Optional[str] = None, include_dirs: Optional[List[str]] = None) Tuple[Optional[str], str][source]

preprocess_source run the C preprocessor on the given source or source filename.

Parameters
  • source (str) – source to pre-process

  • filename (str) – optional filename to pre-process

  • include_dirs (list(str)) – list of string directories to use as include directories.

Returns

returns a tuple of (preprocessed_source, error_string)

Return type

tuple(str,str)

Example
>>> source = "#define TEN 10\nint x[TEN];\n"
>>> preprocess_source(source)
('#line 1 "input"\n\n#line 2 "input"\n int x [ 10 ] ;\n', '')
>>>
to_bytes(field)[source]