[Crash-utility] [PATCH 12/12] crash-trace-command: support old kernel that has no print_fmt

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


very old kernel has no print_fmt field, use "Unknown print_fmt"
instead.

Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
diff --git a/extensions/trace.c b/extensions/trace.c
index e04c504..714765e 100755
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -1080,8 +1080,10 @@ int ftrace_get_event_type_print_fmt(ulong call, char **print_fmt)
 		fmt_offset = MEMBER_OFFSET("ftrace_event_call", "print_fmt");
 	}
 
-	if (fmt_offset < 0)
-		return -1;
+	if (fmt_offset < 0) {
+		*print_fmt = strdup("Unknown print_fmt");
+		return 0;
+	}
 
 	if (!readmem(call + fmt_offset, KVADDR, &fmt_addr, sizeof(fmt_addr),
 			"read ftrace_event_call fmt_addr", RETURN_ON_ERROR))




More information about the Crash-utility mailing list