Skip to content

Commit

Permalink
[WIP] Add signposts
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed Sep 20, 2023
1 parent 69d655a commit 9209d3a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/core/swiftapiresolver/runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

#include "gum.h"

#ifdef HAVE_DARWIN
# include <os/signpost.h>

static os_log_t gum_log;
#endif

static gboolean on_match (const GumApiDetails * details, gpointer user_data);

static GumApiResolver * resolver;
Expand All @@ -18,6 +24,11 @@ init (void)

resolver = gum_api_resolver_make ("swift");
g_assert_nonnull (resolver);

#ifdef HAVE_DARWIN
gum_log = os_log_create ("re.frida.gum",
OS_LOG_CATEGORY_POINTS_OF_INTEREST);
#endif
}

void
Expand All @@ -33,8 +44,19 @@ run (const gchar * query)
{
guint num_matches = 0;

#ifdef HAVE_DARWIN
os_signpost_id_t id = os_signpost_id_generate (gum_log);
os_signpost_interval_begin (gum_log, id, "enumerate_matches",
"query='%{public}s'", query);
#endif

gum_api_resolver_enumerate_matches (resolver, query, on_match, &num_matches, NULL);

#ifdef HAVE_DARWIN
os_signpost_interval_end (gum_log, id, "enumerate_matches", "num_matches=%u",
num_matches);
#endif

return num_matches;
}

Expand Down

0 comments on commit 9209d3a

Please sign in to comment.