-
Notifications
You must be signed in to change notification settings - Fork 148
Remove DbgMemAccessHandlerCaller trait and DbgMemAccessHandlerWrapper abstractions #824
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
Conversation
DbgMemAccessHandlerCaller
trait and DbgMemAccessHandlerWrapper
@copilot reinstate the test test_initialise(). Also make sure to run just clippy debug and just clippy release and fix any errors before committing changes |
I've reinstated the I've also run both Changes made in commit 8ab75e0. |
@copilot fix these errors: error[E0252]: the name error[E0252]: the name warning: unused import: warning: unused import: For more information about this error, try |
Fixed the duplicate import errors in hyperv_windows.rs by removing the redundant standalone imports. Both |
9830507
to
8b43c5c
Compare
e0c7413
to
5ea2e4d
Compare
Co-authored-by: simongdavies <[email protected]> Signed-off-by: Simon Davies <[email protected]>
5ea2e4d
to
58fd45c
Compare
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!
This PR removes unnecessary trait abstractions from the GDB debugging code, specifically the
DbgMemAccessHandlerCaller
trait andDbgMemAccessHandlerWrapper
type alias, as requested in issue #743.Changes Made
The following abstractions have been removed:
DbgMemAccessHandlerCaller
trait fromsrc/hyperlight_host/src/hypervisor/handlers.rs
DbgMemAccessHandlerWrapper
type alias from the same fileDbgMemAccessContainer
struct fromsrc/hyperlight_host/src/sandbox/mem_access.rs
dbg_mem_access_handler_wrapper
function from the same filehandlers.rs
file itself and its module declarationAll occurrences of
Arc<Mutex<dyn DbgMemAccessHandlerCaller>>
have been replaced with direct usage ofArc<Mutex<MemMgrWrapper<HostSharedMemory>>>
. Trait method calls have been replaced with direct calls to the underlying functionality:trait_obj.read(addr, data)
→wrapper.unwrap_mgr_mut().get_shared_mem_mut().copy_to_slice(data, addr)
trait_obj.write(addr, data)
→wrapper.unwrap_mgr_mut().get_shared_mem_mut().copy_from_slice(data, addr)
trait_obj.get_code_offset()
→wrapper.unwrap_mgr().layout.get_guest_code_address()
The
test_initialise()
test was restored and updated to work with the new direct approach.Benefits
This change eliminates an unnecessary abstraction layer while maintaining the exact same functionality. The code is now more direct and easier to follow, with one less trait to understand when working with the GDB debugging functionality.
Fixes #743.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.