Merge branch 'master' of https://github.com/mono/mono
[mono.git] / mcs / class / Mono.Debugger.Soft / Mono.Debugger.Soft / StepEventRequest.cs
1 using System;
2 using System.Collections.Generic;
3
4 namespace Mono.Debugger.Soft
5 {
6         public enum StepDepth {
7                 Into = 0,
8                 Over = 1,
9                 Out = 2
10         }
11
12         public enum StepSize {
13                 Min = 0,
14                 Line = 1
15         }
16
17         /*
18          * Filter which kinds of methods to skip during single stepping
19          */
20         [Flags]
21         public enum StepFilter {
22                 None = 0,
23                 StaticCtor = 1,
24                 /* Since protocol version 2.20 */
25                 /* Methods which have the [DebuggerHidden] attribute */
26                 /* Before protocol version 2.26, this includes [DebuggerStepThrough] as well */
27                 DebuggerHidden = 2,
28                 /* Since protocol version 2.26 */
29                 /* Methods which have the [DebuggerStepThrough] attribute */
30                 DebuggerStepThrough = 4,
31                 /* Since protocol version 2.30 */
32                 /* Methods which have the [DebuggerNonUserCode] attribute */
33                 DebuggerNonUserCode = 8
34         }
35
36         public sealed class StepEventRequest : EventRequest {
37
38                 ThreadMirror step_thread;
39                 StepDepth depth;
40                 StepSize size;
41                 StepFilter filter;
42                 
43                 internal StepEventRequest (VirtualMachine vm, ThreadMirror thread) : base (vm, EventType.Step) {
44                         if (thread == null)
45                                 throw new ArgumentNullException ("thread");
46                         CheckMirror (vm, thread);
47                         this.step_thread = thread;
48                         Depth = StepDepth.Into;
49                         Size = StepSize.Min;
50                 }
51
52                 public override void Enable () {
53                         var mods = new List <Modifier> ();
54                         mods.Add (new StepModifier () { Thread = step_thread.Id, Depth = (int)Depth, Size = (int)Size, Filter = (int)Filter });
55                         SendReq (mods);
56                 }
57
58                 public new ThreadMirror Thread {
59                         get {
60                                 return step_thread;
61                         }
62                 }
63
64                 public StepDepth Depth {
65                         get {
66                                 return depth;
67                         }
68                         set {
69                                 CheckDisabled ();
70                                 depth = value;
71                         }
72                 }
73
74                 public StepSize Size {
75                         get {
76                                 return size;
77                         }
78                         set {
79                                 CheckDisabled ();
80                                 size = value;
81                         }
82                 }
83
84                 public StepFilter Filter {
85                         get {
86                                 return filter;
87                         }
88                         set {
89                                 CheckDisabled ();
90                                 filter = value;
91                         }
92                 }
93         }
94 }