Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 May 2020 04:25:25 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r360651 - stable/12/usr.sbin/bhyve
Message-ID:  <202005050425.0454PPbl058626@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue May  5 04:25:25 2020
New Revision: 360651
URL: https://svnweb.freebsd.org/changeset/base/360651

Log:
  MFC 355683: Don't call into the debug server if it isn't configured.

Modified:
  stable/12/usr.sbin/bhyve/bhyverun.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/bhyverun.c
==============================================================================
--- stable/12/usr.sbin/bhyve/bhyverun.c	Tue May  5 00:58:03 2020	(r360650)
+++ stable/12/usr.sbin/bhyve/bhyverun.c	Tue May  5 04:25:25 2020	(r360651)
@@ -169,6 +169,7 @@ char *guest_uuid_str;
 
 int raw_stdio = 0;
 
+static int gdb_port = 0;
 static int guest_vmexit_on_hlt, guest_vmexit_on_pause;
 static int virtio_msix = 1;
 static int x2apic_mode = 0;	/* default is xAPIC */
@@ -418,7 +419,8 @@ fbsdrun_start_thread(void *param)
 	snprintf(tname, sizeof(tname), "vcpu %d", vcpu);
 	pthread_set_name_np(mtp->mt_thr, tname);
 
-	gdb_cpu_add(vcpu);
+	if (gdb_port != 0)
+		gdb_cpu_add(vcpu);
 
 	vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip);
 
@@ -692,8 +694,11 @@ vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit
 
 	stats.vmexit_mtrap++;
 
+	if (gdb_port == 0) {
+		fprintf(stderr, "vm_loop: unexpected VMEXIT_MTRAP\n");
+		exit(4);
+	}
 	gdb_cpu_mtrap(*pvcpu);
-
 	return (VMEXIT_CONTINUE);
 }
 
@@ -772,6 +777,10 @@ static int
 vmexit_debug(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
 {
 
+	if (gdb_port == 0) {
+		fprintf(stderr, "vm_loop: unexpected VMEXIT_DEBUG\n");
+		exit(4);
+	}
 	gdb_cpu_suspend(*pvcpu);
 	return (VMEXIT_CONTINUE);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005050425.0454PPbl058626>