Skip to content

Commit 08268b7

Browse files
authored
Add Module.ApplyChanges (#342)
[Mono.Debugger.Soft] add ModuleMirror.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
1 parent 1b5a55a commit 08268b7

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ enum CmdAssembly {
567567

568568
enum CmdModule {
569569
GET_INFO = 1,
570+
APPLY_CHANGES = 2,
570571
}
571572

572573
enum CmdMethod {
@@ -2357,6 +2358,11 @@ internal ModuleInfo Module_GetInfo (long id) {
23572358
return info;
23582359
}
23592360

2361+
2362+
internal void Module_ApplyChanges (long id, long dmeta_id, long dil_id, long dpdb_id) {
2363+
SendReceive (CommandSet.MODULE, (int)CmdModule.APPLY_CHANGES, new PacketWriter().WriteId (id).WriteId (dmeta_id).WriteId (dil_id).WriteId (dpdb_id));
2364+
}
2365+
23602366
/*
23612367
* ASSEMBLY
23622368
*/

Mono.Debugger.Soft/Mono.Debugger.Soft/ModuleMirror.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,13 @@ public string SourceLink {
7070
return info.SourceLink;
7171
}
7272
}
73+
74+
// Apply a hot reload delta to the current module
75+
// Since protocol version 2.60
76+
public void ApplyChanges (ArrayMirror dmeta, ArrayMirror dIL, Value dPDB) {
77+
/* dPDB is Value because it can be ArrayMirror or PrimitiveValue (vm, null) */
78+
vm.CheckProtocolVersion (2, 60);
79+
vm.conn.Module_ApplyChanges (id, dmeta.Id, dIL.Id, dPDB.Id);
80+
}
7381
}
7482
}

Mono.Debugging.Soft/SoftDebuggerSession.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,6 +3304,19 @@ public AssemblyLine[] Disassemble (StackFrame frame, int firstLine, int count)
33043304
return lines.ToArray ();
33053305
}
33063306

3307+
public void ApplyChanges (ModuleMirror module, byte[] metadataDelta, byte[] ilDelta, byte[] pdbDelta = null)
3308+
{
3309+
var rootDomain = VirtualMachine.RootDomain;
3310+
var metadataArray = rootDomain.CreateByteArray (metadataDelta);
3311+
var ilArray = rootDomain.CreateByteArray (ilDelta);
3312+
Value pdbArray;
3313+
if (pdbDelta == null)
3314+
pdbArray = VirtualMachine.CreateValue (null);
3315+
else
3316+
pdbArray = rootDomain.CreateByteArray (pdbDelta);
3317+
3318+
module.ApplyChanges (metadataArray, ilArray, pdbArray);
3319+
}
33073320
static string EscapeString (string text)
33083321
{
33093322
var escaped = new StringBuilder ();

0 commit comments

Comments
 (0)