Slashdot Mirror


Inside the Linux kernel debugger

An anonymous reader writes "Here's a good article that shows you how to install and set up the kernel debugger (KDB) to trace Linux kernel execution and examine memory and data structures. The best part is, you don't need a separate machine for debugging."

16 of 28 comments (clear)

  1. Beos was better. by Anonymous Coward · · Score: 2, Interesting

    BeOS had a nifty debugger that you dropped into instead of BSOD. you could do all sorts of fun things, and it even allowed modules to be loaded to add new debug commands.

  2. The article .. by damaru · · Score: 2, Insightful

    is more of a Intoduction to KDB then an inside thing.

  3. Visual debuggers by ObviousGuy · · Score: 4, Interesting

    I have no doubt that KDB is a powerful debugger, but having a GUI would make it even better, IMO.

    This probably comes from my own experience with OS debuggers and Application debuggers (windbg, VC++/Borland C++). Being able to get immediate feedback about program state without having to enter arcane commands is a definite boon.

    Are there any GUI wrappers available for KDB?

    --
    I have been pwned because my /. password was too easy to guess.
    1. Re:Visual debuggers by weicco · · Score: 2, Interesting

      SoftIce ported on Linux/Unix would be grrrreat. I refused to write any driver code until I got myself a SoftIce in dev-computer at my last job :) Unfortunately SoftIce costs more than family wagon I think.

      --
      You don't know what you don't know.
    2. Re:Visual debuggers by kruntiform · · Score: 2, Insightful

      Huh? All he's saying is that GUI-fied debuggers are nicer than console ones. I've used windbg (one of the ones he mentions) to write and debug kernel-mode drivers on NT. I don't see why you think he hasn't a clue. Just because you use Linux doesn't mean you know everything there is to know about computers!

    3. Re:Visual debuggers by kruntiform · · Score: 2, Insightful

      No, no, debuggers can have GUIs. Kernels can't have GUIs. "Windoze" people generally have strange view of computing? Are you really that much of a zealot, or have I just been trolled?

    4. Re:Visual debuggers by turgid · · Score: 1

      No, I'm a zealot. I stopped using Windoze in 1996 and haven't looked back.

    5. Re:Visual debuggers by turgid · · Score: 1

      Kernel debugger are just that : compiled into the kernel (or have hooks compiled in). They exist in kernel space only and do not interface with any high-level stuff like GUIs. They let you do things like examine the CPU registers (and alter them), look at the page tables, look at the kernel stack, and the kernel data structures in general. For example you can follow the pointers in a process structure, find vnodes and inodes, all kinds of things. You don't want to be going out to a GUI and all the way back down into the kernel to do that (you'll alter the state of the kernel for a start).

    6. Re:Visual debuggers by kruntiform · · Score: 1

      Ok, fair enough. I should have read the article. The kdb debugger is built in to the kernel. My experience with kernel debugging was using a seperate machine over a serial cable. But no one was suggesting adding a GUI to a built-in kernel debugger!

    7. Re:Visual debuggers by kruntiform · · Score: 1

      At home I use w2k as a workstation and FreeBSD as a server and Internet gateway. There are good things in both worlds!

    8. Re:Visual debuggers by turgid · · Score: 1

      I have yet to be convinced.

    9. Re:Visual debuggers by turgid · · Score: 1

      That's one of the differences between UNIX-like systems and WindowsNT systems: you can debug the kernel on the machine you're running on UNIX, but on NT (and hence 2k and XP) you need another machine. I've seen debugging on Linux plus a System VR4-based kernel.

    10. Re:Visual debuggers by kruntiform · · Score: 1

      That's a funny way of classifying things. Your hatred of Windows is sounding really irrational. Not all Unixes have single-machine kernel debugging. Which ones besides Linux do? And SoftICE on Windows allows single machine debugging (or so their blurb says* -- I haven't used it myself). And you didn't account for BeOS (which has a built-in kernel debugger) in your classification scheme ;)

      -------------
      * "Debug kernel-mode drivers with ease
      SoftICE is a powerful kernel mode debugger that supports device driver debugging on either a single or dual machine configuration. "

    11. Re:Visual debuggers by turgid · · Score: 1

      Yeah, I know. I only went on a course once and ran the kernel debugger for a few hours during the course of the week and it was over a year ago. I wrote a small device driver module and watched it execute, passing things up and down a stream. That doesn't really count. I suppose if I'd want to know about a real OS I'd have studied NT like everyone else? For you irony-impared Americans, that was tongue in cheek.

    12. Re:Visual debuggers by Gumpu · · Score: 1

      Don't know about KDB, but gdb, the perl debugger and the java debugger all are wrapped by DDD. DDD is a very fine graphical debugger.
      See http://www.gnu.org/software/ddd/

  4. Much easier to use User-Mode Linux by Ristretto · · Score: 2, Interesting

    We're doing OS research here (UMass) with Linux, and unless you have very specialized needs, you're far better off using User-Mode Linux. By running Linux as a user-process, you don't have to worry about bringing down your machine and you can use gdb to do your debugging.