Re: bhyve -G <port>

From: Bakul Shah <bakul_at_iitbombay.org>
Date: Wed, 15 Nov 2023 23:06:06 UTC

> On Nov 15, 2023, at 7:57 AM, John Baldwin <jhb@FreeBSD.org> wrote:
> 
> On 10/9/23 5:21 PM, Bakul Shah wrote:
>> Any hints on how to use bhyve's -G <port> option to debug a VM
>> kernel? I can connect to it from gdb with "target remote :<port>"
>> & bhyve stops the VM initially but beyond that I am not sure.
>> Ideally this should work just like an in-circuit-emulator, not
>> requiring anything special in the VM or kernel itself.
> 
> step only works on Intel CPUs currently (and is a bit fragile
> anyway due to interrupts firing while you try to step, but that
> happens for me in QEMU as well).   Breakpoints should work fine.
> I tend to use 'until' to do stepping (basically stepping via
> temporary breakpoints) when debugging the kernel this way.

Thanks for your response!

I can ^C to stop the VM, examine the stack, set breakpoints,
continue etc. but when the breakpoint is hit, kgdb doesn't
regain control -- instead I get the usual

db> ...

prompt on the console. I guess I have to set some sysctl for
this?

Thanks,
Bakul