The id field of struct ftrace_event_call is different for kernels:
Old kernel uses ftrace_event_call.id
newer kernel uses ftrace_event_call.event.type
Change ftrace_get_event_type_id() and make it serves for different kernels.
Signed-off-by: Lai Jiangshan <laijs(a)cn.fujitsu.com>
---
diff --git a/extensions/trace.c b/extensions/trace.c
index 3697108..1ad53c1 100755
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -878,6 +878,15 @@ int ftrace_get_event_type_id(ulong call, int *id)
if (!inited) {
inited = 1;
id_offset = MEMBER_OFFSET("ftrace_event_call", "id");
+
+ if (id_offset < 0) {
+ /* id = call->event.type */
+ int f1 = MEMBER_OFFSET("ftrace_event_call", "event");
+ int f2 = MEMBER_OFFSET("trace_event", "type");
+
+ if (f1 >= 0 && f2 >= 0)
+ id_offset = f1 + f2;
+ }
}
if (id_offset < 0)
Show replies by date