Method

GumStalkerIteratorput_callout

Declaration [src]

void
gum_stalker_iterator_put_callout (
  GumStalkerIterator* self,
  GumStalkerCallout callout,
  gpointer data,
  GDestroyNotify data_destroy
)

Description [src]

Inserts a call to callout at the current position in the recompiled block. At run time callout is invoked with the live Gum.CpuContext, which it may also modify, making this the most convenient way to run your own C code inline with the traced thread.

Be aware that a callout is relatively expensive: calling out to C means saving and restoring a fair amount of register state to honor the platform’s ABI, on every execution of the instrumented point. For hot paths such as logging, it is often far faster to emit your own instructions directly into the block through the GumStalkerOutput writer instead — for example dedicating a scratch register that points into a buffer you fill as instructions execute and flush at the end of the block. This is considerably harder to get right, but can move performance to a different level. (Even so, a callout is still far cheaper than a tracer that single-steps the CPU.).

Parameters

callout

Type: GumStalkerCallout

Function to call at this point during execution.

data

Type: gpointer

Data to pass to callout.

The argument can be NULL.
The data is owned by the caller of the method.
data_destroy

Type: GDestroyNotify

Destroy notify for data.

The argument can be NULL.