-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNewBreakpointCommand.cs
More file actions
66 lines (51 loc) · 2.16 KB
/
NewBreakpointCommand.cs
File metadata and controls
66 lines (51 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System.Management.Automation;
namespace PSExt.Commands
{
[Cmdlet(VerbsCommon.New, "DbgBreakpoint", DefaultParameterSetName = "CodeExpr")]
[OutputType(typeof (BreakpointData))]
public class NewBreakpointCommand : DbgBaseCmdlet
{
public NewBreakpointCommand()
{
Id = uint.MaxValue;
Flags = BreakpointFlags.Enabled;
}
[Parameter(Mandatory = true, ParameterSetName = "CodeExpr", ValueFromPipelineByPropertyName = true, Position = 1)]
[Parameter(Mandatory = true, ParameterSetName = "DataExpr", ValueFromPipelineByPropertyName = true, Position = 1)]
public string OffsetExpression { get; set; }
[Parameter(Mandatory = true, ParameterSetName = "CodeOffset", ValueFromPipelineByPropertyName = true)]
[Parameter(Mandatory = true, ParameterSetName = "DataOffset", ValueFromPipelineByPropertyName = true)]
public ulong Offset { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = "DataExpr")]
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = "DataOffset")]
public uint DataSize { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = "DataExpr")]
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = "DataOffset")]
public DataBreakpointAccessTypes DataAccess { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true)]
public BreakpointFlags Flags { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true, Position = 2)]
public string Command { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true)]
public uint MatchThread { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true)]
public uint PassCount { get; set; }
[Parameter(ValueFromPipelineByPropertyName = true)]
public uint Id { get; set; }
protected override void ProcessRecord()
{
var bt = BreakType.Code;
switch (ParameterSetName)
{
case "DataOffset":
case "DataExpr":
bt = BreakType.Data;
break;
}
var bd = new BreakpointData(Offset, bt, Flags, DataAccess, DataSize, 0, MatchThread, Id, PassCount, 0,
Command, OffsetExpression);
var res = Debugger.AddBreakpoints(bd);
WriteObject(res, true);
}
}
}