pub unsafe extern "C" fn dr_set_mcontext(
drcontext: *mut c_void,
context: *mut dr_mcontext_t,
) -> bool_Expand description
Sets the fields of the application machine context selected by the flags field of \p context to the values in \p context.
This routine may only be called from:
- A clean call invoked by dr_insert_clean_call() or dr_prepare_for_call(). If register reservation code is in use (e.g., via the drreg extension library \ref page_drreg), dr_insert_clean_call_ex() must be used with its flags argument including #DR_CLEANCALL_WRITES_APP_CONTEXT (and possibly #DR_CLEANCALL_MULTIPATH) to ensure proper interaction with register reservations.
- A pre- or post-syscall event (dr_register_pre_syscall_event(), dr_register_post_syscall_event()) dr_register_thread_exit_event())
- A kernel transfer event (dr_register_kernel_xfer_event()) other than #DR_XFER_CALLBACK_RETURN. Here the modified context is the target context of the transfer, not the source (about to be changed) context. For Windows system call event types #DR_XFER_CONTINUE and #DR_XFER_SET_CONTEXT_THREAD, only the portions of the context selected by the application can be changed. The \p flags field of \p context is adjusted to reflect which fields these are. Given the disparity in how Ebp/Rbp is handled (in #DR_MC_INTEGER but in CONTEXT_CONTROL), clients that care about that register are better off using system call events instead of kernel transfer events to take actions on these two system calls. - Basic block or trace creation events (dr_register_bb_event(), dr_register_trace_event()), but for basic block creation only when the basic block callback parameters \p for_trace and \p translating are false, and for trace creation only when \p translating is false.
Ignores the pc field, except for kernel transfer events.
If the size field of \p context is invalid, this routine will return false. A dr_mcontext_t obtained from DR will have the size field set.
The flags field of \p context must be set to select the desired fields for copying, using the dr_mcontext_flags_t values. Asking to copy multimedia registers incurs a higher performance cost. An invalid flags value will return false.
\return whether successful.
\note The xmm fields are only set for processes where the underlying processor supports them (and when DR_MC_MULTIMEDIA is set in the flags field). For dr_insert_clean_call() that requested \p save_fpstate, the xmm values set here override that saved state. Use dr_mcontext_xmm_fields_valid() to determine whether the xmm fields are valid.