diff options
| author | Dan McDonald <danmcd@joyent.com> | 2021-04-19 16:04:24 -0400 |
|---|---|---|
| committer | Dan McDonald <danmcd@joyent.com> | 2021-04-19 16:04:27 -0400 |
| commit | 2d70679c470f43047fca8f4961628b78912d8041 (patch) | |
| tree | 0ca1cfc5cc9255466310885bdbd13554a9e66dd8 /usr/src/cmd/bhyve/gdb.c | |
| parent | ced4e404c515b8735c4e6d563a547b9a8067c53c (diff) | |
| parent | 2b9481465d6ee67ac62c160dbf79c3ec3348c611 (diff) | |
| download | illumos-joyent-2d70679c470f43047fca8f4961628b78912d8041.tar.gz | |
[illumos-gate merge]
commit 2b9481465d6ee67ac62c160dbf79c3ec3348c611
13674 bhyve upstream sync 2021 March
Conflicts:
usr/src/cmd/bhyve/Makefile
usr/src/cmd/bhyve/bhyverun.c
Diffstat (limited to 'usr/src/cmd/bhyve/gdb.c')
| -rw-r--r-- | usr/src/cmd/bhyve/gdb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/usr/src/cmd/bhyve/gdb.c b/usr/src/cmd/bhyve/gdb.c index 720a55c58b..60b3b8ab6d 100644 --- a/usr/src/cmd/bhyve/gdb.c +++ b/usr/src/cmd/bhyve/gdb.c @@ -135,6 +135,7 @@ static int cur_fd = -1; static TAILQ_HEAD(, breakpoint) breakpoints; static struct vcpu_state *vcpu_state; static int cur_vcpu, stopped_vcpu; +static bool gdb_active = false; const int gdb_regset[] = { VM_REG_GUEST_RAX, @@ -753,6 +754,8 @@ static void _gdb_cpu_suspend(int vcpu, bool report_stop) { + if (!gdb_active) + return; debug("$vCPU %d suspending\n", vcpu); CPU_SET(vcpu, &vcpus_waiting); if (report_stop && CPU_CMP(&vcpus_waiting, &vcpus_suspended) == 0) @@ -771,6 +774,8 @@ void gdb_cpu_add(int vcpu) { + if (!gdb_active) + return; debug("$vCPU %d starting\n", vcpu); pthread_mutex_lock(&gdb_lock); assert(vcpu < guest_ncpus); @@ -852,6 +857,8 @@ gdb_cpu_mtrap(int vcpu) { struct vcpu_state *vs; + if (!gdb_active) + return; debug("$vCPU %d MTRAP\n", vcpu); pthread_mutex_lock(&gdb_lock); vs = &vcpu_state[vcpu]; @@ -892,6 +899,10 @@ gdb_cpu_breakpoint(int vcpu, struct vm_exit *vmexit) uint64_t gpa; int error; + if (!gdb_active) { + fprintf(stderr, "vm_loop: unexpected VMEXIT_DEBUG\n"); + exit(4); + } pthread_mutex_lock(&gdb_lock); error = guest_vaddr2paddr(vcpu, vmexit->rip, &gpa); assert(error == 1); @@ -1931,4 +1942,5 @@ init_gdb(struct vmctx *_ctx, int sport, bool wait) limit_gdb_socket(s); #endif mevent_add(s, EVF_READ, new_connection, NULL); + gdb_active = true; } |
