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@xxxxxxxxxxx> 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, len; + int addr_is_array = 0; s = symbol_search("__start___trace_bprintk_fmt"); e = symbol_search("__stop___trace_bprintk_fmt"); @@ -3393,10 +3394,8 @@ static int save_ftrace_printk(int fd) bprintk_fmt_e = e->value; count = (bprintk_fmt_e - bprintk_fmt_s) / sizeof(long); - if (count == 0) { - unsigned int size = 0; - return write_and_check(fd, &size, 4); - } + if (count == 0) + goto do_mods; address = malloc(count * sizeof(long)); if (address == NULL) @@ -3417,11 +3416,23 @@ static int save_ftrace_printk(int fd) free(address); + do_mods: + /* Add modules */ b = symbol_search("trace_bprintk_fmt_list"); 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", @@ -3440,15 +3457,20 @@ static int save_ftrace_printk(int fd) if (add_print_address(addr) < 0) goto out_free; + count++; } out_free: - FREEBUF(mod_fmt); out: + if (count == 0) { + unsigned int size = 0; + return write_and_check(fd, &size, 4); + } if (tmp_file_record_size4(fd)) return -1; return tmp_file_flush(fd); + } static int save_ftrace_cmdlines(int fd) -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility