aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-11-24 22:18:54 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-11-24 22:18:54 -0500
commit8bb6c06444d5f78833b9cab2e288385f34d5fe24 (patch)
tree4ed5f8427bd0fdc12be10265535e1e97dc1e09f5
parent3bb8ccb5259374234647376fbf776f973c39643f (diff)
Let plugins get access to the function map
Added: const char *pevent_find_function(unsigned long long addr) This will find the function name that maps to the address addr. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c11
-rw-r--r--parse-events.h1
-rw-r--r--test_plugin.c6
3 files changed, 16 insertions, 2 deletions
diff --git a/parse-events.c b/parse-events.c
index f7b8bce..9d60443 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -240,6 +240,17 @@ static struct func_map *find_func(unsigned long long addr)
240 return func; 240 return func;
241} 241}
242 242
243const char *pevent_find_function(unsigned long long addr)
244{
245 struct func_map *map;
246
247 map = find_func(addr);
248 if (!map)
249 return NULL;
250
251 return map->func;
252}
253
243int pevent_register_function(char *func, unsigned long long addr, 254int pevent_register_function(char *func, unsigned long long addr,
244 char *mod) 255 char *mod)
245{ 256{
diff --git a/parse-events.h b/parse-events.h
index ff597ef..b4e0422 100644
--- a/parse-events.h
+++ b/parse-events.h
@@ -300,6 +300,7 @@ int pevent_register_event_handler(int id, char *sys_name, char *event_name,
300 pevent_event_handler_func func); 300 pevent_event_handler_func func);
301 301
302struct format_field *pevent_find_field(struct event *event, const char *name); 302struct format_field *pevent_find_field(struct event *event, const char *name);
303const char *pevent_find_function(unsigned long long addr);
303 304
304 305
305/* for debugging */ 306/* for debugging */
diff --git a/test_plugin.c b/test_plugin.c
index 802c7e0..db98c8b 100644
--- a/test_plugin.c
+++ b/test_plugin.c
@@ -42,6 +42,7 @@ static int timer_expire_handler(struct trace_seq *s, void *data, int size,
42static int timer_start_handler(struct trace_seq *s, void *data, int size, 42static int timer_start_handler(struct trace_seq *s, void *data, int size,
43 struct event *event) 43 struct event *event)
44{ 44{
45 const char *func;
45 void *hrtimer; 46 void *hrtimer;
46 void *function; 47 void *function;
47 long long expires; 48 long long expires;
@@ -58,6 +59,7 @@ static int timer_start_handler(struct trace_seq *s, void *data, int size,
58 if (offset < 0) 59 if (offset < 0)
59 return 0; 60 return 0;
60 function = *(void **)(data + offset); 61 function = *(void **)(data + offset);
62 func = pevent_find_function((unsigned long long)function);
61 63
62 offset = get_offset(s, event, "expires"); 64 offset = get_offset(s, event, "expires");
63 if (offset < 0) 65 if (offset < 0)
@@ -69,8 +71,8 @@ static int timer_start_handler(struct trace_seq *s, void *data, int size,
69 return 0; 71 return 0;
70 soft = *(long long *)(data + offset); 72 soft = *(long long *)(data + offset);
71 73
72 ret = trace_seq_printf(s, "hrtimer=%p function=%pf expires=%llu softexpires=%llu", 74 ret = trace_seq_printf(s, "hrtimer=%p function=%s expires=%llu softexpires=%llu",
73 hrtimer, function, 75 hrtimer, func,
74 expires, soft); 76 expires, soft);
75 return ret; 77 return ret;
76} 78}