The sources of both DDB and kgdb are present in the FreeBSD source tree. While the core DDB sources are present in src/sys/ddb, the source to several DDB commands are present in different parts of the kernel sources. The kgdb sources are all found in src/gnu/usr.bin/gdb/kgdb.
The show lock DDB command was added in FreeBSD 6.1. The show proc, show thread, show turnstile, show lockchain, and show sleepchain commands were added in FreeBSD 6.2.
Several recent changes to kgdb will first appear in FreeBSD 6.4 and 7.1. These include the integrated kernel module support as well as the 'tid' command supporting remote targets. Also, while the 'proc' command has been present since 6.0, the 'tid' command first appeared in 7.0.
There are several existing sets of kgdb command files containing various user-defined commands. Some scripts are present in the FreeBSD source tree under the src/tools/debugscripts directory. The scripts at http://www.FreeBSD.org/~jhb/gdbinclude user-defined commands that provide similar functionality to many DDB commands such as ps, lockchain, and sleepchain.