freebsd-dev/usr.sbin/bhyve
John Baldwin cd377eb369 Initial debug server for bhyve.
This commit adds a new debug server to bhyve.  Unlike the existing -g
option which provides an efficient connection to a debug server
running in the guest OS, this debug server permits inspection and
control of the guest from within the hypervisor itself without
requiring any cooperation from the guest.  It is similar to the debug
server provided by qemu.

To avoid conflicting with the existing -g option, a new -G option has
been added that accepts a TCP port.  An IPv4 socket is bound to this
port and listens for connections from debuggers.  In addition, if the
port begins with the character 'w', the hypervisor will pause the
guest at the first instruction until a debugger attaches and
explicitly continues the guest.  Note that only a single debugger can
attach to a guest at a time.

Virtual CPUs are exposed to the remote debugger as threads.  General
purpose register values can be read for each virtual CPU.  Other
registers cannot currently be read, and no register values can be
changed by the debugger.

The remote debugger can read guest memory but not write to guest
memory.  To facilitate source-level debugging of the guest, memory
addresses from the debugger are treated as virtual addresses (rather
than physical addresses) and are resolved to a physical address using
the active virtual address translation of the current virtual CPU.
Memory reads should honor memory mapped I/O regions, though the debug
server does not attempt to honor any alignment or size constraints
when accessing MMIO.

The debug server provides limited support for controlling the guest.
The guest is suspended when a debugger is attached and resumes when a
debugger detaches.  A debugger can suspend a guest by sending a Ctrl-C
request (e.g. via Ctrl-C in GDB).  A debugger can also continue a
suspended guest while remaining attached.  Breakpoints are not yet
supported.  Single stepping is supported on Intel CPUs that support
MTRAP VM exits, but is not available on other systems.

While the current debug server has limited functionality, it should
at least be usable for basic debugging now.  It is also a useful
checkpoint to serve as a base for adding additional features.

Reviewed by:	grehan
Differential Revision:	https://reviews.freebsd.org/D15022
2018-05-01 15:17:46 +00:00
..
acpi.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
acpi.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
ahci.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
atkbdc.c Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
atkbdc.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
bhyve.8 Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
bhyvegc.c bhyvegc_resize: make use of reallocarray(3) for bounds-checking. 2017-05-24 14:24:47 +00:00
bhyvegc.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
bhyverun.c Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
bhyverun.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
block_if.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
block_if.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
bootrom.c Restructure memory allocation in bhyve to support "devmem". 2015-06-18 06:00:17 +00:00
bootrom.h Restructure memory allocation in bhyve to support "devmem". 2015-06-18 06:00:17 +00:00
console.c Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
console.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
consport.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
dbgport.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
dbgport.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
fwctl.c Use MIN()/MAX() macros from sys/param.h. 2016-04-22 06:25:32 +00:00
fwctl.h Simple sysctl-like firmware query interface. Similar in operation 2015-10-02 21:09:49 +00:00
gdb.c Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
gdb.h Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
inout.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
inout.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
ioapic.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
ioapic.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
Makefile Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
mem.c Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
mem.h Initial debug server for bhyve. 2018-05-01 15:17:46 +00:00
mevent_test.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
mevent.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
mevent.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
mptbl.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
mptbl.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_ahci.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_e82545.c bhyve/pci_e82545.c: squelch gcc warning for noreturn procedure 2017-07-28 21:42:59 +00:00
pci_emul.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_emul.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_fbuf.c Add VNC Authentication support based on RFC6143 section 7.2.2. 2017-06-02 02:35:16 +00:00
pci_hostbridge.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_irq.c Make PCI interupts allocation static when using bootrom (UEFI). 2016-07-14 17:16:10 +00:00
pci_irq.h Make PCI interupts allocation static when using bootrom (UEFI). 2016-07-14 17:16:10 +00:00
pci_lpc.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_lpc.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_passthru.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_uart.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_virtio_block.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_virtio_console.c Capsicum support for bhyve(8). 2017-02-14 13:35:59 +00:00
pci_virtio_net.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
pci_virtio_rnd.c Capsicum support for bhyve(8). 2017-02-14 13:35:59 +00:00
pci_xhci.c Make comments match the code. No functional change. 2017-04-28 05:09:51 +00:00
pci_xhci.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
pm.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
post.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
ps2kbd.c Implement right shift/ctl, and convert the VNC/xorg scancode 2016-07-11 06:31:15 +00:00
ps2kbd.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
ps2mouse.c Make sure the 'Always-one' bit is always set to one, 2017-01-08 20:29:35 +00:00
ps2mouse.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
rfb.c Check if pthread_create(3) successfully created the thread prior to call 2017-06-16 01:26:01 +00:00
rfb.h Add VNC Authentication support based on RFC6143 section 7.2.2. 2017-06-02 02:35:16 +00:00
rtc.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
rtc.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
smbiostbl.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
smbiostbl.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
sockstream.c Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
sockstream.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
spinup_ap.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
spinup_ap.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
task_switch.c Fix CTASSERT issue in a more clean way 2016-07-06 16:02:15 +00:00
uart_emul.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
uart_emul.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
usb_emul.c Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
usb_emul.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
usb_mouse.c This fixes a typo in bhyve's USB mouse emulation. 2017-03-22 16:53:03 +00:00
vga.c bhyve/vga.c: fix atc_color_select_67 bit shift 2017-07-28 21:47:10 +00:00
vga.h Import bhyve_graphics into CURRENT. Thanks to all who tested 2016-07-04 03:19:06 +00:00
virtio.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
virtio.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
xmsr.c various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
xmsr.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00