DynamoRIO API
dr_defines.h File Reference

Basic defines and type definitions. More...

#include <windows.h>
#include <winbase.h>
#include <stdarg.h>
#include <sys/types.h>

Data Structures

struct  opnd_t
 
struct  instr_t
 
union  _dr_xmm_t
 
union  _dr_ymm_t
 
union  _dr_zmm_t
 
struct  _dr_mcontext_t
 
struct  dr_time_t
 
struct  _dr_stats_t
 

Macros

#define MAXIMUM_PATH   260
 
#define INVALID_FILE   INVALID_HANDLE_VALUE
 
#define STDOUT   (dr_get_stdout_file())
 
#define STDERR   (dr_get_stderr_file())
 
#define STDIN   (dr_get_stdin_file())
 
#define INVALID_FILE   -1
 
#define STDOUT   our_stdout
 
#define STDERR   our_stderr
 
#define STDIN   our_stdin
 
#define PFX   "%p"
 
#define PIFX   "0x" PIFMT
 
#define PIDFMT   SZFMT
 
#define TIDFMT   SZFMT
 
#define MCXT_NUM_SIMD_SLOTS   32
 
#define PRE_SIMD_PADDING   0
 
#define MCXT_NUM_OPMASK_SLOTS   0
 
#define DR_NOTE_FIRST_RESERVED   0xfffffffffffffff0ULL
 

Typedefs

typedef size_t app_rva_t
 
typedef uint client_id_t
 
typedef union _dr_xmm_t dr_xmm_t
 
typedef union _dr_ymm_t dr_ymm_t
 
typedef union _dr_zmm_t dr_zmm_t
 
typedef uint64 dr_opmask_t
 
typedef struct _dr_mcontext_t dr_mcontext_t
 
typedef struct _dr_stats_t dr_stats_t
 

Enumerations

Functions

union ALIGN_VAR (16) _dr_simd_t
 

Variables

file_t our_stdout
 
file_t our_stderr
 
file_t our_stdin
 

Detailed Description

Basic defines and type definitions.

Macro Definition Documentation

#define DR_NOTE_FIRST_RESERVED   0xfffffffffffffff0ULL

Upper note values are reserved for core DR.

#define INVALID_FILE   INVALID_HANDLE_VALUE

The sentinel value for an invalid file_t.

#define INVALID_FILE   -1

The sentinel value for an invalid file_t.

#define MAXIMUM_PATH   260

Maximum file path length define meant to replace platform-specific defines such as MAX_PATH and PATH_MAX. Currently, internal stack size limits prevent this from being much larger on UNIX.

#define MCXT_NUM_OPMASK_SLOTS   0

Number of 16-64-bit OpMask Kn slots in dr_mcontext_t, \ if architecture supports. \

#define MCXT_NUM_SIMD_SLOTS   32

Number of 128-bit SIMD Vn slots in dr_mcontext_t \

#define PFX   "%p"

printf format code for pointers

#define PIDFMT   SZFMT

printf format code for process_id_t

#define PIFX   "0x" PIFMT

printf format code for pointer-sized integers

#define PRE_SIMD_PADDING   0

Bytes of padding before xmm/ymm dr_mcontext_t slots \

#define STDERR   (dr_get_stderr_file())

The file_t value for standard error.

#define STDERR   our_stderr

The file_t value for standard error.

#define STDIN   (dr_get_stdin_file())

The file_t value for standard input.

The file_t value for standard error.

#define STDIN   our_stdin

The file_t value for standard input.

The file_t value for standard error.

#define STDOUT   (dr_get_stdout_file())

The file_t value for standard output.

#define STDOUT   our_stdout

The file_t value for standard output.

#define TIDFMT   SZFMT

printf format code for thread_id_t

Typedef Documentation

typedef size_t app_rva_t

Application offset from module base. PE32+ modules are limited to 2GB, but not ELF x64 med/large code model.

typedef uint client_id_t

ID used to uniquely identify a client. This value is set at client registration and passed to the client in dr_client_main().

typedef struct _dr_mcontext_t dr_mcontext_t

Machine context structure.

typedef uint64 dr_opmask_t

AVX-512 OpMask (k-)register.

typedef union _dr_xmm_t dr_xmm_t

128-bit XMM register.

typedef union _dr_ymm_t dr_ymm_t

256-bit YMM register.

typedef union _dr_zmm_t dr_zmm_t

512-bit ZMM register.

Enumeration Type Documentation

Values for the flags field of dr_mcontext_t

Enumerator
DR_MC_INTEGER 

On x86, selects the xdi, xsi, xbp, xbx, xdx, xcx, xax, and r8-r15 fields (i.e., all of the general-purpose registers excluding xsp, xip, and xflags). On ARM, selects r0-r12 and r14. On AArch64, selects r0-r30.

DR_MC_CONTROL 

On x86, selects the xsp, xflags, and xip fields. On ARM, selects the sp, pc, and cpsr fields. On AArch64, selects the sp, pc, and nzcv fields.

Note
: The xip/pc field is only honored as an input for dr_redirect_execution(), and as an output for system call events.
DR_MC_MULTIMEDIA 

Selects the simd fields. This flag is ignored unless dr_mcontext_xmm_fields_valid() returns true. If dr_mcontext_xmm_fields_valid() returns false, the application values of the multimedia registers remain in the registers themselves.

DR_MC_ALL 

Selects all fields

Identifies where a thread's control is at any one point. Used with client PC sampling using dr_set_itimer().

Enumerator
DR_WHERE_APP 

Control is in native application code.

DR_WHERE_INTERP 

Control is in basic block building.

DR_WHERE_DISPATCH 

Control is in d_r_dispatch.

DR_WHERE_MONITOR 

Control is in trace building.

DR_WHERE_SYSCALL_HANDLER 

Control is in system call handling.

DR_WHERE_SIGNAL_HANDLER 

Control is in signal handling.

DR_WHERE_TRAMPOLINE 

Control is in trampoline hooks.

DR_WHERE_CONTEXT_SWITCH 

Control is in context switching.

DR_WHERE_IBL 

Control is in inlined indirect branch lookup.

DR_WHERE_FCACHE 

Control is in the code cache.

DR_WHERE_CLEAN_CALLEE 

Control is in a clean call.

DR_WHERE_UNKNOWN 

Control is in an unknown location.

DR_WHERE_LAST 

Equals the count of DR_WHERE_xxx locations.

Function Documentation

union ALIGN_VAR ( 16  )

128-bit ARM SIMD Vn register. In AArch64, align to 16 bytes for better performance. In AArch32, we're not using any uint64 fields here to avoid alignment padding in sensitive structs. We could alternatively use pragma pack.

< Bottom 8 bits of Vn == Bn.

< Bottom 16 bits of Vn == Hn.

< Bottom 32 bits of Vn == Sn.

< Bottom 64 bits of Vn == Dn as d[1]:d[0].

< 128-bit Qn as q[3]:q[2]:q[1]:q[0].

< The full 128-bit register.

Variable Documentation

file_t our_stderr

Allow use of stderr after the application closes it.

file_t our_stdin

Allow use of stdin after the application closes it.

file_t our_stdout

Allow use of stdout after the application closes it.