Skip to content
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

Add Module.ApplyChanges #342

Merged
merged 2 commits into from
Mar 3, 2021
Merged

Add Module.ApplyChanges #342

merged 2 commits into from
Mar 3, 2021

Conversation

lambdageek
Copy link
Member

@lambdageek lambdageek commented Mar 3, 2021

  • [Mono.Debugger.Soft] add Module.ApplyChanges
  • [Mono.Debugging.Soft] add SoftDebuggerSession.ApplyChanges

Related mono/mono Mono.Debugger.Soft PR: mono/mono#20889
Related dotnet/runtime PR: dotnet/runtime#49043

Contributes to dotnet/runtime#44806

@lambdageek lambdageek marked this pull request as ready for review March 3, 2021 05:04
@lambdageek
Copy link
Member Author

@thaystg @joj

@AlexeiNaabal
Copy link

@lambdageek Could you provide some guidance about how to get the applying ModuleMirror?

The way I test hot reload is by 1. send the delta to a debug session frontend implement, 2. then pass them to ApplyChanges method with a class member which is a SoftDebuggerSession instance. This workflow is not triggered by debug event, I send the delta through named pipe.

Not finding public ways to get ModuleMirror, currently I add a custom method to SoftDebuggerSession to search current loaded AssemblyMirror for the applying one (with the assembly name that I send through named pipe).

Though this workflow worked in my test case, I'm not sure if it is the right way to retrieve the ModuleMirror, since I have to modify the debugger-lib source codes.

@lambdageek
Copy link
Member Author

@AlexeiNaabal I'm not a debugger-libs expert. However, I think you get a ModuleMirror by calling ManifestModule on an AssemblyMirror. You get AssemblyMirrors by collecting them from AssemblyLoadEvents, or by calling GetAssemblies on an AppDomainMirror.

So something like vm.RootDomain.GetAssemblies().Where(am => am.GetName() == someName).First().ManifestModule

@AlexeiNaabal
Copy link

@AlexeiNaabal I'm not a debugger-libs expert. However, I think you get a ModuleMirror by calling ManifestModule on an AssemblyMirror. You get AssemblyMirrors by collecting them from AssemblyLoadEvents, or by calling GetAssemblies on an AppDomainMirror.

So something like vm.RootDomain.GetAssemblies().Where(am => am.GetName() == someName).First().ManifestModule

Thanks for your guidance, I found what I've missed immediately :)

In fact I can at least access the vm.RootDomain within my debugger front-end (which is for delivering the IDE's debug event to the debugger-lib), so I just need to move this GetAssemblies().Where process to my front-end, without touching the source code of 3rd party's library :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants