Avi Kivity wrote: > Jan Kiszka wrote: >> Avi Kivity wrote: >> >>> Jan Kiszka wrote: >>> >>>> In order to allow the gdbstub of QEMU to push (soft) breakpoint >>>> handling >>>> completely into the gdb frontend, this patch enables guest exits also >>>> for #BP exceptions - in case guest debugging was turned on. >>>> >>>> Along this enhancement, this patch also fixes the flag manipulation for >>>> the singlestep mode. >>>> >>> Suppose userspace determines the exception is due to a guest >>> breakpoint. How does it inject the debug exception? >>> >> >> Good question. Is there no "inject exception #XX" mechanism in kvm yet? >> >> > > No userspace interface for it. The kernel injects plenty > (kvm_queue_exception). > >> Will need this, as my current impression is that we better keep track of >> breakpoints at qemu level to tell guest soft-BPs apart from host >> injected ones. Would you suggest to add a separate IOCTL for exception >> injection then? Or should the new guest debug IOCTL contain a flag that >> signals "inject breakpoint trap" (both for guest soft-BP hits as well as >> guests already in single step mode)? > > A debug specific thing may allow us to limit the generality of the > implementation. > > Or maybe, disable int 3 trapping, single step, reenable int 3 trapping > -> no need to inject vectors. /me is still trying to find explicit statements in the Intel docs about what happens to the TF flag when the CPU enters an interrupt or an exception handler. This influences how single stepping guests can be realized, specifically when trying to step into guest's int3 handling... Jan