qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QEMU-KVM Hardware Breakpoint Handling


From: Arnabjyoti Kalita
Subject: QEMU-KVM Hardware Breakpoint Handling
Date: Wed, 4 May 2022 00:20:27 +0530

Hello all,

I am using QEMU in KVM mode and I have set a hardware breakpoint at a
particular instruction with the help of the ioctl -
KVM_SET_GUEST_DEBUG.

I set it like this -

struct kvm_guest_debug debug = {
     .control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP,
};
debug.arch.debugger[0] = addr;   /* addr of instruction where
breakpoint is set */
debug.arch.debugger[7] = 0x2;

ret = kvm_vcpu_ioctl(cpu, KVM_SET_GUEST_DEBUG, &debug);

When the hardware breakpoint instruction is accessed, the QEMU VM goes
to a paused state. This tells me that the breakpoint was set
correctly. Now, I do not want gdb to be invoked and I would like to
"handle" this breakpoint myself.

I would like to record when the breakpoint was "hit" as well as the
cpu id of the CPU that hit the breakpoint and then let the CPU resume
its normal execution. How would I be able to implement this? Any
pointers would be appreciated.

Thank you very much for all your help.

Best Regards,
Arnabjyoti Kalita



reply via email to

[Prev in Thread] Current Thread [Next in Thread]