FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 03-22-2011, 09:18 PM
Steven Rostedt
 
Default crash-trace-command: Update crash to handle new bprintk format structure

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@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, 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@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-23-2011, 12:57 PM
Steven Rostedt
 
Default crash-trace-command: Update crash to handle new bprintk format structure

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@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",

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

Thread Tools




All times are GMT. The time now is 06:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org