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   2
 
#define DRMEMTRACE_MODULE_LIST_FILENAME   "modules.log"
 
#define DRMEMTRACE_FUNCTION_LIST_FILENAME   "funclist.log"
 

Typedefs

typedef uintptr_t addr_t
 

Enumerations

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

#define DRMEMTRACE_FUNCTION_LIST_FILENAME   "funclist.log"

The name of the file in -offline mode where function tracing names are written. Use drmemtrace_get_funclist_path() to obtain the full path.

#define DRMEMTRACE_MODULE_LIST_FILENAME   "modules.log"

The name of the file in -offline mode where module data is written. Its creation can be customized using drmemtrace_custom_module_data() and then modified before passing to raw2trace via drmodtrack_add_custom_data() and drmodtrack_offline_write(). Use drmemtrace_get_modlist_path() to obtain the full path.

#define TRACE_ENTRY_VERSION   2

The version of the trace format.

Typedef Documentation

typedef uintptr_t addr_t

The type of a memory address.

Enumeration Type Documentation

Bitfields used to describe the high-level characteristics of both an offline final trace and a raw not-yet-postprocessed trace. In a final trace these are stored in a marker of type TRACE_MARKER_TYPE_FILETYPE.

Enumerator
OFFLINE_FILE_TYPE_FILTERED 

Addresses filtered online.

OFFLINE_FILE_TYPE_INSTRUCTION_ONLY 

Trace has no data references.

OFFLINE_FILE_TYPE_ARCH_AARCH64 

Recorded on AArch64.

OFFLINE_FILE_TYPE_ARCH_ARM32 

Recorded on ARM (32-bit).

OFFLINE_FILE_TYPE_ARCH_X86_32 

Recorded on x86 (32-bit).

OFFLINE_FILE_TYPE_ARCH_X86_64 

Recorded on x86 (64-bit).

OFFLINE_FILE_TYPE_ARCH_ALL 

All possible architecture types.

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 or restartable sequence abort handler on UNIX, or an APC, exception, or callback dispatcher on Windows. The value holds the module offset of the interruption point PC, which is used in post-processing. The value is 0 for some types, namely Windows callbacks and Linux rseq aborts, but these can be assumed to target the start of a block and so there is no loss of accuracy when post-processing.

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_MARKER_TYPE_FILETYPE 

The marker value contains the OFFLINE_FILE_TYPE_* bitfields of type offline_file_type_t identifying the architecture and other key high-level attributes of the trace.

TRACE_MARKER_TYPE_CACHE_LINE_SIZE 

The marker value contains the traced processor's cache line size in bytes.

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.

TRACE_TYPE_PREFETCHT0 

An x86 prefetch to all levels of the cache.

TRACE_TYPE_PREFETCH_READ_L1 

Load prefetch to L1 cache.

TRACE_TYPE_PREFETCHT1 

An x86 prefetch to level 2 cache and higher.

TRACE_TYPE_PREFETCH_READ_L2 

Load prefetch to L2 cache.

TRACE_TYPE_PREFETCHT2 

An x86 prefetch to level 3 cache and higher.

TRACE_TYPE_PREFETCH_READ_L3 

Load prefetch to L3 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.

TRACE_TYPE_PREFETCH_READ_L1_NT 

Non-temporal load prefetch to L1 cache.

TRACE_TYPE_PREFETCH_READ_L2_NT 

Non-temporal load prefetch to L2 cache.

TRACE_TYPE_PREFETCH_READ_L3_NT 

Non-temporal load prefetch to L3 cache.

TRACE_TYPE_PREFETCH_INSTR_L1 

Instr prefetch to L1 cache.

TRACE_TYPE_PREFETCH_INSTR_L1_NT 

Non-temporal instr prefetch to L1 cache.

TRACE_TYPE_PREFETCH_INSTR_L2 

Instr prefetch to L2 cache.

TRACE_TYPE_PREFETCH_INSTR_L2_NT 

Non-temporal instr prefetch to L2 cache.

TRACE_TYPE_PREFETCH_INSTR_L3 

Instr prefetch to L3 cache.

TRACE_TYPE_PREFETCH_INSTR_L3_NT 

Non-temporal instr prefetch to L3 cache.

TRACE_TYPE_PREFETCH_WRITE_L1 

Store prefetch to L1 cache.

TRACE_TYPE_PREFETCH_WRITE_L1_NT 

Non-temporal store prefetch to L1 cache.

TRACE_TYPE_PREFETCH_WRITE_L2 

Store prefetch to L2 cache.

TRACE_TYPE_PREFETCH_WRITE_L2_NT 

Non-temporal store prefetch to L2 cache.

TRACE_TYPE_PREFETCH_WRITE_L3 

Store prefetch to L3 cache.

TRACE_TYPE_PREFETCH_WRITE_L3_NT 

Non-temporal store prefetch to L3 cache.

Function Documentation

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.

static bool type_is_instr_branch ( const trace_type_t  type)
inlinestatic

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

static bool type_is_prefetch ( const trace_type_t  type)
inlinestatic

Returns whether the type represents a prefetch request.