vmm: Restrict the maximum number of HW breakpoints

Set the maximum number of HW breakpoints according to the value returned
from `Hypervisor::get_guest_debug_hw_bps()`.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao
2022-08-23 12:00:37 +08:00
committed by Sebastien Boeuf
parent 223b1f6c51
commit d66d64c325
3 changed files with 19 additions and 12 deletions
+8 -1
View File
@@ -272,6 +272,8 @@ pub fn start_vmm_thread(
seccomp_action: &SeccompAction,
hypervisor: Arc<dyn hypervisor::Hypervisor>,
) -> Result<thread::JoinHandle<Result<()>>> {
#[cfg(feature = "gdb")]
let gdb_hw_breakpoints = hypervisor.get_guest_debug_hw_bps();
#[cfg(feature = "gdb")]
let (gdb_sender, gdb_receiver) = std::sync::mpsc::channel();
#[cfg(feature = "gdb")]
@@ -344,7 +346,12 @@ pub fn start_vmm_thread(
#[cfg(feature = "gdb")]
if let Some(debug_path) = debug_path {
let target = gdb::GdbStub::new(gdb_sender, gdb_debug_event, gdb_vm_debug_event);
let target = gdb::GdbStub::new(
gdb_sender,
gdb_debug_event,
gdb_vm_debug_event,
gdb_hw_breakpoints,
);
thread::Builder::new()
.name("gdb".to_owned())
.spawn(move || gdb::gdb_thread(target, &debug_path))