Skip to main content

drreg_get_app_value

Function drreg_get_app_value 

Source
pub unsafe extern "C" fn drreg_get_app_value(
    drcontext: *mut c_void,
    ilist: *mut instrlist_t,
    where_: *mut instr_t,
    app_reg: reg_id_t,
    dst_reg: reg_id_t,
) -> drreg_status_t
Expand description

Inserts instructions at \p where in \p ilist to retrieve the application value for \p app_reg into \p dst_reg. This will automatically be done for reserved registers prior to an application instruction that reads \p app_reg, but sometimes instrumentation needs to read the application value of a register that has been reserved. If \p app_reg is a dead register, #DRREG_ERROR_NO_APP_VALUE may be returned. Set \p conservative in \p drreg_options_t to avoid this error.

If called during drmgr’s insertion phase, \p where must be the current application instruction.

On ARM, asking to place the application value of the register returned by dr_get_stolen_reg() into itself is not supported. Instead the caller should use dr_insert_get_stolen_reg_value() and opnd_replace_reg() to swap the use of the stolen register within a tool instruction with a scratch register.

@return whether successful or an error code on failure.