kgdb with bhyve -G : cannot set debug.kdb.current=gdb

From: jmblqe <jmblqe_at_pm.me>
Date: Fri, 06 Jun 2025 17:35:13 UTC
hello,
i would like to attach kgdb remotely to a FreeBSD 13.5-RELEASE system, as described in in the Handbook and in https://freebsdfoundation.org/wp-content/uploads/2021/11/Kernel_Development_Recipes.pdf
right now i must do this remotely over TCP (with bhyve -G) because the host is a different OS and I don't want to try to do this over serial console in that setting; and for other reasons.

i am unable to solve the following problem:

using kgdb requires the following:

# sysctl debug.kdb.current=gdb

however, gdb is not in "debug.kdb.available", so it returns,

sysctl: debug.kdb.current=gdb: Invalid argument

i have the following added to my kernel config, in addition to other options, like lots of "nodevice", which I think should be harmless:

makeoptions DEBUG=-g
options KDB
options GDB

(i found that it actually is possible to attach with kgdb when debug.kdb.current is empty, but then when i set a breakpoint and reach the breakpoint, there is a panic due to the unhandled breakpoint)

thank you.