Skip to main content

drmgr_register_bb_app2app_event

Function drmgr_register_bb_app2app_event 

Source
pub unsafe extern "C" fn drmgr_register_bb_app2app_event(
    func: drmgr_xform_cb_t,
    priority: *mut drmgr_priority_t,
) -> bool_
Expand description

Registers a callback function for the first instrumentation stage: application-to-application (“app2app”) transformations on each basic block. drmgr will call \p func as the first of five instrumentation stages for each dynamic application basic block. Examples of app2app transformations include replacing one function with another or replacing one instruction with another throughout an application.

The app2app passes are allowed to modify and insert non-meta (i.e., application) instructions and are intended for application code transformations. These passes should avoid adding meta instructions other than label instructions.

All instrumentation must follow the guidelines for #dr_register_bb_event() with the exception that multiple application control transfer instructions are supported so long as all but one have intra-block \p instr_t targets. This is to support internal control flow that may be necessary for some application-to-application transformations. These control transfer instructions should have a translation set so that later passes know which application address they correspond to. \p drmgr will mark all of the extra non-meta control transfers as meta, and clear their translation fields, right before passing to DynamoRIO, in order to satisfy DynamoRIO’s constraints. This allows all of the instrumentation passes to see these instructions as application instructions, which is how they should be treated.

\return false if the given priority request cannot be satisfied (e.g., \p priority->before is already ordered after \p priority->after) or the given name is already taken.

@param[in] func The callback to be called. @param[in] priority Specifies the relative ordering of the callback. Can be NULL, in which case a default priority is used.