The bprintk format structure may change in the near future. Update the
reading of the structure to comply with the change.
Signed-off-by: Steven Rostedt <rostedt(a)goodmis.org>
Index: crash-5.1.3/extensions/trace.c
===================================================================
--- crash-5.1.3.orig/extensions/trace.c
+++ crash-5.1.3/extensions/trace.c
@@ -3383,6 +3383,7 @@ static int save_ftrace_printk(int fd)
long bprintk_fmt_s, bprintk_fmt_e;
long *address;
size_t i, count;
+ int addr_is_array = 0;
s = symbol_search("__start___trace_bprintk_fmt");
e = symbol_search("__stop___trace_bprintk_fmt");
@@ -3422,6 +3423,16 @@ static int save_ftrace_printk(int fd)
if (!b)
goto out;
+ switch (MEMBER_TYPE("trace_bprintk_fmt", "fmt")) {
+ case TYPE_CODE_ARRAY:
+ addr_is_array = 1;
+ break;
+ case TYPE_CODE_PTR:
+ default:
+ /* default not array */
+ break;
+ }
+
mod_fmt = (struct kernel_list_head *)GETBUF(SIZE(list_head));
if (!readmem(b->value, KVADDR, mod_fmt,
SIZE(list_head), "trace_bprintk_fmt_list contents",
@@ -3432,6 +3443,12 @@ static int save_ftrace_printk(int fd)
unsigned long addr;
addr = (unsigned long)mod_fmt->next + SIZE(list_head);
+ if (!addr_is_array) {
+ if (!readmem(addr, KVADDR, &addr, sizeof(addr),
+ "trace_bprintk_fmt_list fmt field",
+ RETURN_ON_ERROR))
+ goto out_free;
+ }
if (!readmem((unsigned long)mod_fmt->next, KVADDR, mod_fmt,
SIZE(list_head), "trace_bprintk_fmt_list contents",