Skip to content

Glossary

KDP (Kernel Debugger Protocol)

XNU's wire protocol for remote kernel debugging — how lldb talks to a panicked Mac over the network.

KDP — Kernel Debugger Protocol — is XNU's wire protocol for remote kernel debugging. Predates lldb (originally for gdb); now spoken by lldb's kdp-remote plugin.

The protocol:

  • Runs over UDP at the wire level — typically Ethernet, or USB-Ethernet adapters.
  • Packet types: read registers, read memory, write memory, set breakpoint, continue, stop.
  • The kernel is the target, lldb is the client. The kernel never initiates; it only responds.
apple-oss-distributions/xnuosfmk/kdp/kdp.cKDP packet handler — the kernel side of the wire protocol.View on GitHub(line )

When the kernel enters a KDP wait (on panic or NMI):

  • All other CPUs are halted via IPI.
  • No timers fire, no interrupts are honored.
  • The KDP loop polls the network interface in a tight loop, waiting for a debugger packet.

Enable KDP with boot-args:

sudo nvram boot-args="debug=0x141 kdp_match_name=en0"

Then from another Mac on the same network: lldb -o "kdp-remote target.local".

KDP is unencrypted UDP — only enable on development setups, never on a hostile network.

See also: panic, and the kernel debugging article.