035fbcee56df096c804a3b8de2989ca9db83a9d8
[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         }
32
33         public sealed class StepEventRequest : EventRequest {
34
35                 ThreadMirror step_thread;
36                 StepDepth depth;
37                 StepSize size;
38                 StepFilter filter;
39                 
40                 internal StepEventRequest (VirtualMachine vm, ThreadMirror thread) : base (vm, EventType.Step) {
41                         if (thread == null)
42                                 throw new ArgumentNullException ("thread");
43                         CheckMirror (vm, thread);
44                         this.step_thread = thread;
45                         Depth = StepDepth.Into;
46                         Size = StepSize.Min;
47                 }
48
49                 public override void Enable () {
50                         var mods = new List <Modifier> ();
51                         mods.Add (new StepModifier () { Thread = step_thread.Id, Depth = (int)Depth, Size = (int)Size, Filter = (int)Filter });
52                         SendReq (mods);
53                 }
54
55                 public new ThreadMirror Thread {
56                         get {
57                                 return step_thread;
58                         }
59                 }
60
61                 public StepDepth Depth {
62                         get {
63                                 return depth;
64                         }
65                         set {
66                                 CheckDisabled ();
67                                 depth = value;
68                         }
69                 }
70
71                 public StepSize Size {
72                         get {
73                                 return size;
74                         }
75                         set {
76                                 CheckDisabled ();
77                                 size = value;
78                         }
79                 }
80
81                 public StepFilter Filter {
82                         get {
83                                 return filter;
84                         }
85                         set {
86                                 CheckDisabled ();
87                                 filter = value;
88                         }
89                 }
90         }
91 }