Contains classes and instances related to the description of data types.
The primary use of the classes in this module is to build the type argument ty to the reven2.trace.Context.read and reven2.trace.Context.deref methods, that allow to read a register or part of the memory as a specific data type. For more information on reading as type, please refer to the documentation of the reven2.trace.Context.read method.
This package mainly defines primitive types (such as Bool, F32, U64) as well as type constructors, e.g. classes whose instances are a type, and named, user-defined types constructors such as Structs or Enumerations.
It also provides instance types, such as StructInstance, that represent the result of reading certain types.
Primitives
Boolis the boolean type.U8,U16,U32,U64,U128are unsigned integers of respective size 8, 16, 32 and 64 bits, in the native x86_64 endiannessI8,I16,I32,I64andI128for signed integersUSizeandISizefor (un)signed integers whose size is the same as an address. When using context.read(address, USize), the actual length of the read will depend on whether the context is in 64 or in 32 bits mode.F16,F32andF64are 16, 32 and 64 bits floating point numbers.
Type constructors
FixedWidthIntegerallows to build any size of integers.LittleEndianandBigEndianaccept an integer type as a parameter, and forces its endianness to little or big.Pointertakes a type T as a parameter, and returns type "pointer to T" (T* in C speak). Its main use is with thereven2.trace.Context.derefmethod.Arraytakes a type T and a count as parameters, and returns the type describing a contiguous array of T. T ([T; n]).RawBufferis a specialized version ofArrayon bytes.CStringaccepts a maximum count N, and return the type that designates "NUL-terminated strings of a maximum size N"
User-defined named type constructors
Structrepresents a user-defined, named struct, class or union.Enumerationrepresents a user-defined, named enumeration.
Instance types
StructInstancerepresents the result of reading aStructat some context.EnumerationInstancerepresents the result of reading anEnumerationat some context.ArrayInstancerepresents the result of reading anArrayat some context.PointerInstancerepresents the result of reading aPointerat some context. Note that, for backcompatibility concerns, ctx.read(src, pointer) currently returns an address rather than aPointerInstance.
Special types
ErrorTyperepresents a type that couldn't be built for some reason, stored in itsErrorType.messagemethod.VoidTyperepresents any opaque type that can be stored behind a level of indirection.
Context
Some Type methods accept a context parameter (that defaults to None).
This parameter represents the current context of execution, and should generally be of type reven2.trace.Context.
This parameter is necessary, because the size and value of certain types may depend on the context of execution. For instance, a Pointer is 8 bytes in a 64 bits context, and 4 bytes in a 32 bits context (if its size argument was not specified).
Generally, users of the API should not have to provide explicit values for the context parameter, as the methods of Type objects will be called by the context instance itself rather than directly by the user.
Some types are context-insensitive. This means that their properties will not be affected by the context value passed to the various methods of the type. For context-insensitive types, the is_context_sensitive method will return False, and you can pass any object as context parameter (even None).
| Module | _array |
This module provides the Array type. |
| Module | _declaration |
This module provides several types that represent unresolved types, such as type forward declarations in C. |
| Module | _enum |
This module provides the Enumeration type and associated types. |
| Module | _error |
This module provides the ErrorType type and associated types. |
| Module | _instance |
This module provides the various instance types that represents the result of reading certain types, such as a Struct. |
| Module | _integer |
Provides the Integer types and type constructors operating on integers such as BigEndian as well as the Endianness and Signedness enums. |
| Module | _pointer |
This modules contains the Pointer type. |
| Module | _primitive |
This module defines the primitive types manipulated by the API. |
| Module | _string |
The module defining the CString type and the Encoding enum describing the available encodings. |
| Module | _struct |
The module defining the Struct type and related types. |
| Module | _type |
Module defining the Type class. |
| Module | _typeinfo |
Undocumented |
| Module | _void |
The module containing the void type and its associated error type. |