OLD | NEW |
| (Empty) |
1 // Copyright 2009 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 using System; | |
5 using Microsoft.VisualStudio; | |
6 using Microsoft.VisualStudio.Debugger.Interop; | |
7 | |
8 namespace Google.MsAd7.BaseImpl { | |
9 public class Ad7Events { | |
10 public static int SendEvent(IDebugEventCallback2 cb, | |
11 IDebugEngine2 eng, | |
12 IDebugProcess2 proc, | |
13 IDebugProgram2 prog, | |
14 IDebugThread2 thread, | |
15 DebugEvent evt) { | |
16 Guid iid = ComUtils.GuidOf(evt); | |
17 return cb.Event( | |
18 eng, | |
19 proc, | |
20 prog, | |
21 thread, | |
22 evt, | |
23 ref iid, | |
24 (uint) evt.Attributes); | |
25 } | |
26 | |
27 #region Nested type: DebugBreakEvent | |
28 | |
29 [InheritGuid(typeof (IDebugBreakEvent2))] | |
30 public class DebugBreakEvent : DebugEvent, IDebugBreakEvent2 { | |
31 public DebugBreakEvent() : base(enum_EVENTATTRIBUTES.EVENT_ASYNC_STOP) {} | |
32 } | |
33 | |
34 #endregion | |
35 | |
36 #region Nested type: DebugBreakpointErrorEvent | |
37 | |
38 [InheritGuid(typeof (IDebugBreakpointErrorEvent2))] | |
39 public class DebugBreakpointErrorEvent | |
40 : DebugEvent, IDebugBreakpointErrorEvent2 { | |
41 public DebugBreakpointErrorEvent(IDebugErrorBreakpoint2 debugErrorBreakpoi
nt) | |
42 : base(enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS) { | |
43 debugErrorBreakpoint_ = debugErrorBreakpoint; | |
44 } | |
45 | |
46 #region IDebugBreakpointErrorEvent2 Members | |
47 | |
48 public int GetErrorBreakpoint(out IDebugErrorBreakpoint2 ppErrorBP) { | |
49 ppErrorBP = debugErrorBreakpoint_; | |
50 return VSConstants.S_OK; | |
51 } | |
52 | |
53 #endregion | |
54 | |
55 #region Private Implementation | |
56 | |
57 private readonly IDebugErrorBreakpoint2 debugErrorBreakpoint_; | |
58 | |
59 #endregion | |
60 } | |
61 | |
62 #endregion | |
63 | |
64 #region Nested type: DebugEngineCreateEvent | |
65 | |
66 [InheritGuid(typeof (IDebugEngineCreateEvent2))] | |
67 public class DebugEngineCreateEvent : DebugEvent, IDebugEngineCreateEvent2 { | |
68 public DebugEngineCreateEvent(IDebugEngine2 engine) | |
69 : base(enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS) { | |
70 engine_ = engine; | |
71 } | |
72 | |
73 #region Implementation of IDebugEngineCreateEvent2 | |
74 | |
75 public int GetEngine(out IDebugEngine2 pEngine) { | |
76 pEngine = engine_; | |
77 return VSConstants.S_OK; | |
78 } | |
79 | |
80 #endregion | |
81 | |
82 #region Private Implementation | |
83 | |
84 readonly IDebugEngine2 engine_; | |
85 | |
86 #endregion | |
87 } | |
88 | |
89 #endregion | |
90 | |
91 #region Nested type: DebugEvent | |
92 | |
93 public class DebugEvent : IDebugEvent2 { | |
94 public DebugEvent(enum_EVENTATTRIBUTES attributes) { | |
95 Attributes = attributes; | |
96 } | |
97 | |
98 public enum_EVENTATTRIBUTES Attributes { get; set; } | |
99 | |
100 #region Implementation of IDebugEvent2 | |
101 | |
102 public int GetAttributes(out uint pdwAttrib) { | |
103 pdwAttrib = (uint) Attributes; | |
104 return VSConstants.S_OK; | |
105 } | |
106 | |
107 #endregion | |
108 } | |
109 | |
110 #endregion | |
111 | |
112 #region Nested type: DebugLoadCompleteEvent | |
113 | |
114 [InheritGuid(typeof (IDebugLoadCompleteEvent2))] | |
115 public class DebugLoadCompleteEvent : DebugEvent, IDebugLoadCompleteEvent2 { | |
116 public DebugLoadCompleteEvent() | |
117 : base(enum_EVENTATTRIBUTES.EVENT_STOPPING) {} | |
118 } | |
119 | |
120 #endregion | |
121 | |
122 #region Nested type: DebugModuleLoadEvent | |
123 | |
124 [InheritGuid(typeof (IDebugModuleLoadEvent2))] | |
125 public class DebugModuleLoadEvent : DebugEvent, IDebugModuleLoadEvent2 { | |
126 public DebugModuleLoadEvent(IDebugModule2 module, | |
127 string msg, | |
128 bool isLoading) | |
129 : base(enum_EVENTATTRIBUTES.EVENT_IMMEDIATE) { | |
130 module_ = module; | |
131 msg_ = msg; | |
132 isLoading_ = isLoading; | |
133 } | |
134 | |
135 #region Implementation of IDebugModuleLoadEvent2 | |
136 | |
137 public int GetModule(out IDebugModule2 pModule, | |
138 ref string pbstrDebugMessage, | |
139 ref int pbLoad) { | |
140 pModule = module_; | |
141 pbstrDebugMessage = msg_; | |
142 pbLoad = isLoading_ ? 1 : 0; | |
143 return VSConstants.S_OK; | |
144 } | |
145 | |
146 #endregion | |
147 | |
148 #region Private Implementation | |
149 | |
150 readonly bool isLoading_; // false indicates module is unloading | |
151 | |
152 readonly IDebugModule2 module_; | |
153 readonly string msg_; | |
154 | |
155 #endregion | |
156 } | |
157 | |
158 #endregion | |
159 | |
160 #region Nested type: DebugProgramCreateEvent | |
161 | |
162 [InheritGuid(typeof (IDebugProgramCreateEvent2))] | |
163 public class DebugProgramCreateEvent | |
164 : DebugEvent, | |
165 IDebugProgramCreateEvent2 { | |
166 public DebugProgramCreateEvent(enum_EVENTATTRIBUTES attributes) | |
167 : base(attributes) {} | |
168 } | |
169 | |
170 #endregion | |
171 | |
172 #region Nested type: DebugProgramDestroyEvent | |
173 | |
174 [InheritGuid(typeof (IDebugProgramDestroyEvent2))] | |
175 public class DebugProgramDestroyEvent | |
176 : DebugEvent, | |
177 IDebugProgramDestroyEvent2 { | |
178 public DebugProgramDestroyEvent(uint exitCode) | |
179 : base(enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS) { | |
180 exitCode_ = exitCode; | |
181 } | |
182 | |
183 #region Implementation of IDebugProgramDestroyEvent2 | |
184 | |
185 public int GetExitCode(out uint pdwExit) { | |
186 pdwExit = exitCode_; | |
187 return VSConstants.S_OK; | |
188 } | |
189 | |
190 #endregion | |
191 | |
192 #region Private Implementation | |
193 | |
194 private readonly uint exitCode_; | |
195 | |
196 #endregion | |
197 } | |
198 | |
199 #endregion | |
200 | |
201 #region Nested type: DebugStepCompleteEvent | |
202 | |
203 [InheritGuid(typeof (IDebugStepCompleteEvent2))] | |
204 public class DebugStepCompleteEvent : DebugEvent, IDebugStepCompleteEvent2 { | |
205 public DebugStepCompleteEvent() | |
206 : base(enum_EVENTATTRIBUTES.EVENT_ASYNC_STOP) {} | |
207 } | |
208 | |
209 #endregion | |
210 | |
211 #region Nested type: DebugSymbolSearchEvent | |
212 | |
213 [InheritGuid(typeof (IDebugSymbolSearchEvent2))] | |
214 public class DebugSymbolSearchEvent : DebugEvent, IDebugSymbolSearchEvent2 { | |
215 public DebugSymbolSearchEvent(IDebugModule3 module, | |
216 string msg, | |
217 enum_MODULE_INFO_FLAGS flags) | |
218 : base(enum_EVENTATTRIBUTES.EVENT_IMMEDIATE) { | |
219 module_ = module; | |
220 msg_ = msg; | |
221 flags_ = flags; | |
222 } | |
223 | |
224 #region Implementation of IDebugSymbolSearchEvent2 | |
225 | |
226 public int GetSymbolSearchInfo(out IDebugModule3 pModule, | |
227 ref string pbstrDebugMessage, | |
228 enum_MODULE_INFO_FLAGS[] pdwModuleInfoFlags
) { | |
229 pModule = module_; | |
230 pbstrDebugMessage = msg_; | |
231 pdwModuleInfoFlags[0] = flags_; | |
232 | |
233 return VSConstants.S_OK; | |
234 } | |
235 | |
236 #endregion | |
237 | |
238 #region Private Implementation | |
239 | |
240 private readonly enum_MODULE_INFO_FLAGS flags_; | |
241 | |
242 private readonly IDebugModule3 module_; | |
243 private readonly string msg_; | |
244 | |
245 #endregion | |
246 } | |
247 | |
248 #endregion | |
249 } | |
250 } | |
OLD | NEW |