Ejemplo n.º 1
0
static void
gum_v8_script_backend_dispose (GObject * object)
{
  GumV8ScriptBackend * self = GUM_V8_SCRIPT_BACKEND (object);
  GumV8ScriptBackendPrivate * priv = self->priv;

  if (priv->debug_handler_data_destroy != NULL)
    priv->debug_handler_data_destroy (priv->debug_handler_data);
  priv->debug_handler = NULL;
  priv->debug_handler_data = NULL;
  priv->debug_handler_data_destroy = NULL;

  g_clear_pointer (&priv->debug_handler_context, g_main_context_unref);

  gum_v8_script_backend_disable_debugger (self);

  if (priv->pending_timeout != NULL)
  {
    g_source_destroy (priv->pending_timeout);
    g_clear_pointer (&priv->pending_timeout, g_source_unref);
  }
  g_clear_pointer (&priv->pending_unignores, g_slist_free);

  g_clear_pointer (&priv->interceptor, g_object_unref);

  g_clear_pointer (&priv->ignored_threads, g_hash_table_unref);

  G_OBJECT_CLASS (gum_v8_script_backend_parent_class)->dispose (object);
}
Ejemplo n.º 2
0
static gboolean
gum_v8_script_backend_do_emit_debug_message (GumEmitDebugMessageData * d)
{
  GumV8ScriptBackend * self = d->backend;
  GumV8ScriptBackendPrivate * priv = self->priv;

  if (priv->debug_handler != NULL)
    priv->debug_handler (d->message, priv->debug_handler_data);

  return FALSE;
}
Ejemplo n.º 3
0
static void
gum_v8_script_backend_dispose (GObject * object)
{
  GumV8ScriptBackend * self = GUM_V8_SCRIPT_BACKEND (object);
  GumV8ScriptBackendPrivate * priv = self->priv;

  if (priv->debug_handler_data_destroy != NULL)
    priv->debug_handler_data_destroy (priv->debug_handler_data);
  priv->debug_handler = NULL;
  priv->debug_handler_data = NULL;
  priv->debug_handler_data_destroy = NULL;

  g_clear_pointer (&priv->debug_handler_context, g_main_context_unref);

  gum_v8_script_backend_disable_debugger (self);

  G_OBJECT_CLASS (gum_v8_script_backend_parent_class)->dispose (object);
}
Ejemplo n.º 4
0
static void
gum_v8_script_backend_set_debug_message_handler (
    GumScriptBackend * backend,
    GumScriptDebugMessageHandler handler,
    gpointer data,
    GDestroyNotify data_destroy)
{
  GumV8ScriptBackend * self = GUM_V8_SCRIPT_BACKEND (backend);
  GumV8ScriptBackendPrivate * priv = self->priv;
  GMainContext * old_context, * new_context;

  if (priv->debug_handler_data_destroy != NULL)
    priv->debug_handler_data_destroy (priv->debug_handler_data);

  priv->debug_handler = handler;
  priv->debug_handler_data = data;
  priv->debug_handler_data_destroy = data_destroy;

  new_context = (handler != NULL) ? g_main_context_ref_thread_default () : NULL;

  GUM_V8_SCRIPT_BACKEND_LOCK ();
  old_context = priv->debug_handler_context;
  priv->debug_handler_context = new_context;
  GUM_V8_SCRIPT_BACKEND_UNLOCK ();

  if (old_context != NULL)
    g_main_context_unref (old_context);

  gum_script_scheduler_push_job_on_js_thread (
      gum_v8_script_backend_get_scheduler (self),
      G_PRIORITY_DEFAULT,
      (handler != NULL)
          ? (GumScriptJobFunc) gum_v8_script_backend_enable_debugger
          : (GumScriptJobFunc) gum_v8_script_backend_disable_debugger,
      self, NULL, self);
}