Kernel debugger

{{Use dmy dates|date=March 2015}}

A kernel debugger is a debugger present in some operating system kernels to ease debugging and kernel development by the kernel developers. A kernel debugger might be a stub implementing low-level operations, with a full-blown debugger such as GNU Debugger (gdb), running on another machine, sending commands to the stub over a serial line or a network connection, or it might provide a command line that can be used directly on the machine being debugged.

Operating systems and operating system kernels that contain a kernel debugger:

  • The Windows NT family includes a kernel debugger named KD,{{cite web|title=Debugging Environments|url=https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debuggers-in-the-debugging-tools-for-windows-package|access-date=2020-02-16|work=Debugging Tools for Windows (WinDbg, KD, CDB, NTSD)}} which can act as a local debugger with limited capabilities (reading and writing kernel memory, and setting breakpoints){{cite web|title=Local Kernel-Mode Debugging|url=https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/performing-local-kernel-debugging|access-date=2020-02-16}} and can attach to a remote machine over a serial line, IEEE 1394 connection, USB 2.0 or USB 3.0 connection.{{cite web|title=Live Kernel-Mode Debugging Using KD|url=https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/performing-kernel-mode-debugging-using-kd|access-date=2020-01-16}} The WinDbg GUI debugger can also be used to debug kernels on local and remote machines.
  • BeOS and Haiku include a kernel debugger usable with either an on-screen console or over a serial line. It features various commands to inspect memory, threads, and other kernel structures. In Haiku, the debugger is called "Kernel Debugging Land" (KDL).{{cite web|title=Welcome to Kernel Debugging Land|url=https://www.haiku-os.org/documents/dev/welcome_to_kernel_debugging_land/}}
  • DragonFly BSD
  • Linux kernel; No kernel debugger was included in the mainline Linux tree prior to version 2.6.26-rc1 because Linus Torvalds didn't want a kernel debugger in the kernel.{{cite web | title=LWN.net | url=https://lwn.net/2000/0914/a/lt-debugger.php3 | accessdate=2008-05-29}}{{cite web | url=https://lwn.net/Articles/280912/ | date=3 May 2008 | first=Linus | last=Torvalds | title=Linux 2.6.26-rc1 | publisher=LWN | accessdate=9 March 2015 }}
  • KDB (local){{cite web|last=Nellitheertha |first=Hariprasad |title=Inside the Linux kernel debugger |website=IBM |url=http://www.ibm.com/developerworks/linux/library/l-kdbug/index.html |accessdate=2008-05-29 |url-status=dead |archiveurl=https://web.archive.org/web/20080621041048/http://www.ibm.com/developerworks/linux/library/l-kdbug/index.html |archivedate=21 June 2008 }}
  • KGDB (remote)
  • MDB (local/remote){{cite web | url=https://lwn.net/Articles/297281/ | title=LWN Weekly Kernel News | date=7 Sep 2008}}{{Cite web|url=https://jeffmerkey.github.io/linux |title=MDB Github Website |date=1 Jan 2016 |url-status=dead |archiveurl=https://web.archive.org/web/20160322085319/http://jeffmerkey.github.io/linux/ |archivedate=22 March 2016 }}{{cite web | url=https://lwn.net/Articles/394146/ | title=LWN Weekly Kernel News | date=28 June 2010}}
  • NetBSD has DDB for local and KGDB for remote.
  • macOS has ddb for local and kdp for remote.{{cite web|quote=the built-in low-level kernel debugger, ddb, is part of XNU's Mach component, and so is kdp, a remote kernel debugging protocol implementation|last=Singh|first=Amit|title=XNU: The Kernel|url=http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html|work=What is Mac OS X?|access-date=2012-05-25|date=December 2003|archive-url=https://web.archive.org/web/20200602233536/http://osxbook.com/book/bonus/ancient/whatismacosx/arch_xnu.html|archive-date=2020-06-02|url-status=dead}}
  • OpenBSD includes ddb which has a syntax is similar to GNU Debugger.{{cite web |url=https://man.openbsd.org/ddb |title=ddb(4) |author= |date=2019-12-06 |website=OpenBSD manual page server |publisher= |access-date=2019-12-13 |quote=The ddb debugger provides a means for debugging the kernel, and analysing the kernel after a system crash ("panic"), with a gdb(1)-like syntax.}}

References