[Crash-utility] [PATCH 08/12] crash-trace-command: add ftrace_common_fields

Lai Jiangshan laijs at cn.fujitsu.com
Mon Jan 24 09:35:27 UTC 2011


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 at 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:




More information about the Crash-utility mailing list