DynamoRIO API
trace_entry.h File Reference

DrMemtrace trace entry enum types and definitions. More...

#include <stdint.h>
#include "utils.h"

Macros

#define TRACE_ENTRY_VERSION   1
 

Typedefs

typedef uintptr_t addr_t
 

Enumerations

enum  trace_type_t {
  TRACE_TYPE_READ,
  TRACE_TYPE_WRITE,
  TRACE_TYPE_PREFETCH,
  TRACE_TYPE_PREFETCHT0,
  TRACE_TYPE_PREFETCHT1,
  TRACE_TYPE_PREFETCHT2,
  TRACE_TYPE_PREFETCHNTA,
  TRACE_TYPE_PREFETCH_READ,
  TRACE_TYPE_PREFETCH_WRITE,
  TRACE_TYPE_PREFETCH_INSTR,
  TRACE_TYPE_INSTR,
  TRACE_TYPE_INSTR_DIRECT_JUMP,
  TRACE_TYPE_INSTR_INDIRECT_JUMP,
  TRACE_TYPE_INSTR_CONDITIONAL_JUMP,
  TRACE_TYPE_INSTR_DIRECT_CALL,
  TRACE_TYPE_INSTR_INDIRECT_CALL,
  TRACE_TYPE_INSTR_RETURN ,
  TRACE_TYPE_INSTR_FLUSH ,
  TRACE_TYPE_DATA_FLUSH ,
  TRACE_TYPE_THREAD_EXIT ,
  TRACE_TYPE_HARDWARE_PREFETCH,
  TRACE_TYPE_MARKER,
  TRACE_TYPE_INSTR_NO_FETCH ,
  TRACE_TYPE_INSTR_SYSENTER
}
 
enum  trace_marker_type_t {
  TRACE_MARKER_TYPE_KERNEL_EVENT,
  TRACE_MARKER_TYPE_KERNEL_XFER,
  TRACE_MARKER_TYPE_TIMESTAMP,
  TRACE_MARKER_TYPE_CPU_ID,
  TRACE_MARKER_TYPE_FUNC_ID,
  TRACE_MARKER_TYPE_FUNC_RETADDR,
  TRACE_MARKER_TYPE_FUNC_ARG,
  TRACE_MARKER_TYPE_FUNC_RETVAL
}
 

Functions

static bool type_is_instr (const trace_type_t type)
 
static bool type_is_instr_branch (const trace_type_t type)
 
static bool type_is_prefetch (const trace_type_t type)
 

Detailed Description

DrMemtrace trace entry enum types and definitions.

Macro Definition Documentation

◆ TRACE_ENTRY_VERSION

#define TRACE_ENTRY_VERSION   1

The version of the trace format.

Typedef Documentation

◆ addr_t

typedef uintptr_t addr_t

The type of a memory address.

Enumeration Type Documentation

◆ trace_marker_type_t

The sub-type for TRACE_TYPE_MARKER.

Enumerator
TRACE_MARKER_TYPE_KERNEL_EVENT 

The subsequent instruction is the start of a handler for a kernel-initiated event: a signal handler on UNIX, or an APC, exception, or callback dispatcher on Windows.

TRACE_MARKER_TYPE_KERNEL_XFER 

The subsequent instruction is the target of a system call that changes the context: a signal return on UNIX, or a callback return or NtContinue or NtSetContextThread on Windows.

TRACE_MARKER_TYPE_TIMESTAMP 

The marker value contains a timestamp for this point in the trace, in units of microseconds since Jan 1, 1601 (the UTC time). For 32-bit, the value is truncated to 32 bits.

TRACE_MARKER_TYPE_CPU_ID 

The marker value contains the cpu identifier of the cpu this thread was running on at this point in the trace. A value of (uintptr_t)-1 indicates that the cpu could not be determined.

TRACE_MARKER_TYPE_FUNC_ID 

The marker value contains the function id defined by the user in the -record_function (and -record_heap_value if -record_heap is specified) option.

TRACE_MARKER_TYPE_FUNC_RETADDR 

The marker value contains the return address of the just-entered function, whose id is specified by the closest previous TRACE_MARKER_TYPE_FUNC_ID marker entry.

TRACE_MARKER_TYPE_FUNC_ARG 

The marker value contains one argument value of the just-entered function, whose id is specified by the closest previous TRACE_MARKER_TYPE_FUNC_ID marker entry. The number of such entries for one function invocation is equal to the specified argument in -record_function (or pre-defined functions in -record_heap_value if -record_heap is specified).

TRACE_MARKER_TYPE_FUNC_RETVAL 

The marker value contains the return value of the just-entered function, whose id is specified by the closest previous TRACE_MARKER_TYPE_FUNC_ID marker entry

◆ trace_type_t

The type of a trace entry in a memref_t structure.

Enumerator
TRACE_TYPE_READ 

A data load.

TRACE_TYPE_WRITE 

A data store.

TRACE_TYPE_PREFETCH 

A general prefetch to the level 1 data cache.

TRACE_TYPE_PREFETCHT0 

An x86 prefetch to all levels of the cache.

TRACE_TYPE_PREFETCHT1 

An x86 prefetch to level 1 of the cache.

TRACE_TYPE_PREFETCHT2 

An x86 prefetch to level 2 of the cache.

TRACE_TYPE_PREFETCHNTA 

An x86 non-temporal prefetch.

TRACE_TYPE_PREFETCH_READ 

An ARM load prefetch.

TRACE_TYPE_PREFETCH_WRITE 

An ARM store prefetch.

TRACE_TYPE_PREFETCH_INSTR 

An ARM insruction prefetch.

TRACE_TYPE_INSTR 

A non-branch instruction.

TRACE_TYPE_INSTR_DIRECT_JUMP 

A direct unconditional jump instruction.

TRACE_TYPE_INSTR_INDIRECT_JUMP 

An indirect jump instruction.

TRACE_TYPE_INSTR_CONDITIONAL_JUMP 

A conditional jump instruction.

TRACE_TYPE_INSTR_DIRECT_CALL 

A direct call instruction.

TRACE_TYPE_INSTR_INDIRECT_CALL 

An indirect call instruction.

TRACE_TYPE_INSTR_RETURN 

A return instruction.

TRACE_TYPE_INSTR_FLUSH 

An instruction cache flush.

TRACE_TYPE_DATA_FLUSH 

A data cache flush.

TRACE_TYPE_THREAD_EXIT 

A thread exit.

TRACE_TYPE_HARDWARE_PREFETCH 

A hardware-issued prefetch (generated after tracing by a cache simulator).

TRACE_TYPE_MARKER 

A marker containing metadata about this point in the trace. It includes a marker sub-type trace_marker_type_t and a value.

TRACE_TYPE_INSTR_NO_FETCH 

For core simulators, a trace includes instructions that do not incur instruction cache fetches, such as on each subsequent iteration of a rep string loop on x86.

TRACE_TYPE_INSTR_SYSENTER 

We separate out the x86 sysenter instruction as it has a hardcoded return point that shows up as a discontinuity in the user mode program counter execution sequence.

Function Documentation

◆ type_is_instr()

static bool type_is_instr ( const trace_type_t  type)
inlinestatic

Returns whether the type represents an instruction fetch. Deliberately excludes TRACE_TYPE_INSTR_NO_FETCH and TRACE_TYPE_INSTR_BUNDLE.

◆ type_is_instr_branch()

static bool type_is_instr_branch ( const trace_type_t  type)
inlinestatic

Returns whether the type represents the fetch of a branch instruction.

◆ type_is_prefetch()

static bool type_is_prefetch ( const trace_type_t  type)
inlinestatic

Returns whether the type represents a prefetch request.