Running the bhyve hypervisor with gdb or lldb debuger engine
commands: bconfig, bconstruct-tui
% cbsd bconstruct-tui % cbsd bconfig
As an example, we give the situation with this crash NetBSD guest, when you turn on the xhci driver. In this case, we launched a NetBSD virtual machine with the lldb option and got a backtrace that was sent to tech-kern maillist of NetBSD and bugs.freebsd.org
To launch bhyve through debugger, use the menu debug_engine in 'cbsd bconfig' and 'cbsd bconstruct-tui' dialogs.
You can choose your favorite debugger available in FreeBSD: gdb or lldb
The difference in launching through debug_engine from the usual one is that CBSD as a prefix for running bhyve with all the arguments, substituting your chosen debugger. This launch will not take place in the background so that you can see and interact with the debugger interactively.
During the startup process, you will end up in gdb/lldb and you need to execute the 'run' command to start the virtual machine.
If the bhyve process dies, you will have a debugger console where you can at least get a backtrace and attach it to your PR/message, which can help a lot in solving the problem.