Messages in this thread | | | Date | Fri, 12 Dec 1997 01:11:57 +0100 | From | ralf@uni-kobl ... | Subject | Re: Ideas/Suggestions for 2.2 |
| |
On Thu, Dec 11, 1997 at 09:56:55AM -0800, Ben Woodard wrote:
> Is it concievable to make something like sun's kadb but from the gdb > sources? What kadb does is you boot it instead of the kernel and then > it boots the kernel. Then when when an non maskable interrupt comes, > it drops into kadb rather than rebooting. > > I haven't looked at the linux source yet but I know it is possible to > vector certain keyboard interrupts into the debugger. So I believe it > is possible to do this from linux, however could someone comment on > the feasability of making a kadb type of debugger out of gdb.
For my MIPS hacking PMON, a ROM resident debugger running on an Algorithmics P4032 evaluation board has been a gift sent by higher powers. The kernel crashes, you press the debug button on the board and are in PMON, where you now have things like stack backtraces etc. For example:
PMON> boot indy:/disk2/algor/vmlinux Loading file: indy:/disk2/algor/vmlinux (elf) 0x80020000/1035072 + 0x8011cb40/216840 + 1910 syms\ Entry address is 80020508 PMON> g
Exception Cause=TLBL bi_TagFind+0x20 8c43fff8 lw v1,-8(v0) # 0xfffffff8 PMON> bt bi_TagFind+0x20 () setup_arch+0x78 () start_kernel+0x38 () PMON> boot indy:/disk2/algor/vmlinux Loading file: indy:/disk2/algor/vmlinux (elf) 0x80020000/1034688 + 0x8011c9c0/216840 + 1910 syms- Entry address is 80020508 PMON> g
Nothing happens ... Let's press the debug interrupt button:
Debug Interrupt panic+0x110 08011635 j panic+0x110 # 0x800458d4 panic+0x114 00000000 nop
So, we had a kernel panic. Why the hell? Who was calling panic()? What was the text for panic?
PMON> bt panic+0x110 (0x800f4040,0x8010ad20,0x8010ad24,0x20004801) setup_arch+0x34 () start_kernel+0x38 () PMON> d -s 0x800f4040 Unsupported architecture
That wasn't supposed to happen. Let's take a look at arch/mips/kernel/setup.c:setup_arch():
[...] switch(mips_machgroup) { #ifdef CONFIG_ALGOR_P0432 case MACH_GROUP_ALGORITHMICS: p4032_setup(); break; #endif [...]
So, it was a stupid typo ...
PMON was originally written by IDT; enhancements have been made by other parties and the code is available freely. It's a bit MIPS specific but a lot of it should be portable to other systems for real programmers. The cool thing is that it is ROM based, I rarely had the problem that a kernel bug made the debugger unuseable which I've seen relativly often with kgdb, works over a serial interface and can be interfaced to a full blown gdb - which I never used since I'm actually a fan of printk() for debugging. I use PMON though because it has it's strengths were printk() fails.
Ralf
| |