Reinstate debugging API lost in #10338 (#10808)

This commit is contained in:
Robert Holt
2019-10-30 14:46:55 -07:00
committed by Aditya Patwardhan
parent 7772418dec
commit 96eb361af8
5 changed files with 67 additions and 0 deletions
@@ -625,6 +625,13 @@ namespace System.Management.Automation
public virtual Breakpoint GetBreakpoint(int id) =>
throw new PSNotImplementedException();
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
public virtual void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
throw new PSNotImplementedException();
/// <summary>
/// Returns breakpoints primarily for the Get-PSBreakpoint cmdlet.
/// </summary>
@@ -2580,6 +2587,31 @@ namespace System.Management.Automation
#region Breakpoints
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints"></param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints)
{
foreach (Breakpoint bp in breakpoints)
{
switch (bp)
{
case CommandBreakpoint commandBreakpoint:
AddCommandBreakpoint(commandBreakpoint);
continue;
case LineBreakpoint lineBreakpoint:
AddLineBreakpoint(lineBreakpoint);
continue;
case VariableBreakpoint variableBreakpoint:
AddVariableBreakpoint(variableBreakpoint);
continue;
}
}
}
/// <summary>
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
@@ -4048,6 +4080,13 @@ namespace System.Management.Automation
#region Overrides
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
_wrappedDebugger.SetBreakpoints(breakpoints);
/// <summary>
/// Process debugger or PowerShell command/script.
/// </summary>
@@ -1087,6 +1087,13 @@ namespace System.Management.Automation.PSTasks
return _wrappedDebugger.ProcessCommand(command, output);
}
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">List of breakpoints.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
_wrappedDebugger.SetBreakpoints(breakpoints);
/// <summary>
/// Sets the debugger resume action.
/// </summary>
@@ -3909,6 +3909,13 @@ namespace System.Management.Automation
return _wrappedDebugger.ProcessCommand(command, output);
}
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
_wrappedDebugger.SetBreakpoints(breakpoints);
public override Breakpoint GetBreakpoint(int id) =>
_wrappedDebugger.GetBreakpoint(id);
@@ -2006,6 +2006,13 @@ namespace System.Management.Automation
}
}
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">Breakpoints.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
_runspace.Debugger?.SetBreakpoints(breakpoints);
/// <summary>
/// Get a breakpoint by id, primarily for Enable/Disable/Remove-PSBreakpoint cmdlets.
/// </summary>
@@ -1842,6 +1842,13 @@ namespace System.Management.Automation
get { return _inDebugMode; }
}
/// <summary>
/// Adds the provided set of breakpoints to the debugger.
/// </summary>
/// <param name="breakpoints">List of breakpoints.</param>
public override void SetBreakpoints(IEnumerable<Breakpoint> breakpoints) =>
_wrappedDebugger.Value.SetBreakpoints(breakpoints);
public override Breakpoint GetBreakpoint(int id) =>
_wrappedDebugger.Value.GetBreakpoint(id);