Skip to content

Commit

Permalink
[Bug 39346] "Debug project code only" does not prevent the debugger f…
Browse files Browse the repository at this point in the history
…rom breaking on exception catchpoints in non-user code unless the exception is thrown and caught within a `Task.Delay ().ContinueWith ()`

Before merging this runtime side has to fix few things(Bg 39371)
  • Loading branch information
David Karlaš committed Mar 4, 2016
1 parent 607c1da commit c93c555
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Mono.Debugging.Soft/SoftDebuggerSession.cs
Expand Up @@ -1141,9 +1141,11 @@ void InsertCatchpoint (Catchpoint cp, BreakInfo bi, TypeMirror excType)
if (vm.Version.AtLeast (2, 25))
request.IncludeSubclasses = cp.IncludeSubclasses; // Note: need to set IncludeSubclasses *before* enabling
request.Enabled = cp.Enabled;
if (assemblyFilters != null && assemblyFilters.Count > 0)
request.AssemblyFilter = assemblyFilters;
bi.Requests.Add (request);

breakpoints[request] = bi;
breakpoints [request] = bi;
}

static bool CheckTypeName (string typeName, string name)
Expand Down Expand Up @@ -1899,6 +1901,7 @@ void HandleAssemblyUnloadEvents (AssemblyUnloadEvent[] events)
int index = assemblyFilters.IndexOf (asm);
if (index != -1)
assemblyFilters.RemoveAt (index);
UpdateExceptionsAssemblyFilters ();
}
// Mark affected breakpoints as pending again
var affectedBreakpoints = new List<KeyValuePair<EventRequest, BreakInfo>> (breakpoints.Where (x => x.Value != null && x.Value.Location != null &&
Expand Down Expand Up @@ -1939,6 +1942,20 @@ where PathComparer.Equals (pair.Value.Assembly.Location, asm.Location)
OnDebuggerOutput (false, string.Format ("Unloaded assembly: {0}\n", asm.Location));
}

void UpdateExceptionsAssemblyFilters ()
{
foreach(var b in breakpoints) {
if(b.Key is ExceptionEventRequest) {
b.Key.Disable ();
if (assemblyFilters != null && assemblyFilters.Count > 0)
b.Key.AssemblyFilter = assemblyFilters;
else
b.Key.AssemblyFilter = null;
b.Key.Enable ();
}
}
}

void HandleVMStartEvents (VMStartEvent[] events)
{
var thread = events [0].Thread;
Expand Down Expand Up @@ -2903,6 +2920,7 @@ bool UpdateAssemblyFilters (AssemblyMirror asm)

if (found) {
assemblyFilters.Add (asm);
UpdateExceptionsAssemblyFilters ();
return true;
}

Expand Down

0 comments on commit c93c555

Please sign in to comment.