kprobe: Introduce lttng_kprobes_match_check
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 1 Mar 2022 15:34:37 +0000 (10:34 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 15 Jul 2024 20:58:48 +0000 (16:58 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iffc9dba158f9802db9f877fabeec288d5072a84c

include/lttng/events-internal.h
src/lttng-kprobes.c

index 14ad198cdbf0441390538ee9bb7f8628b16d2f3b..550c8e45efd1c9f36470a7ec619bae240be61f10 100644 (file)
@@ -1033,6 +1033,8 @@ int lttng_kprobes_register_event(const char *name,
                struct lttng_kernel_event_common *event);
 void lttng_kprobes_unregister_event(struct lttng_kernel_event_common *event);
 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_common *event);
+int lttng_kprobes_match_check(const char *symbol_name, uint64_t offset, uint64_t addr);
+
 #else
 static inline
 int lttng_kprobes_register_event(const char *name,
@@ -1053,6 +1055,11 @@ static inline
 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_common *event)
 {
 }
+static inline
+int lttng_kprobes_match_check(const char *symbol_name, uint64_t offset, uint64_t addr)
+{
+       return -ENOENT;
+}
 #endif
 
 int lttng_event_add_callsite(struct lttng_kernel_event_common *event,
index 11d1d35cd1db520a5617ed29b6810d2f52abb757..b2e96635158241bd80caeb3f2d3ff3e33501264e 100644 (file)
@@ -227,6 +227,21 @@ void lttng_kprobes_unregister_event(struct lttng_kernel_event_common *event)
        unregister_kprobe(&event->priv->u.kprobe.kp);
 }
 
+int lttng_kprobes_match_check(const char *symbol_name, uint64_t offset, uint64_t addr)
+{
+       struct lttng_kprobe lttng_kp;
+       int ret;
+
+       memset(&lttng_kp, 0, sizeof(lttng_kp));
+       ret = _lttng_kprobes_register(symbol_name, offset, addr, &lttng_kp, NULL);
+       if (ret)
+               return -ENOENT;
+       unregister_kprobe(&lttng_kp.kp);
+       kfree(lttng_kp.symbol_name);
+       return 0;
+
+}
+
 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_common *event)
 {
        kfree(event->priv->u.kprobe.symbol_name);
This page took 0.026731 seconds and 4 git commands to generate.