Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   crash-trace-command: add ftrace_common_fields (http://www.linux-archive.org/crash-utility/480413-crash-trace-command-add-ftrace_common_fields.html)

Lai Jiangshan 01-24-2011 08:35 AM

crash-trace-command: add ftrace_common_fields
 
The newer kernel moves the common fields of event calls to
a "ftrace_common_fields", so we have to do so in crash.

A new function ftrace_init_common_fields() is added,
it uses the newly ftrace_init_event_fields() to init
to common fields.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/extensions/trace.c b/extensions/trace.c
index 34f1be2..f5d67d3 100755
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -652,6 +652,9 @@ static struct event_type *event_type_cache[MAX_CACHE_ID];
static struct event_type **event_types;
static int nr_event_types;

+static struct ftrace_field *ftrace_common_fields;
+static int ftrace_common_fields_count;
+
/*
* TODO: implement event_generic_print_fmt_print() when the print fmt
* in tracing/events/$SYSTEM/$TRACE/format becomes a will-defined
@@ -885,6 +888,21 @@ static int ftrace_init_event_type(ulong call, struct event_type *aevent_type)
&aevent_type->fields);
}

+static int ftrace_init_common_fields(void)
+{
+ ulong ftrace_common_fields_head;
+ struct syment *sp;
+
+ sp = symbol_search("ftrace_common_fields");
+ if (!sp)
+ return 0;
+
+ ftrace_common_fields_head = sp->value;
+
+ return ftrace_init_event_fields(ftrace_common_fields_head ,
+ &ftrace_common_fields_count, &ftrace_common_fields);
+}
+
static void ftrace_destroy_event_types(void)
{
int i, j;
@@ -903,6 +921,7 @@ static void ftrace_destroy_event_types(void)
}

free(event_types);
+ free(ftrace_common_fields);
}

static
@@ -1103,6 +1122,9 @@ static int ftrace_init_event_types(void)
read_value(event, event, list_head, next);
}

+ if (ftrace_init_common_fields() < 0)
+ goto out_fail;
+
return 0;

out_fail_free_aevent_type:

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility


All times are GMT. The time now is 01:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.