-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gdb support for mshv guests #327
base: main
Are you sure you want to change the base?
Conversation
This looks great! I noticed the |
Thanks, I forgot about the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! It would be good if @syntactically could review as well
@@ -26,6 +27,7 @@ use event_loop::event_loop_thread; | |||
use gdbstub::conn::ConnectionExt; | |||
use gdbstub::stub::GdbStub; | |||
use gdbstub::target::TargetError; | |||
pub use hyp_debug::{kvm, mshv, GuestMemoryDebug, GuestVcpuDebug}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be pub?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is used in each hypervisor driver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use pub(crate) use hyp_debug::{kvm, mshv, GuestMemoryDebug, GuestVcpuDebug};
instead?
- this is done in preparation of accomodating support for other hypervisors which means some of the functionality whould be common. - moving the debug code to a separate file can enable us to group common behavior in traits Signed-off-by: Doru Blânzeanu <[email protected]>
- also add a trait that contains all the needed methods for interacting with a vCPU Signed-off-by: Doru Blânzeanu <[email protected]>
…ity trait Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
… file - add trait to define common behavior to be used by other hypervisors later Signed-off-by: Doru Blânzeanu <[email protected]>
- it can be done using the generic way to add hw breakpoints - also remove the entry point breakpoint after the vCPU stops to avoid hanging there Signed-off-by: Doru Blânzeanu <[email protected]>
- verify the debug registers that report what kind of exception was triggered - in case there is an unknown reason, report it as a SwBp so that the gdb client can inspect what happened Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
- use checked_sub to avoid issues from addresses that could cause underflow Signed-off-by: Doru Blânzeanu <[email protected]>
- change gdb commands in test to be usable with older gdb versions - change Justfile to provide mshv3 feature - change gdb test to invoke cargo test with correct features for mshv Signed-off-by: Doru Blânzeanu <[email protected]>
Signed-off-by: Doru Blânzeanu <[email protected]>
This PR address the #220 issue.
Additionally, the first 7 commits refactor the existing guest debugging code and moves code from
kvm.rs
to a new file that is to contain the hypervisor specific debugging functionality.