Add missing HwBreakpointOps impl to GdbStub

Migration to gdbstub 0.5.0 broke hardware breakpoints.
(https://crrev.com/c/3071900). This fixes it.

BUG=chromium:1259868
TEST=Manually with `hbreak start_kernel` on a volteer device

Change-Id: I35097b4ad2ec9990e78e68c3274c12ba7a5dbea9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3244555
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
This commit is contained in:
Woody Chow 2021-10-26 15:47:09 +09:00 committed by Commit Bot
parent 4ca0429e8d
commit f5db3e5186

View file

@ -17,7 +17,9 @@ use vm_memory::GuestAddress;
use gdbstub::arch::Arch;
use gdbstub::target::ext::base::singlethread::{ResumeAction, SingleThreadOps, StopReason};
use gdbstub::target::ext::base::{BaseOps, GdbInterrupt};
use gdbstub::target::ext::breakpoints::{Breakpoints, BreakpointsOps, HwBreakpoint};
use gdbstub::target::ext::breakpoints::{
Breakpoints, BreakpointsOps, HwBreakpoint, HwBreakpointOps,
};
use gdbstub::target::TargetError::NonFatal;
use gdbstub::target::{Target, TargetResult};
use gdbstub::Connection;
@ -292,6 +294,12 @@ impl SingleThreadOps for GdbStub {
}
}
impl Breakpoints for GdbStub {
fn hw_breakpoint(&mut self) -> Option<HwBreakpointOps<Self>> {
Some(self)
}
}
impl HwBreakpoint for GdbStub {
/// Add a new hardware breakpoint.
/// Return `Ok(false)` if the operation could not be completed.
@ -346,5 +354,3 @@ impl HwBreakpoint for GdbStub {
}
}
}
impl Breakpoints for GdbStub {}