Skip to main content

dr_save_reg

Function dr_save_reg 

Source
pub unsafe extern "C" fn dr_save_reg(
    drcontext: *mut c_void,
    ilist: *mut instrlist_t,
    where_: *mut instr_t,
    reg: reg_id_t,
    slot: dr_spill_slot_t,
)
Expand description

Inserts into \p ilist prior to \p where meta-instruction(s) to save the register \p reg in the spill slot \p slot. See dr_restore_reg(). Use dr_read_saved_reg() and dr_write_saved_reg() to access spill slots from clean calls and restore_state_events (see dr_register_restore_state_event()). \note The stored value remains available only until the next non-meta (i.e. application) instruction. Use dr_insert_write_tls_field() and dr_insert_read_tls_field() for a persistent (but more costly to access) thread-local-storage location. See also dr_raw_tls_calloc().

Generally, using the \ref page_drreg Extension Library instead is recommended. When using custom spills and restores, be sure to look for the labels #DR_NOTE_ANNOTATION and #DR_NOTE_REG_BARRIER at which all application values should be restored to registers.