public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] markup_oops.pl and GDB: Let GDB can handle kernel oops stack message
@ 2010-02-22 14:40 Hui Zhu
  2010-02-24 21:15 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Hui Zhu @ 2010-02-22 14:40 UTC (permalink / raw)
  To: Andrew Morton, Arjan van de Ven, ozan, Matthew Wilcox,
	linux-kernel, gdb-patches ml, Michal Marek

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/2] markup_oops.pl and GDB: Let GDB can handle kernel oops stack message
  2010-02-22 14:40 [PATCH 0/2] markup_oops.pl and GDB: Let GDB can handle kernel oops stack message Hui Zhu
@ 2010-02-24 21:15 ` Andrew Morton
  2010-02-25  6:10   ` Hui Zhu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-02-24 21:15 UTC (permalink / raw)
  To: Hui Zhu
  Cc: Arjan van de Ven, ozan, Matthew Wilcox, linux-kernel,
	gdb-patches ml, Michal Marek, Jason Wessel

On Mon, 22 Feb 2010 22:40:16 +0800 Hui Zhu <teawater@gmail.com> wrote:

> 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.

How useful is the kernel patch when one is using an unpatched gdb?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/2] markup_oops.pl and GDB: Let GDB can handle kernel  oops stack message
  2010-02-24 21:15 ` Andrew Morton
@ 2010-02-25  6:10   ` Hui Zhu
  0 siblings, 0 replies; 3+ messages in thread
From: Hui Zhu @ 2010-02-25  6:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arjan van de Ven, ozan, Matthew Wilcox, linux-kernel,
	gdb-patches ml, Michal Marek, Jason Wessel

On Thu, Feb 25, 2010 at 05:15, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Mon, 22 Feb 2010 22:40:16 +0800 Hui Zhu <teawater@gmail.com> wrote:
>
>> 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.
>
> How useful is the kernel patch when one is using an unpatched gdb?
>

For that status, I have 2 ways to handle it:
1.  Change the "target empty" to other target, like "target remote
localhost:1234".
Then the remote target displace the empty target.  It can be use.

2.  In http://lkml.org/lkml/2010/1/3/28, there is a program called
s2c, it can convert some special message to a core file.  Then gdb can
parse core file.
If you think we need it, I can make it input the gdb commands.

Thanks,
Hui

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-25  6:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 14:40 [PATCH 0/2] markup_oops.pl and GDB: Let GDB can handle kernel oops stack message Hui Zhu
2010-02-24 21:15 ` Andrew Morton
2010-02-25  6:10   ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox