Table of Contents

Class DotNetBitVectorExtensions

Namespace
Echo.Platforms.AsmResolver.Emulation
Assembly
Echo.Platforms.AsmResolver.dll

Provides methods for manipulating bit vectors that represent managed objects.

public static class DotNetBitVectorExtensions
Inheritance
DotNetBitVectorExtensions
Inherited Members

Methods

AsObjectHandle(BitVector, CilVirtualMachine)

Interprets a bit vector as a reference to an object.

public static ObjectHandle AsObjectHandle(this BitVector objectPointer, CilVirtualMachine machine)

Parameters

objectPointer BitVector

The bit vector containing the reference.

machine CilVirtualMachine

The machine the address is valid in.

Returns

ObjectHandle

The object handle.

Exceptions

ArgumentException

Occurs when the bit vector does not contain a fully known address.

AsObjectHandle(BitVectorSpan, CilVirtualMachine)

Interprets a bit vector as a reference to an object.

public static ObjectHandle AsObjectHandle(this BitVectorSpan objectPointer, CilVirtualMachine machine)

Parameters

objectPointer BitVectorSpan

The bit vector containing the reference.

machine CilVirtualMachine

The machine the address is valid in.

Returns

ObjectHandle

The object handle.

Exceptions

ArgumentException

Occurs when the bit vector does not contain a fully known address.

AsObjectHandle(long, CilVirtualMachine)

Interprets an integer as a reference to an object.

public static ObjectHandle AsObjectHandle(this long objectPointer, CilVirtualMachine machine)

Parameters

objectPointer long

The integer containing the reference.

machine CilVirtualMachine

The machine the address is valid in.

Returns

ObjectHandle

The object handle.

AsStructHandle(BitVector, CilVirtualMachine)

Interprets a bit vector as a reference to a structure.

public static StructHandle AsStructHandle(this BitVector objectPointer, CilVirtualMachine machine)

Parameters

objectPointer BitVector

The integer containing the reference.

machine CilVirtualMachine

The machine the address is valid in.

Returns

StructHandle

The structure handle.

Exceptions

ArgumentException

Occurs when the bit vector does not contain a fully known address.

AsStructHandle(BitVectorSpan, CilVirtualMachine)

Interprets a bit vector as a reference to a structure.

public static StructHandle AsStructHandle(this BitVectorSpan objectPointer, CilVirtualMachine machine)

Parameters

objectPointer BitVectorSpan

The integer containing the reference.

machine CilVirtualMachine

The machine the address is valid in.

Returns

StructHandle

The structure handle.

Exceptions

ArgumentException

Occurs when the bit vector does not contain a fully known address.

AsStructHandle(long, CilVirtualMachine)

Interprets an integer as a reference to a structure.

public static StructHandle AsStructHandle(this long objectPointer, CilVirtualMachine machine)

Parameters

objectPointer long

The integer containing the reference.

machine CilVirtualMachine

The machine the address is valid in.

Returns

StructHandle

The structure handle.

SliceArrayData(BitVectorSpan, ValueFactory)

Interprets the bit vector as the contents of a managed array, and carves out the raw data of all elements.

public static BitVectorSpan SliceArrayData(this BitVectorSpan span, ValueFactory factory)

Parameters

span BitVectorSpan

The bit vector representing the entire managed array.

factory ValueFactory

The object responsible for managing type layouts.

Returns

BitVectorSpan

The slice that contains the raw data of the elements of the array.

SliceArrayElement(BitVectorSpan, ValueFactory, TypeSignature, int)

Interprets the bit vector as the contents of a managed array, and carves out a single element.

public static BitVectorSpan SliceArrayElement(this BitVectorSpan span, ValueFactory factory, TypeSignature elementType, int index)

Parameters

span BitVectorSpan

The bit vector representing the entire managed array.

factory ValueFactory

The object responsible for managing type layouts.

elementType TypeSignature

The type of elements stored in the array.

index int

The index of the element to carve out.

Returns

BitVectorSpan

The slice that contains the raw data of the requested element.

SliceArrayLength(BitVectorSpan, ValueFactory)

Interprets the bit vector as the contents of a managed array, and carves out the length field.

public static BitVectorSpan SliceArrayLength(this BitVectorSpan span, ValueFactory factory)

Parameters

span BitVectorSpan

The bit vector representing the entire managed array.

factory ValueFactory

The object responsible for managing type layouts.

Returns

BitVectorSpan

The slice that contains the length of the array.

SliceObjectData(BitVectorSpan, ValueFactory)

Interprets the bit vector as the contents of a managed object, and carves out the actual object data.

public static BitVectorSpan SliceObjectData(this BitVectorSpan span, ValueFactory factory)

Parameters

span BitVectorSpan

The bit vector representing the entire managed object.

factory ValueFactory

The object responsible for managing type layouts.

Returns

BitVectorSpan

The slice that contains just the object data.

Remarks

This method effectively strips away the header of an object.

SliceObjectField(BitVectorSpan, ValueFactory, IFieldDescriptor)

Interprets the bit vector as object data (including the object header), and carves out a single field from it.

public static BitVectorSpan SliceObjectField(this BitVectorSpan span, ValueFactory factory, IFieldDescriptor field)

Parameters

span BitVectorSpan

The bit vector representing the entire object.

factory ValueFactory

The object responsible for managing type layouts.

field IFieldDescriptor

The field to carve out.

Returns

BitVectorSpan

The slice that contains the raw data of the field.

Exceptions

ArgumentException

Occurs when the provided field has no valid declaring type or could not be resolved.

SliceObjectMethodTable(BitVectorSpan, ValueFactory)

Interprets the bit vector as the contents of a managed object, and carves out the object's method table pointer.

public static BitVectorSpan SliceObjectMethodTable(this BitVectorSpan span, ValueFactory factory)

Parameters

span BitVectorSpan

The bit vector representing the entire managed object.

factory ValueFactory

The object responsible for managing type layouts.

Returns

BitVectorSpan

The slice that contains the pointer to the object's method table.

SliceStringData(BitVectorSpan, ValueFactory)

Interprets the bit vector as a string object, and carves out the characters of the string.

public static BitVectorSpan SliceStringData(this BitVectorSpan span, ValueFactory factory)

Parameters

span BitVectorSpan

The bit vector representing the entire managed string object.

factory ValueFactory

The object responsible for managing type layouts.

Returns

BitVectorSpan

The slice that contains the raw characters of the string.

SliceStringLength(BitVectorSpan, ValueFactory)

Interprets the bit vector as a string object, and carves out the length field.

public static BitVectorSpan SliceStringLength(this BitVectorSpan span, ValueFactory factory)

Parameters

span BitVectorSpan

The bit vector representing the entire managed string object.

factory ValueFactory

The object responsible for managing type layouts.

Returns

BitVectorSpan

The slice that contains the length of the string.

SliceStructField(BitVectorSpan, ValueFactory, IFieldDescriptor)

Interprets the bit vector as a structure, and carves out a single field from it.

public static BitVectorSpan SliceStructField(this BitVectorSpan span, ValueFactory factory, IFieldDescriptor field)

Parameters

span BitVectorSpan

The bit vector representing the entire structure.

factory ValueFactory

The object responsible for managing type layouts.

field IFieldDescriptor

The field to carve out.

Returns

BitVectorSpan

The slice that contains the raw data of the field.

Remarks

When applying this on structures, this function can be used as is. When applying this on objects, make sure the input bit vector does not contain the object header. This header can be stripped away by using e.g. SliceObjectData(BitVectorSpan, ValueFactory) first.

Exceptions

ArgumentException

Occurs when the provided field has no valid declaring type or could not be resolved.