The aim of this class is to comsume CoverageEvent produced by the produce Stalker and generate coverage file for IDA LightHouse, Ghidra DragonDance, ...

Hierarchy

  • CoverageAgent

Constructors

Properties

enabled: boolean = false
events: Map<NativePointer, NativePointer> = ...
flavor: string = "dr"
fname: string = "drcov.dat"
interruptor: InterruptorAgent
onCoverage: any = ...
out: any = null
stops: any = ...
threads: any[] = []
BITS_PER_BYTE: number = 8

Number of bits in a byte

BYTES_PER_U16: number = 2

Number of bytes in an unsigned 16 bit number

BYTES_PER_U32: number = 4

Number of bytes in an unsigned 32 bit number

BYTE_MASK: number = 0xFF

Mask to select the value of a single byte

COLUMN_WIDTH_MODULE_BASE: number = 16

The fixed character width of the module base field output for each module in the coverage header.

COLUMN_WIDTH_MODULE_CHECKSUM: number = 16

The fixed character width of the module checksum field output for each module in the coverage header.

COLUMN_WIDTH_MODULE_END: number = 16

The fixed character width of the module end field output for each module in the coverage header.

COLUMN_WIDTH_MODULE_ENTRY: number = 16

The fixed character width of the module entry field output for each module in the coverage header.

COLUMN_WIDTH_MODULE_ID: number = 3

The fixed character width of the module id field output for each module in the coverage header.

COLUMN_WIDTH_MODULE_TIMESTAMP: number = 8

The fixed character width of the module timestamp field output for each module in the coverage header.

COMPILE_EVENT_END_INDEX: number = 2

The array index of the compile event end field in the StalkerCompileEventFull

COMPILE_EVENT_START_INDEX: number = 1

The array index of the compile event start field in the StalkerCompileEventFull

COMPILE_EVENT_TYPE: string = "compile"

The value of the type field in the StalkerCompileEventFull

COMPILE_EVENT_TYPE_INDEX: number = 0

The array index of the compile event type field in the StalkerCompileEventFull

EVENT_MODULE_OFFSET: number = 6

The byte offset of the module id field within the DRCOV event structure

EVENT_SIZE_OFFSET: number = 4

The byte offset of the size field within the DRCOV event structure

EVENT_START_OFFSET: number = 0

The byte offset of the start field within the DRCOV event structure

EVENT_TOTAL_SIZE: number = 8

The total size in bytes of the DRCOV event structure

Methods

  • Parameters

    • pData: string | number | NativePointer

    Returns NativePointer

  • Function used to covert a coverage event, when called with parameters parsed from StalkerCompileEventFull in the 'onRecevied' function of stalker.

    Parameters

    • start: NativePointer

      The address of the start of the compiled block.

    • end: NativePointer

      The address of the end of the compile block.

    Returns any

  • Function used to emit a coverage event, when called with parameters parsed from StalkerCompileEventFull in the 'onRecevied' function of stalker.

    Parameters

    Returns void

  • Function to emit the header information at the start of the DRCOV coverage information format. Note that the format includes a number of events in the header. This is obviously not ideally suited to streaming data, so we instead write the value of -1. This does not impair the operation of dragondance (which ignores the field), but changes may be required for IDA lighthouse to accept this modification.

    Parameters

    • events: number

      The number of coverage events emitted in the file

    Returns void

  • Function to emit information about a given module into the header information of the DRCOV coverage information format.

    Parameters

    • idx: number

      The index of the module

    • module: Module

      The module information

    Returns void

  • Function to determine whether a coverage event resides in a valid range associated with a given module.

    Parameters

    • base: NativePointer

      The base address of the module

    • start: NativePointer

      The start of the basic block

    • end: NativePointer

      The end of the basic block

    Returns boolean

  • Function to convert an ANSI string into an ArrayBuffer

    Parameters

    • data: string

      The string to convert

    Returns ArrayBuffer

    An array buffer containing the raw string data

  • Function to left pad a string with a repeating pattern. If the pattern is not a multiple of the padding required to make the output the correct length, then the last copy of the padding before the original string will be truncated.

    Parameters

    • data: string

      The input string to be padded

    • length: number

      The required length of the output

    • pad: string

      The value which should be prepended to the string until it is the requested length

    Returns string

    The padded input string, padding to the requested length

  • Function to write a 16-bit value in little-endian format to a given address. Note that DRCOV format data is always in little endian, regardless the endian-ness of the target application.

    Parameters

    • address: NativePointer

      The address at which to write the value

    • value: number

      The value to be written

    Returns void

  • Function to write a 32-bit value in little-endian format to a given address. Note that DRCOV format data is always in little endian, regardless the endian-ness of the target application.

    Parameters

    • address: NativePointer

      The address at which to write the value

    • value: number

      The value to be written

    Returns void

Generated using TypeDoc