[PATCH 0/2] markup_oops.pl and GDB: Let GDB can handle kernel oopsstack message
From: Hui Zhu
Date: Mon Feb 22 2010 - 09:40:34 EST
Hi,
I make a patch in http://lkml.org/lkml/2010/1/3/28 to let kernel show
special stack message and convert it to core file when kernel die.
But it need change too much part and other thing make a lot of people
didn't like it.
So I make a patch for markup_oops.pl to make it can convert the oops
message to GDB command.
And make a patch for GDB to add a new target empty which level is same
with corelow target. It can save the memory and reg operation command's
value and send it to GDB as the inferior's value. Then GDB can parse the
oops message directly.
The oops didn't show all the stack message, because it just show
"kstack_depth_to_print" values. To show all the stack value, you need
add kernel commandline "kstack=4096". Because this part have check:
if (kstack_end(stack))
break;
So set kstack_depth_to_print to big number will not affect anything.
For example:
Add "kstack=4096" to kernel commandline. Get the oops message and save
it to a file.
cat ~/tmp/amd64 | perl ./scripts/markup_oops.pl -g -c x86_64- -m
~/tmp/e.ko ~/tmp/vmlinux > ./gc
This line parse the oops message from ~/tmp/amd64 to file ./gc.
gdb -x ./gc
add symbol table from file
"../common_pc_64.glibc_std.standard/export/dist/e.ko" at
.text_addr = 0xffffffffa001b000
#0 init_module () at /home/teawater/study/kernel/stack2core/example/e.c:10
10 buf[0] = 3;
(gdb) bt
#0 init_module () at /home/teawater/study/kernel/stack2core/example/e.c:10
#1 0xffffffff8020903b in do_one_initcall (fn=0xffffffffa001b000
<init_module>)
at
/home/teawater/kernel/common_pc_64.glibc_std.standard/build/linux/init/main.c:737
#2 0xffffffff80261e55 in sys_init_module (umod=0x6905b0, len=50382,
uargs=<value optimized out>)
at
/home/teawater/kernel/common_pc_64.glibc_std.standard/build/linux/kernel/module.c:2385
#3 0xffffffff8020bb0b in ?? ()
at
/home/teawater/kernel/common_pc_64.glibc_std.standard/build/linux/arch/x86/kernel/entry_64.S:359
(gdb) frame 3
#3 0xffffffff8020bb0b in ?? ()
at
/home/teawater/kernel/common_pc_64.glibc_std.standard/build/linux/arch/x86/kernel/entry_64.S:359
359 call *sys_call_table(,%rax,8) # XXX: rip relative
(gdb) frame 2
#2 0xffffffff80261e55 in sys_init_module (umod=0x6905b0, len=50382,
uargs=<value optimized out>)
at
/home/teawater/kernel/common_pc_64.glibc_std.standard/build/linux/kernel/module.c:2385
2385 ret = do_one_initcall(mod->init);
(gdb) list
2380 blocking_notifier_call_chain(&module_notify_list,
2381 MODULE_STATE_COMING, mod);
2382
2383 /* Start the module */
2384 if (mod->init != NULL)
2385 ret = do_one_initcall(mod->init);
2386 if (ret < 0) {
2387 /* Init routine failed: abort. Try to protect us from
2388 buggy refcounters. */
2389 mod->state = MODULE_STATE_GOING;
(gdb) p mod
$1 = (struct module *) 0xffffffffa001b340
Thanks,
Hui
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/