Interface ITypeManager
- All Superinterfaces:
INativeItemListenable
A type manager, for primitive types as well as complex types.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(INativeItemListener listener) Register a listener relaying events generated by this type manager's type items.addStructureField(IStructureType type, String fieldName, INativeType fieldType) Append a field to a structure type item.addStructureField(IStructureType type, String fieldName, INativeType fieldType, int offset, int bitsize, int alignment, int flags) Add or append a field or bit field to a structure type item.addStructureField(IStructureType type, String fieldName, String fieldTypeName) Convenience method.voidComplete initialization of a class type.createAlias(String signature, INativeType aliasedType) Create a new alias (typedef) type.createAlias(String signature, String aliasedTypeSignature) Convenience method to create a new alias type.createArray(INativeType baseType, int arraySize) Create a new array type.createArray(INativeType baseType, int arraySize, boolean metadata) Create a new array type.createArray(String baseTypeName, int arraySize) Create a new array type.createClassType(String signature) Create a new class type.createClassType(String signature, int padding, int alignment) Create a new class type.createEnumeration(String signature) Create a new enumeration type.createPrototype(ICallingConvention callingConvention, INativeType returnType, List<INativeType> parameterTypes, Collection<PrototypeAttribute> attributes) Create a new prototype item.createPrototype(INativeType returnType, List<INativeType> parameterTypes) Create a new prototype item with the default calling convention for this manager and no special prototype attribute.createPrototypeEx(ICallingConvention callingConvention, List<INativeType> returnTypes, List<INativeType> parameterTypes, Collection<PrototypeAttribute> attributes) Create a new prototype item.createPrototypeEx(String callingConvention, List<String> returnTypes, List<String> parameterTypes, Collection<PrototypeAttribute> attributes) Create a new prototype item.createReference(INativeType baseType) Create a new simple pointer type.createReference(INativeType baseType, int refCount) Create a new reference (pointer) type.createStructure(String signature) Convenience method.createStructure(String signature, String... nameAndTypes) Convenience method.createStructureOrUnion(String signature, int padding, int alignment) Create a new structure or union type.createUnion(String signature) Convenience method.createVirtualTableDefinition(String vtableStructSig, Long address, Collection<INativeMethodItem> methods) Create a virtual table definition.booleandeleteType(INativeType type) Delete a type.Retrieve the calling convention manager.Retrieve the compiler type associated with this type manager.getExactFloat(int size) Find a floating-point or equivalent type of the exact provided size.getExactInteger(int size, boolean signed) Find an integer or equivalent type of the exact provided size.getInteger(int minsize, boolean signed) Find an integer or equivalent type of at least the provided size.Retrieve a type string parser that can parse type and prototype strings to type and prototype items and register them with this type manager.intGet a pointer size in bytes.Retrieve the primitive types manager.Retrieve the processor type associated with this type manager.Retrieve the prototypes managed by this manager.intGet the size of a stack slot in bytes.Retrieve the subsystem type associated with this type manager.Retrieve a type by effective signature.Retrieve a type by effective signature.Retrieve a type by effective signature.Retrieve the optional type library service (TLS) connected to this manager.getTypes()Retrieve the types currently managed by this manager.getTypes(ISimpleFilter<INativeType> filter) Retrieve the types currently managed by this manager.getVoid()Get the void pseudo-type.Retrieve a pointer to the void pseudo-type.voidremoveListener(INativeItemListener listener) Unregister a listener.booleanremoveStructureField(IStructureType type, IStructureTypeField field) Remove a field from a structure type item.booleanrenameStructureField(IStructureType type, IStructureTypeField field, String newFieldName) Rename a structure field.booleanrenameStructureField(IStructureType type, String fieldName, String newFieldName) Rename a structure field.voidsetClassSuperTypes(IClassType c, Collection<IClassType> supertypes, Collection<IVirtualTableDefinition> vtables) Set up the list of super types and associated virtual tables of a class.voidSet up the (single) virtual table of a class that has no super class.voidverify(INativeType type) Verify that the provided type belongs to this type manager; raise if it's not the case.
-
Method Details
-
addListener
Register a listener relaying events generated by this type manager's type items.- Specified by:
addListenerin interfaceINativeItemListenable- Parameters:
listener- listener to register
-
removeListener
Unregister a listener.- Specified by:
removeListenerin interfaceINativeItemListenable- Parameters:
listener- listener to unregister
-
getProcessorType
ProcessorType getProcessorType()Retrieve the processor type associated with this type manager.- Returns:
- processor type
-
getSubsystemType
SubsystemType getSubsystemType()Retrieve the subsystem type associated with this type manager.- Returns:
- subsystem type, or null
-
getCompilerType
CompilerType getCompilerType()Retrieve the compiler type associated with this type manager.- Returns:
- compiler type, or null
-
getPrimitives
IPrimitiveTypeManager getPrimitives()Retrieve the primitive types manager.- Returns:
- the primitive types manager
-
getCallingConventionManager
ICallingConventionManager getCallingConventionManager()Retrieve the calling convention manager.- Returns:
- the calling convention manager
-
getPointerSize
int getPointerSize()Get a pointer size in bytes.- Returns:
- pointer size in bytes
-
getSlotSize
int getSlotSize()Get the size of a stack slot in bytes. Typically, this would be the size of a general-purpose register.- Returns:
- stack slot size in bytes
-
getTypeLibraryService
TypeLibraryService getTypeLibraryService()Retrieve the optional type library service (TLS) connected to this manager. The TLS is a source of external types of prototypes. If a TLS is present, its types can be transparently imported and retrieved viagetType(String).- Returns:
- the optional TLS
-
getParser
TypeStringParser getParser()Retrieve a type string parser that can parse type and prototype strings to type and prototype items and register them with this type manager.- Returns:
- type string parser
-
getTypes
Collection<INativeType> getTypes()Retrieve the types currently managed by this manager. The following types are not returned:
- reference types (pointers)
- array types
- primitives (they are managed by theprimitive type manager)
- prototypes (seegetPrototypes()- Returns:
- managed type collection
-
getTypes
Retrieve the types currently managed by this manager. The following types are not returned:
- reference types (pointers)
- array types
- primitives (they are managed by theprimitive type manager)
- prototypes (seegetPrototypes()- Parameters:
filter- optional type filter- Returns:
- managed type collection
-
getPrototypes
Collection<IPrototypeItem> getPrototypes()Retrieve the prototypes managed by this manager.- Returns:
- managed prototype collection
-
getType
Retrieve a type by effective signature. The type returned can be one managed by this type manager, a primitive returned by the primitive type manager, or a type imported from the optional TLS, if one is present.- Parameters:
signature- fully-qualified name (original or effective)- Returns:
- the type or null if not found
-
getType
Retrieve a type by effective signature. The type returned can be one managed by this type manager, a primitive returned by the primitive type manager, or a type imported from the optional TLS, if one is present.- Parameters:
signature- fully-qualified name (original or effective)allowImportingFromTypelibs- true to allow importing types- Returns:
- the type or null if not found
-
getType
Retrieve a type by effective signature. The type returned can be one managed by this type manager, a primitive returned by the primitive type manager, or a type imported from the optional TLS, if one is present.- Parameters:
signature- fully-qualified name (original or effective)allowImportingFromTypelibs- true to allow importing typesmayBeRenamed- if false, only original names will be checked- Returns:
- the type or null if not found
-
getInteger
Find an integer or equivalent type of at least the provided size. The returned type may be a primitive or an alias to a primitive.- Parameters:
minsize- minimal size in bytessigned- signedness- Returns:
- integer type, or null if none is available
-
getExactInteger
Find an integer or equivalent type of the exact provided size. The returned type may be a primitive or an alias to a primitive.- Parameters:
size- exact size in bytessigned- signedness- Returns:
- integer type, or null if none is available
-
getExactFloat
Find a floating-point or equivalent type of the exact provided size. The returned type may be a primitive or an alias to a primitive.- Parameters:
size- exact size in bytes- Returns:
- floating-point type, or null if none is available
-
deleteType
Delete a type.- Parameters:
type- type to delete- Returns:
- success indicator
-
createEnumeration
Create a new enumeration type. Enumerated constants can be added after the type is created.- Parameters:
signature- enumeration signature- Returns:
- created enumeration type
-
createStructureOrUnion
Create a new structure or union type. Fields can be added after the type is created.- Parameters:
signature- structure or union signaturepadding- padding in bytes between fields; 0 means that type is a unionalignment- alignment in bytes; the structure/union will have at least that size- Returns:
- created structure or union type
-
createStructure
Convenience method. Create a structure with a padding of 1 byte and no alignment.- Parameters:
signature- structure signature- Returns:
- created structure type
-
createStructure
Convenience method. Create a structure with a padding of 1 byte and no alignment. Add a series of fields as specified by thenameAndTypesparameter.- Parameters:
signature- structure signaturenameAndTypes- sequence of (fieldName, fieldTypeName, ...) for fields- Returns:
- created structure type
-
addStructureField
Convenience method. Append a field to a structure type item.- Parameters:
type- structure typefieldName- field namefieldTypeName- field type- Returns:
- created field, or null
-
addStructureField
Append a field to a structure type item.- Parameters:
type- structure typefieldName- field namefieldType- field type- Returns:
- created field, or null
-
addStructureField
IStructureTypeField addStructureField(IStructureType type, String fieldName, INativeType fieldType, int offset, int bitsize, int alignment, int flags) Add or append a field or bit field to a structure type item.- Parameters:
type- structure typefieldName- field namefieldType- field typeoffset- -1 to append, else, a structure offsetbitsize- optional, used to indicate a bitfieldalignment- optional, in bytesflags- optional, a combination ofFLAG_xxxconstants- Returns:
- created field, or null
-
removeStructureField
Remove a field from a structure type item.- Parameters:
type- structure typefield- field to remove- Returns:
- true if the field was removed
-
renameStructureField
Rename a structure field.- Parameters:
type- structure typefieldName- current field namenewFieldName- new field name- Returns:
- true if the field was renamed
-
renameStructureField
Rename a structure field.- Parameters:
type- structure typefield- field to renamenewFieldName- new field name- Returns:
- true if the field was renamed
-
createUnion
Convenience method. Create a union with no alignment.- Parameters:
signature- union signature- Returns:
- created union type
-
createClassType
Create a new class type.- Parameters:
signature- class type signature- Returns:
- created class type
-
createClassType
Create a new class type.- Parameters:
signature- class type signaturepadding- padding in bytes between fieldsalignment- alignment in bytes- Returns:
- created class type
-
createVirtualTableDefinition
Couple<IVirtualTableDefinition,IMethodTable> createVirtualTableDefinition(String vtableStructSig, Long address, Collection<INativeMethodItem> methods) Create a virtual table definition.- Parameters:
vtableStructSig- signature of the to-be-created structure that will hold the virtual methodsaddress- optional memory address of the virtual table, if concretemethods- list of methods in the virtual table- Returns:
- a couple holding the virtual table definition and backing method table
-
setClassVirtualTable
Set up the (single) virtual table of a class that has no super class. If used,setClassSuperTypes(IClassType, Collection, Collection)cannot be used.- Parameters:
c- class type to updatevtable- mandatory virtual table
-
setClassSuperTypes
void setClassSuperTypes(IClassType c, Collection<IClassType> supertypes, Collection<IVirtualTableDefinition> vtables) Set up the list of super types and associated virtual tables of a class. If used,setClassVirtualTable(IClassType, IVirtualTableDefinition)cannot be used.- Parameters:
c- class typesupertypes- a list of super typesvtables- optional list of virtual tables (may be null)
-
completeClassTypeInitialization
Complete initialization of a class type.- Parameters:
type- class type
-
createAlias
Create a new alias (typedef) type.- Parameters:
signature- alias signaturealiasedType- aliased type- Returns:
- created alias type
-
createAlias
Convenience method to create a new alias type.- Parameters:
signature- alias signaturealiasedTypeSignature- aliased type signature- Returns:
- created alias type
-
getVoid
INativeType getVoid()Get the void pseudo-type.- Returns:
- void pseudo-type
-
getVoidReference
IReferenceType getVoidReference()Retrieve a pointer to the void pseudo-type.- Returns:
- void pointer type
-
createReference
Create a new reference (pointer) type.- Parameters:
baseType- referenced typerefCount- pointer depth- Returns:
- created reference type
-
createReference
Create a new simple pointer type.- Parameters:
baseType- referenced type- Returns:
- created reference type
-
createArray
Create a new array type.- Parameters:
baseTypeName- element type signaturearraySize- number of elements- Returns:
- created array type
-
createArray
Create a new array type.- Parameters:
baseType- type of array elementsarraySize- number of elements- Returns:
- created array type
-
createArray
Create a new array type.- Parameters:
baseType- type of array elementsarraySize- number of elements in this array (must be >= 0)metadata- Indicate that data contains meaningless elements. Internally, theIArrayTypewill have the flagICodeItem.FLAG_TRANSIENTand won't be cached (so it can be modified safely).- Returns:
- created array type
-
createPrototype
Create a new prototype item with the default calling convention for this manager and no special prototype attribute.- Parameters:
returnType- optional; null means void returnparameterTypes- optional; null means no parameter- Returns:
- a new native prototype object
-
createPrototype
IPrototypeItem createPrototype(ICallingConvention callingConvention, INativeType returnType, List<INativeType> parameterTypes, Collection<PrototypeAttribute> attributes) Create a new prototype item.- Parameters:
callingConvention- optional; null means standard calling convention (per this type manager)returnType- optional; null means void returnparameterTypes- optional; null means no parameterattributes- optional- Returns:
- a new native prototype object
-
createPrototypeEx
IPrototypeItem createPrototypeEx(ICallingConvention callingConvention, List<INativeType> returnTypes, List<INativeType> parameterTypes, Collection<PrototypeAttribute> attributes) Create a new prototype item. Multiple return value types may be specified.- Parameters:
callingConvention- optional calling conventionreturnTypes- optional return typesparameterTypes- optional parameter typesattributes- optional prototype attributes- Returns:
- created native prototype object
-
createPrototypeEx
IPrototypeItem createPrototypeEx(String callingConvention, List<String> returnTypes, List<String> parameterTypes, Collection<PrototypeAttribute> attributes) Create a new prototype item.- Parameters:
callingConvention- optional calling convention namereturnTypes- optional return type signaturesparameterTypes- optional parameter type signaturesattributes- optional prototype attributes- Returns:
- created native prototype object
-
verify
Verify that the provided type belongs to this type manager; raise if it's not the case.- Parameters:
type- non-null type- Throws:
JebRuntimeException- if the verification failed
-