DynamoRIO
|
DrMemtrace trace entry enum types and definitions. More...
#include <stdint.h>
#include "utils.h"
Data Structures | |
struct | _trace_entry_t |
Macros | |
#define | DRMEMTRACE_MODULE_LIST_FILENAME "modules.log" |
#define | DRMEMTRACE_FUNCTION_LIST_FILENAME "funclist.log" |
#define | DRMEMTRACE_ENCODING_FILENAME "encodings.bin" |
#define | DRMEMTRACE_SERIAL_SCHEDULE_FILENAME "serial_schedule.bin" |
#define | DRMEMTRACE_CPU_SCHEDULE_FILENAME "cpu_schedule.bin.zip" |
Typedefs | |
typedef uintptr_t | addr_t |
typedef struct _trace_entry_t | trace_entry_t |
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_instr_direct_branch (const trace_type_t type) |
static bool | type_is_instr_conditional_branch (const trace_type_t type) |
static bool | type_is_prefetch (const trace_type_t type) |
static bool | type_has_address (const trace_type_t type) |
Detailed Description
DrMemtrace trace entry enum types and definitions.
Macro Definition Documentation
◆ DRMEMTRACE_CPU_SCHEDULE_FILENAME
#define DRMEMTRACE_CPU_SCHEDULE_FILENAME "cpu_schedule.bin.zip" |
The name of the archive file in -offline mode where the cpu thread schedule is written during post-processing. A separate sub-archive is written for each cpu.
◆ DRMEMTRACE_ENCODING_FILENAME
#define DRMEMTRACE_ENCODING_FILENAME "encodings.bin" |
The name of the file in -offline mode where non-module instruction encodings are written. Use drmemtrace_get_encoding_path() to obtain the full path.
◆ DRMEMTRACE_FUNCTION_LIST_FILENAME
#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.
◆ DRMEMTRACE_MODULE_LIST_FILENAME
#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.
◆ DRMEMTRACE_SERIAL_SCHEDULE_FILENAME
#define DRMEMTRACE_SERIAL_SCHEDULE_FILENAME "serial_schedule.bin" |
The base name of the file in -offline mode where the serial thread schedule is written during post-processing. A compression suffix may be appended.
Typedef Documentation
◆ addr_t
typedef uintptr_t addr_t |
The type of a memory address.
◆ trace_entry_t
typedef struct _trace_entry_t trace_entry_t |
See _trace_entry_t.
Enumeration Type Documentation
◆ offline_file_type_t
enum offline_file_type_t |
Bitfields used to describe the high-level characteristics of both an offline final trace and a raw not-yet-postprocessed trace, as well as (despite the OFFLINE_ prefix) an online trace. In a final trace these are stored in a marker of type TRACE_MARKER_TYPE_FILETYPE.
Enumerator | |
---|---|
OFFLINE_FILE_TYPE_FILTERED | DEPRECATED: Addresses filtered online. Newer trace files use OFFLINE_FILE_TYPE_IFILTERED and OFFLINE_FILE_TYPE_DFILTERED. |
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. |
OFFLINE_FILE_TYPE_IFILTERED | Instruction addresses filtered online. |
OFFLINE_FILE_TYPE_DFILTERED | Data addresses filtered online. |
OFFLINE_FILE_TYPE_ENCODINGS | Instruction encodings are included. |
◆ trace_marker_type_t
enum 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 or restartable sequence abort handler on UNIX, or an APC, exception, or callback dispatcher on Windows. The value of this marker contains the program counter at the kernel interruption point. If the interruption point is just after a branch, this value is the target of that branch. (For trace version TRACE_ENTRY_VERSION_NO_KERNEL_PC or below, the value is the module offset rather than the absolute program counter.) The value is 0 for some types where this information is not available, namely Windows callbacks. A restartable sequence abort handler is further identified by a prior marker of type TRACE_MARKER_TYPE_RSEQ_ABORT. |
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. This value contains what the operating system set up. For Linux, the bottom 12 bits hold the cpu identifier and the upper bits hold the socket/node number. |
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. |
TRACE_MARKER_TYPE_INSTRUCTION_COUNT | The marker value contains the count of dynamic instruction executions in this software thread since the start of the trace. This marker type is only present in online-cache-filtered traces and is placed at thread exit. |
TRACE_MARKER_TYPE_VERSION | The marker value contains the version of the trace format: a value of type trace_version_t. The marker is present in the first few entries of a trace file. |
TRACE_MARKER_TYPE_RSEQ_ABORT | Serves to further identify TRACE_MARKER_TYPE_KERNEL_EVENT as a restartable sequence abort handler. This will always be immediately followed by TRACE_MARKER_TYPE_KERNEL_EVENT. |
TRACE_MARKER_TYPE_WINDOW_ID | Identifies in the marker value the ordinal of a window during a multi-window tracing run (see the options -trace_for_instrs and -retrace_every_instrs). When a marker with an ordinal value different from the last-seen marker appears, a time gap may exist immediately before this new marker. |
TRACE_MARKER_TYPE_PHYSICAL_ADDRESS | The marker value contains the physical address corresponding to the subsequent TRACE_MARKER_TYPE_VIRTUAL_ADDRESS's virtual address. A pair of such markers will appear somewhere prior to a regular instruction fetch or data load or store whose page's physical address has not yet been reported, or when a physical mapping change is detected. If translation failed, a TRACE_MARKER_TYPE_PHYSICAL_ADDRESS_NOT_AVAILABLE will be present instead, without a corresponding TRACE_MARKER_TYPE_VIRTUAL_ADDRESS. |
TRACE_MARKER_TYPE_PHYSICAL_ADDRESS_NOT_AVAILABLE | Indicates a failure to obtain the physical address corresponding to the virtual address contained in the marker value. |
TRACE_MARKER_TYPE_VIRTUAL_ADDRESS | The marker value contains the virtual address corresponding to the prior TRACE_MARKER_TYPE_PHYSICAL_ADDRESS's physical address. A pair of such markers will appear somewhere prior to a regular instruction fetch or data load or store whose page's physical address has not yet been reported, or when a physical mapping change is detected. If translation failed, a TRACE_MARKER_TYPE_PHYSICAL_ADDRESS_NOT_AVAILABLE will be present instead, without a corresponding TRACE_MARKER_TYPE_VIRTUAL_ADDRESS. |
TRACE_MARKER_TYPE_PAGE_SIZE | The marker value contains the traced process's page size in bytes. |
TRACE_MARKER_TYPE_SYSCALL_ID | This marker is emitted prior to each system call when -enable_kernel_tracing is specified. The marker value contains a unique system call identifier. |
TRACE_MARKER_TYPE_CHUNK_INSTR_COUNT | This top-level marker identifies the instruction count in each chunk of the output file. This is the granularity of a fast seek. |
TRACE_MARKER_TYPE_CHUNK_FOOTER | Marks the end of a chunk. The final chunk does not have such a marker but instead relies on the TRACE_TYPE_FOOTER entry. |
TRACE_MARKER_TYPE_RECORD_ORDINAL | Indicates the record ordinal for this point in the trace. This is used to identify the visible record ordinal when skipping over chunks, and is not exposed to analysis tools. |
TRACE_MARKER_TYPE_FILTER_ENDPOINT | Indicates a point in the trace where filtering ended. This is currently added by the record_filter tool to annotate when the warmup part of the trace ends. |
◆ trace_type_t
enum 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. |
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_FOOTER | The final entry in an offline file or a pipe. Not exposed to tools. |
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. |
◆ trace_version_t
enum trace_version_t |
The version number of the trace format. This is presented to analysis tools as a marker of type TRACE_MARKER_TYPE_VERSION.
Enumerator | |
---|---|
TRACE_ENTRY_VERSION_NO_KERNEL_PC | A prior version where TRACE_MARKER_TYPE_KERNEL_EVENT provided the module offset (and nothing for restartable sequence aborts) rather than the absolute PC of the interruption point provided today. |
TRACE_ENTRY_VERSION_KERNEL_PC | TRACE_MARKER_TYPE_KERNEL_EVENT records provide the absolute PC of the interruption point. |
TRACE_ENTRY_VERSION_ENCODINGS | The trace supports embedded instruction encodings, but they are only present if OFFLINE_FILE_TYPE_ENCODINGS is set. |
TRACE_ENTRY_VERSION | The latest version of the trace format. |
Function Documentation
◆ type_has_address()
|
inlinestatic |
Returns whether the type contains an address.
◆ type_is_instr()
|
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()
|
inlinestatic |
Returns whether the type represents the fetch of a branch instruction.
◆ type_is_instr_conditional_branch()
|
inlinestatic |
Returns whether the type represents the fetch of a conditional branch instruction.
◆ type_is_instr_direct_branch()
|
inlinestatic |
Returns whether the type represents the fetch of a direct branch instruction.
◆ type_is_prefetch()
|
inlinestatic |
Returns whether the type represents a prefetch request.