static void gum_allocator_probe_on_leave (GumInvocationListener * listener, GumInvocationContext * context) { GumAllocatorProbe * self = GUM_ALLOCATOR_PROBE_CAST (listener); GumAllocatorProbePrivate * priv = self->priv; FunctionContext * function_ctx; function_ctx = GUM_LINCTX_GET_FUNC_DATA (context, FunctionContext *); if (function_ctx != NULL) { ThreadContext * base_thread_ctx; base_thread_ctx = GUM_LINCTX_GET_FUNC_INVDATA (context, ThreadContext); if (!base_thread_ctx->ignored) { if (function_ctx->handlers.leave_handler != NULL) { function_ctx->handlers.leave_handler (self, base_thread_ctx, context); } } } gum_interceptor_unignore_current_thread (priv->interceptor); }
static void test_function_data_listener_on_enter (GumInvocationListener * listener, GumInvocationContext * context) { TestFunctionDataListener * self = TEST_FUNCTION_DATA_LISTENER (listener); gpointer function_data; TestFuncThreadState * thread_state; TestFuncInvState * invocation_state; function_data = GUM_LINCTX_GET_FUNC_DATA (context, gpointer); thread_state = GUM_LINCTX_GET_THREAD_DATA (context, TestFuncThreadState); if (!thread_state->initialized) { test_function_data_listener_init_thread_state (self, thread_state, function_data); } invocation_state = GUM_LINCTX_GET_FUNC_INVDATA (context, TestFuncInvState); g_strlcpy (invocation_state->arg, (const gchar *) gum_invocation_context_get_nth_argument (context, 0), sizeof (invocation_state->arg)); self->on_enter_call_count++; self->last_on_enter_data.function_data = function_data; self->last_on_enter_data.thread_data = *thread_state; self->last_on_enter_data.invocation_data = *invocation_state; }
static void gum_duk_invocation_listener_on_enter (GumInvocationListener * listener, GumInvocationContext * ic) { GumDukInvocationListener * self = GUM_DUK_INVOCATION_LISTENER_CAST (listener); if (gum_script_backend_is_ignoring ( gum_invocation_context_get_thread_id (ic))) return; if (self->on_enter != NULL) { GumDukInterceptor * module = self->module; GumDukCore * core = module->core; duk_context * ctx = core->ctx; GumDukScope scope; GumDukInvocationContext * jic; GumDukInvocationArgs * args; _gum_duk_scope_enter (&scope, core); jic = _gum_duk_interceptor_obtain_invocation_context (module); _gum_duk_invocation_context_reset (jic, ic); args = gum_duk_interceptor_obtain_invocation_args (module); gum_duk_invocation_args_reset (args, ic); duk_push_heapptr (ctx, self->on_enter); duk_push_heapptr (ctx, jic->object); duk_push_heapptr (ctx, args->object); _gum_duk_scope_call_method (&scope, 1); duk_pop (ctx); gum_duk_invocation_args_reset (args, NULL); gum_duk_interceptor_release_invocation_args (module, args); _gum_duk_invocation_context_reset (jic, NULL); if (self->on_leave != NULL) { *GUM_LINCTX_GET_FUNC_INVDATA (ic, GumDukHeapPtr) = jic; } else { _gum_duk_interceptor_release_invocation_context (module, jic); } _gum_duk_scope_leave (&scope); } }
static void test_function_data_listener_on_leave (GumInvocationListener * listener, GumInvocationContext * context) { TestFunctionDataListener * self = TEST_FUNCTION_DATA_LISTENER (listener); TestFuncThreadState * thread_state; TestFuncInvState * invocation_state; thread_state = GUM_LINCTX_GET_THREAD_DATA (context, TestFuncThreadState); invocation_state = GUM_LINCTX_GET_FUNC_INVDATA (context, TestFuncInvState); self->on_leave_call_count++; self->last_on_leave_data.function_data = GUM_LINCTX_GET_FUNC_DATA (context, gpointer); self->last_on_leave_data.thread_data = *thread_state; self->last_on_leave_data.invocation_data = *invocation_state; }