On Wednesday 14 May 2008 14:49:02 Jan Kiszka wrote: > > In Qemu, when exit_reason == KVM_EXIT_DEBUG, it would > > just need to see if that address is for a breakpoint Qemu set or not. If so, > > it's happy. If not, (commence handwaving) tell KVM to forward the debug > > interrupt to the guest. This way, the list of breakpoints is maintained in > > userspace (in the qemu gdb stub), which is nice because it could be > > arbitrarily large. > > Yes, but I would rather pass the debug registers (more general: some > arch dependent state set) back in this slot. Those contain everything > the gdbstub needs to know to catch relevant hardware-BP/watchpoint > events (and report them to the gdb frontend).
But what would the stub *do* with the contents of the debug registers? The only reason they were set is on behalf of the stub in the first place. In fact, in the case of soft breakpoints, KVM doesn't even know where all the set breakpoints are. The only thing KVM needs to report is the address of the breakpoint that was just hit. Sorry if this gets formatted badly: gdb qemu stub KVM break *0xf00 sends Z0 packet 0xf00 0xf00 -> BP list ioctl(KVM_DEBUG, 0xf00) continue ioctl(KVM_RUN) running... breakpoint hit exit_reason = KVM_EXIT_DEBUG kvm_run.debug.address = current PC value search BP list for address bp hit <--- present not present ---> send debug interrupt to guest Notes: - KVM_DEBUG in this case will set a hardware breakpoint. The alternative is to write an int3 into guest memory. - The stub doesn't care how the hardware registers were configured. All it needs to know is a) that a breakpoint was hit, and b) at what address. Does this make sense? -- Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel