Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ enum EventKind {
KEEPALIVE = 14,
USER_BREAK = 15,
USER_LOG = 16,
CRASH = 17
CRASH = 17,
ENC_UPDATE = 18,
METHOD_UPDATE = 19,
}

enum ModifierKind {
Expand Down Expand Up @@ -1620,6 +1622,9 @@ bool ReceivePacket () {
//EventHandler.Exception (req_id, thread_id, id, loc);
} else if (kind == EventKind.KEEPALIVE) {
events [i] = new EventInfo (etype, req_id) { };
} else if (kind == EventKind.METHOD_UPDATE) {
long id = r.ReadId ();
events[i] = new EventInfo (etype, req_id) { ThreadId = thread_id, Id = id };
} else {
throw new NotImplementedException ("Unknown event kind: " + kind);
}
Expand Down
20 changes: 20 additions & 0 deletions Mono.Debugger.Soft/Mono.Debugger.Soft/EncEvents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

namespace Mono.Debugger.Soft
{
public class MethodUpdateEvent : Event
{
long id;
MethodMirror method;
internal MethodUpdateEvent (VirtualMachine vm, int req_id, long thread_id, long id) : base (EventType.MethodUpdate, vm, req_id, thread_id)
{
this.id = id;
method = vm.GetMethod (id);
method.ClearCachedLocalsDebugInfo ();
}

public MethodMirror GetMethod()
{
return method;
}
}
}
13 changes: 13 additions & 0 deletions Mono.Debugger.Soft/Mono.Debugger.Soft/EventRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,18 @@ protected void CheckMirror (VirtualMachine vm, Mirror m) {
if (vm != m.VirtualMachine)
throw new VMMismatchException ();
}

//Used by EnC
public void UpdateReqId (int id)
{
this.id = id;
enabled = true;
}

public int GetId ()
{
return id;
}

}
}
6 changes: 4 additions & 2 deletions Mono.Debugger.Soft/Mono.Debugger.Soft/EventType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public enum EventType {
//
UserLog = 16,
// Fatal error handling
Crash = 17,
// Not part of the wire protocol
Crash = 17,
EnCUpdate = 18,
MethodUpdate = 19,
// Not part of the wire protocol
VMDisconnect = 99
}
}
11 changes: 11 additions & 0 deletions Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class MethodMirror : Mirror
internal MethodMirror (VirtualMachine vm, long id) : base (vm, id) {
}

public long GetId() {
return id;
}

public string Name {
get {
if (name == null)
Expand Down Expand Up @@ -248,6 +252,13 @@ public ParameterInfoMirror ReturnParameter {
}
}

public void ClearCachedLocalsDebugInfo ()
{
locals = null;
debug_info = null;
locations = null;
}

public LocalScope [] GetScopes () {
vm.CheckProtocolVersion (2, 43);
GetLocals ();
Expand Down
3 changes: 3 additions & 0 deletions Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,9 @@ public void Events (SuspendPolicy suspend_policy, EventInfo[] events) {
case EventType.Crash:
l.Add (new CrashEvent (vm, req_id, thread_id, ei.Dump, ei.Hash));
break;
case EventType.MethodUpdate:
l.Add (new MethodUpdateEvent (vm, req_id, thread_id, id));
break;
}
}

Expand Down
33 changes: 33 additions & 0 deletions Mono.Debugging.Soft/SoftDebuggerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ void ConnectionStarted (VirtualMachine machine)
machine.EnableEvents (EventType.TypeLoad);
}


machine.EnableEvents (EventType.MethodUpdate);

started = true;

/* Wait for the VMStart event */
Expand Down Expand Up @@ -1347,6 +1350,17 @@ void InsertBreakpoint (Breakpoint bp, BreakInfo bi)
InsertBreakpoint (bp, bi, bi.Location.Method, bi.Location.ILOffset);
}

void UpdateBreakpoint (Breakpoint bp, BreakInfo bi)
{
foreach (var req in bi.Requests)
{
req.Key.Disable ();
var request = vm.SetBreakpoint (bi.Location.Method, bi.Location.ILOffset);
req.Key.UpdateReqId (request.GetId());
req.Key.Enabled = bp.Enabled;
}
}

void InsertBreakpoint (Breakpoint bp, BreakInfo bi, MethodMirror method, int ilOffset)
{
EventRequest request;
Expand Down Expand Up @@ -1858,6 +1872,9 @@ void HandleEventSet (EventSet es)
case EventType.UserLog:
HandleUserLogEvents (Array.ConvertAll (es.Events, item => (UserLogEvent)item));
break;
case EventType.MethodUpdate:
HandleMethodUpdateEvents (Array.ConvertAll (es.Events, item => (MethodUpdateEvent)item));
break;
default:
DebuggerLoggingService.LogMessage ("Ignoring unknown debugger event type {0}", type);
break;
Expand Down Expand Up @@ -2391,6 +2408,22 @@ void HandleUserLogEvents (UserLogEvent[] events)
OnTargetDebug (ul.Level, ul.Category, ul.Message);
}

void HandleMethodUpdateEvents(MethodUpdateEvent[] methods)
{
foreach (var method in methods)
{
foreach (var bp in breakpoints) {
if (bp.Value.Location.Method.GetId() == method.GetMethod().GetId())
{
bool dummy = false;
var l = FindLocationByMethod (bp.Value.Location.Method, bp.Value.Location.SourceFile, bp.Value.Location.LineNumber, bp.Value.Location.ColumnNumber, ref dummy);
bp.Value.Location = l;
UpdateBreakpoint ((Breakpoint)bp.Value.BreakEvent, bp.Value);
}
}
}
}

public ObjectMirror GetExceptionObject (ThreadMirror thread)
{
ObjectMirror obj;
Expand Down