Permalink
Browse files

Set and honor default suspend policies for different event types.

Throw the correct exception on ERR_UNLOADED.
  • Loading branch information...
1 parent d0d8eea commit 913695f6d160eaa910b29a861018fe4c3e3c5ace @Tak Tak committed Apr 2, 2012
Showing with 23 additions and 1 deletion.
  1. +23 −1 main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
@@ -17,6 +17,26 @@ public class VirtualMachine : Mirror
AppDomainMirror root_domain;
Dictionary<int, EventRequest> requests;
ITargetProcess process;
+ public static readonly Dictionary<EventType,SuspendPolicy> EventPolicies = new Dictionary<EventType,SuspendPolicy> () {
+ { EventType.AppDomainCreate, SuspendPolicy.All },
+ { EventType.AppDomainUnload, SuspendPolicy.All },
+ { EventType.AssemblyLoad, SuspendPolicy.All },
+ { EventType.AssemblyUnload, SuspendPolicy.All },
+ { EventType.Breakpoint, SuspendPolicy.All },
+ { EventType.Exception, SuspendPolicy.All },
+ { EventType.KeepAlive, SuspendPolicy.None },
+ { EventType.MethodEntry, SuspendPolicy.None },
bamboo
bamboo Apr 11, 2012

I vaguely remember having to resume the vm after a MethodEntry event... Is it really SuspendPolicy.None?

Tak
Tak Apr 11, 2012 Owner

This is setting the suspend policies we want the runtime to observe for these events.

bamboo
bamboo Apr 11, 2012

I see. I was wondering if this would be a change of behavior for EventType.MethodEntry.

+ { EventType.MethodExit, SuspendPolicy.None },
+ { EventType.Step, SuspendPolicy.All },
+ { EventType.ThreadDeath, SuspendPolicy.None },
+ { EventType.ThreadStart, SuspendPolicy.None },
+ { EventType.TypeLoad, SuspendPolicy.All },
+ { EventType.UserBreak, SuspendPolicy.All },
+ { EventType.UserLog, SuspendPolicy.None },
+ { EventType.VMDeath, SuspendPolicy.None },
+ { EventType.VMDisconnect, SuspendPolicy.None },
+ { EventType.VMStart, SuspendPolicy.None },
+ };
internal Connection conn;
@@ -219,7 +239,7 @@ public void SetSocketTimeouts (int send_timeout, int receive_timeout, int keepal
foreach (EventType etype in events) {
if (etype == EventType.Breakpoint)
throw new ArgumentException ("Breakpoint events cannot be requested using EnableEvents", "events");
- conn.EnableEvent (etype, SuspendPolicy.All, null);
+ conn.EnableEvent (etype, EventPolicies[etype], null);
}
}
@@ -286,6 +306,8 @@ public void SetSocketTimeouts (int send_timeout, int receive_timeout, int keepal
throw new AbsentInformationException ();
case ErrorCode.NO_SEQ_POINT_AT_IL_OFFSET:
throw new ArgumentException ("Cannot set breakpoint on the specified IL offset.");
+ case ErrorCode.ERR_UNLOADED:
+ throw new AppDomainUnloadedException ("The requested item has been unloaded.");
default:
throw new CommandException (args.ErrorCode);
}

0 comments on commit 913695f

Please sign in to comment.