Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Apr 2017 22:15:09 -0700
From:      Anish <akgupt3@gmail.com>
To:        Julian Elischer <julian@freebsd.org>
Cc:        "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>
Subject:   Re: debugging FreeBSD BHyve guest
Message-ID:  <CALnRwMTvdu5Vcw-BHG0_cr=%2B6Bpu7k7-QLLS8Rces8K-UFKF4Q@mail.gmail.com>
In-Reply-To: <be0cadfc-16a3-8068-a1ea-2963cda8bfa4@freebsd.org>
References:  <d7aa8596-e43f-9745-facf-82c4b03d1267@mehnert.org> <be0cadfc-16a3-8068-a1ea-2963cda8bfa4@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I just tested bvmdebug with FreeBSD HEAD and it worked fine.

-Anish

*./vmrun.sh -g 6466 vm1*

*<Guest boots>*

*root@bsdguest:~ # uname -a*

*FreeBSD bsdguest 12.0-CURRENT FreeBSD 12.0-CURRENT #1 r314641M: Sat Apr 15
19:53:23 PDT 2017     root@svmhost:/usr/obj/root/head/sys/BHYVE  amd64*

*root@bsdguest:~ # sysctl debug.kdb.enter=1*

*debug.kdb.enter: 0KDB: enter: sysctl debug.kdb.enter*

*Received ^C; trying to switch back to ddb.*

*using longjmp, hope it works!*

*KDB: reentering*

*KDB: stack backtrace:*

*...*

*Switching to ddb back-end*

*[ thread pid 782 tid 100072 ]*

*Stopped at      kdb_sysctl_enter+0x98:  movq    $0,kdb_why*

*db> gdb*

*(ctrl-c will return control to ddb)*

*Switching to gdb back-end*

-----------------------------------------
>From other terminal

(kgdb) target remote localhost:6466

...

(kgdb) bt

#0  0xffffffff80a8c6b8 in kdb_sysctl_current (oidp=0x0, arg1=0x80,

    arg2=-2198296484032, req=0xfffffe002b51a930)

    at /root/FreeBSD/base/head/sys/kern/subr_kdb.c:146

#1  0xffffffff80a57820 in sysctl_new_user (req=0x100000000,

    p=0xfffffe002b51a930, l=18446741875413067952)

    at /root/FreeBSD/base/head/sys/kern/kern_sysctl.c:1729

#2  0xffffffff80a57016 in sysctl_root (arg1=0x0, arg2=-2120631584)

    at /root/FreeBSD/base/head/sys/kern/kern_sysctl.c:1911

#3  0xffffffff80a575a8 in sys___sysctl (td=<value optimized out>, uap=0x3)

    at /root/FreeBSD/base/head/sys/kern/kern_sysctl.c:1944

#4  0xffffffff80a5741f in sysctl_old_user (req=<value optimized out>,

    p=<value optimized out>, l=<value optimized out>)

    at /root/FreeBSD/base/head/sys/kern/kern_sysctl.c:1718

#5  0xffffffff80ec901a in trap (frame=0x0)

    at /root/FreeBSD/base/head/sys/amd64/amd64/trap.c:569

#6  0xffffffff80eaab1b in Xalign ()

    at /root/FreeBSD/base/head/sys/amd64/amd64/exception.S:164

#7  0x000000080097cb6a in ?? ()

Previous frame inner to this frame (corrupt stack?)

(kgdb)
On Wed, Apr 12, 2017 at 10:14 AM, Julian Elischer <julian@freebsd.org>
wrote:

> On 11/4/17 9:30 pm, Hannes Mehnert wrote:
>
>> Hello,
>>
>> I want to debug a FreeBSD BHyve guest kernel, and tried to follow the
>> instructions on the wiki
>> (https://wiki.freebsd.org/bhyve/DebuggingWithGdb) -- but already the
>> "device bvmdebug" is no longer recognized by make buildkernel.
>>
>
> I hope that is not true. I use it all the time on 10.
>
>
>
>> Is there a way (and a howto?) to kgdb a FreeBSD guest?
>>
>>
>> Thanks,
>>
>> hannes
>> _______________________________________________
>> freebsd-virtualization@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to "freebsd-virtualization-unsubs
>> cribe@freebsd.org"
>>
>>
> _______________________________________________
> freebsd-virtualization@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubs
> cribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALnRwMTvdu5Vcw-BHG0_cr=%2B6Bpu7k7-QLLS8Rces8K-UFKF4Q>