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.Shell; | |
6 | |
7 namespace Google.NaClVsx { | |
8 public class DebugEngineRegistrationAttribute : RegistrationAttribute { | |
9 public DebugEngineRegistrationAttribute() {} | |
10 | |
11 | |
12 | |
13 // | |
14 // Debug Engine Properties | |
15 // | |
16 // These properties correspond to all of the debug engine registry values | |
17 // I was able to find. Not all are documented by Microsoft. Those that are, | |
18 // I've marked with [MSDN] | |
19 // | |
20 | |
21 /// <summary> | |
22 /// [MSDN] Set to nonzero to indicate support for address breakpoints. | |
23 /// </summary> | |
24 public bool AddressBreakpoints { get; set; } | |
25 | |
26 /// <summary> | |
27 /// [MSDN] Set to nonzero in order to always load the debug engine locally. | |
28 /// </summary> | |
29 public bool AlwaysLoadLocal { get; set; } | |
30 | |
31 /// <summary> | |
32 /// | |
33 /// </summary> | |
34 public bool AlwaysLoadProgramProviderLocal { get; set; } | |
35 | |
36 /// <summary> | |
37 /// | |
38 /// </summary> | |
39 public bool AppVerifier { get; set; } | |
40 | |
41 /// <summary> | |
42 /// [MSDN] Set to nonzero to indicate support for attachment to existing pro
grams. | |
43 /// </summary> | |
44 public bool Attach { get; set; } | |
45 | |
46 /// <summary> | |
47 /// | |
48 /// </summary> | |
49 public UInt32 AutoSelectPriority { get; set; } | |
50 | |
51 /// <summary> | |
52 /// [MSDN] Set to nonzero to indicate support for call stack breakpoints. | |
53 /// </summary> | |
54 public bool CallstackBreakpoints { get; set; } | |
55 | |
56 /// <summary> | |
57 /// [MSDN] Set to nonzero to indicate support for the setting of conditional
breakpoints. | |
58 /// </summary> | |
59 public bool ConditionalBreakpoints { get; set; } | |
60 | |
61 /// <summary> | |
62 /// [MSDN] Set to nonzero to indicate support for the setting of breakpoints
on changes in data. | |
63 /// </summary> | |
64 public bool DataBreakpoints { get; set; } | |
65 | |
66 /// <summary> | |
67 /// | |
68 /// </summary> | |
69 public string DebugEngineClsId { get; set; } | |
70 | |
71 /// <summary> | |
72 /// | |
73 /// </summary> | |
74 public string DebugEngineId { get; set; } | |
75 | |
76 /// <summary> | |
77 /// [MSDN] Set to nonzero to indicate support for the production of a disass
embly listing. | |
78 /// </summary> | |
79 public bool Disassembly { get; set; } | |
80 | |
81 /// <summary> | |
82 /// [MSDN] Set to nonzero to indicate support for dump writing (the dumping
of memory to an output device). | |
83 /// </summary> | |
84 public bool DumpWriting { get; set; } | |
85 | |
86 /// <summary> | |
87 /// [MSDN] Set to nonzero to indicate support for Edit and Continue. | |
88 /// Note: A custom debug engine should never set this or should always set i
t to 0. | |
89 /// </summary> | |
90 public bool EditAndContinue { get; set; } | |
91 | |
92 /// <summary> | |
93 /// | |
94 /// </summary> | |
95 public bool EditAndContinueUseNativeBuilder { get; set; } | |
96 | |
97 /// <summary> | |
98 /// | |
99 /// </summary> | |
100 public bool Embedded { get; set; } | |
101 | |
102 /// <summary> | |
103 /// | |
104 /// </summary> | |
105 public bool EnableFuncEvalQuickAbort { get; set; } | |
106 | |
107 /// <summary> | |
108 /// | |
109 /// </summary> | |
110 public bool EngineCanWatchProcess { get; set; } | |
111 | |
112 /// <summary> | |
113 /// [MSDN] Set to nonzero to indicate support for exceptions. | |
114 /// </summary> | |
115 public bool Exceptions { get; set; } | |
116 | |
117 /// <summary> | |
118 /// | |
119 /// </summary> | |
120 public UInt32 FuncEvalAbortLoggingLevel { get; set; } | |
121 | |
122 /// <summary> | |
123 /// | |
124 /// </summary> | |
125 public string FuncEvalQuickAbortDlls { get; set; } | |
126 | |
127 /// <summary> | |
128 /// | |
129 /// </summary> | |
130 public string FuncEvalQuickAbortExcludeList { get; set; } | |
131 | |
132 /// <summary> | |
133 /// [MSDN] Set to nonzero to indicate support for named breakpoints | |
134 /// (breakpoints that break when a certain function name is called). | |
135 /// </summary> | |
136 public bool FunctionBreakpoints { get; set; } | |
137 | |
138 /// <summary> | |
139 /// [MSDN] Set to nonzero to indicate support for the setting of | |
140 /// "hit point" breakpoints (breakpoints that are triggered only | |
141 /// after being hit a certain number of times). | |
142 /// </summary> | |
143 public bool HitCountBreakpoints { get; set; } | |
144 | |
145 /// <summary> | |
146 /// | |
147 /// </summary> | |
148 public bool InterceptCurrentException { get; set; } | |
149 | |
150 /// <summary> | |
151 /// | |
152 /// </summary> | |
153 public bool Interop { get; set; } | |
154 | |
155 /// <summary> | |
156 /// [MSDN] Set to nonzero to indicate support for just-in-time debugging | |
157 /// (the debugger is launched when an exception occurs in a running process)
. | |
158 /// </summary> | |
159 public bool JustInTimeDebug { get; set; } | |
160 | |
161 /// <summary> | |
162 /// | |
163 /// </summary> | |
164 public bool JustMyCodeStepping { get; set; } | |
165 | |
166 /// <summary> | |
167 /// Set to true in order to load the debug engine in-process with Visual Stu
dio | |
168 /// on 64-bit systems. Setting this property to false will result in the eng
ine | |
169 /// being loaded in-process with msvsmon.exe instead. | |
170 /// </summary> | |
171 public bool LoadUnderWow64 { get; set; } | |
172 | |
173 /// <summary> | |
174 /// | |
175 /// </summary> | |
176 public bool LoadProgramProviderUnderWow64 { get; set; } | |
177 | |
178 /// <summary> | |
179 /// | |
180 /// </summary> | |
181 public string Name { get; set; } | |
182 | |
183 /// <summary> | |
184 /// | |
185 /// </summary> | |
186 public bool NativeInteropOk { get; set; } | |
187 | |
188 /// <summary> | |
189 /// [MSDN] Set this to the CLSID(s) of the port supplier(s) | |
190 /// </summary> | |
191 public string PortSupplierClsIds { get; set; } | |
192 | |
193 /// <summary> | |
194 /// [MSDN] Set this to the CLSID of the program provider. | |
195 /// </summary> | |
196 public string ProgramProviderClsId { get; set; } | |
197 | |
198 /// <summary> | |
199 /// | |
200 /// </summary> | |
201 public bool Registers { get; set; } | |
202 | |
203 /// <summary> | |
204 /// | |
205 /// </summary> | |
206 public bool RemoteDebugging { get; set; } | |
207 | |
208 /// <summary> | |
209 /// | |
210 /// </summary> | |
211 public bool RequireFullTrustForSourceServer { get; set; } | |
212 | |
213 /// <summary> | |
214 /// | |
215 /// </summary> | |
216 public string RuntimeClsId { get; set; } | |
217 | |
218 /// <summary> | |
219 /// [MSDN] Set to nonzero to indicate support for setting | |
220 /// the next statement (which skips execution of intermediate | |
221 /// statements). | |
222 /// </summary> | |
223 public bool SetNextStatement { get; set; } | |
224 | |
225 /// <summary> | |
226 /// | |
227 /// </summary> | |
228 public bool SqlClr { get; set; } | |
229 | |
230 /// <summary> | |
231 /// [MSDN] Set to nonzero to indicate support for suspending thread | |
232 /// execution. | |
233 /// </summary> | |
234 public bool SuspendThread { get; set; } | |
235 | |
236 /// <summary> | |
237 /// | |
238 /// </summary> | |
239 public bool UseShimApi { get; set; } | |
240 | |
241 public override void Register(RegistrationContext context) { | |
242 Key key = context.CreateKey(KeyName(context)); | |
243 | |
244 key.SetValue("AddressBP", AddressBreakpoints ? 1 : 0); | |
245 key.SetValue("AlwaysLoadLocal", AlwaysLoadLocal ? 1 : 0); | |
246 key.SetValue("AlwaysLoadProgramProviderLocal", | |
247 AlwaysLoadProgramProviderLocal ? 1 : 0); | |
248 key.SetValue("AppVerifier", AppVerifier ? 1 : 0); | |
249 key.SetValue("Attach", Attach ? 1 : 0); | |
250 key.SetValue("AutoSelectPriority", AutoSelectPriority); | |
251 key.SetValue("CallstackBP", CallstackBreakpoints ? 1 : 0); | |
252 key.SetValue("ConditionalBP", ConditionalBreakpoints ? 1 : 0); | |
253 key.SetValue("DataBP", DataBreakpoints ? 1 : 0); | |
254 if (DebugEngineClsId != null) { | |
255 key.SetValue("CLSID", FormatGuid(DebugEngineClsId)); | |
256 } | |
257 key.SetValue("Disassembly", Disassembly ? 1 : 0); | |
258 key.SetValue("DumpWriting", DumpWriting ? 1 : 0); | |
259 key.SetValue("ENC", EditAndContinue ? 1 : 0); | |
260 key.SetValue("EncUseNativeBuilder", | |
261 EditAndContinueUseNativeBuilder ? 1 : 0); | |
262 key.SetValue("Embedded", Embedded ? 1 : 0); | |
263 key.SetValue("EnableFuncEvalQuickAbort", EnableFuncEvalQuickAbort ? 1 : 0)
; | |
264 key.SetValue("EngineCanWatchProcess", EngineCanWatchProcess ? 1 : 0); | |
265 key.SetValue("Exceptions", Exceptions ? 1 : 0); | |
266 key.SetValue("FunctionBP", FunctionBreakpoints ? 1 : 0); | |
267 key.SetValue("FuncEvalAbortLoggingLevel", FuncEvalAbortLoggingLevel); | |
268 if (FuncEvalQuickAbortDlls != null) { | |
269 key.SetValue("FuncEvalQuickAbortDlls", FuncEvalQuickAbortDlls); | |
270 } | |
271 if (FuncEvalQuickAbortExcludeList != null) { | |
272 key.SetValue("FuncEvalQuickAbortExcludeList", | |
273 FuncEvalQuickAbortExcludeList); | |
274 } | |
275 key.SetValue("FunctionBreakpoints", FunctionBreakpoints ? 1 : 0); | |
276 key.SetValue("HitCountBP", HitCountBreakpoints ? 1 : 0); | |
277 key.SetValue("InterceptCurrentException", | |
278 InterceptCurrentException ? 1 : 0); | |
279 key.SetValue("Interop", Interop ? 1 : 0); | |
280 key.SetValue("JITDebug", JustInTimeDebug ? 1 : 0); | |
281 key.SetValue("JustMyCodeStepping", JustMyCodeStepping ? 1 : 0); | |
282 key.SetValue("LoadUnderWow64", LoadUnderWow64 ? 1 : 0); | |
283 key.SetValue("LoadProgramProviderUnderWow64", | |
284 LoadProgramProviderUnderWow64 ? 1 : 0); | |
285 if (Name != null) | |
286 { | |
287 key.SetValue("Name", Name); | |
288 } | |
289 key.SetValue("NativeInteropOk", NativeInteropOk ? 1 : 0); | |
290 | |
291 // Port supplier ClsIds | |
292 // | |
293 string[] portSuppliers = PortSupplierClsIds.Split(','); | |
294 if (portSuppliers.Length == 1) { | |
295 key.SetValue("PortSupplier", FormatGuid(portSuppliers[0])); | |
296 } else { | |
297 Key portSuppliersKey = key.CreateSubkey("PortSupplier"); | |
298 int id = 0; | |
299 foreach (string clsid in portSuppliers) { | |
300 portSuppliersKey.SetValue(id.ToString(), FormatGuid(clsid)); | |
301 ++id; | |
302 } | |
303 portSuppliersKey.Close(); | |
304 } | |
305 | |
306 if (ProgramProviderClsId != null) { | |
307 key.SetValue("ProgramProvider", FormatGuid(ProgramProviderClsId)); | |
308 } | |
309 key.SetValue("Registers", Registers ? 1 : 0); | |
310 key.SetValue("RemoteDebugging", RemoteDebugging ? 1 : 0); | |
311 key.SetValue("RequireFullTrustForSourceServer", | |
312 RequireFullTrustForSourceServer ? 1 : 0); | |
313 if (RuntimeClsId != null) { | |
314 key.SetValue("Runtime", FormatGuid(RuntimeClsId)); | |
315 } | |
316 key.SetValue("SetNextStatement", SetNextStatement ? 1 : 0); | |
317 key.SetValue("SqlClr", SqlClr ? 1 : 0); | |
318 key.SetValue("SuspendThread", SuspendThread ? 1 : 0); | |
319 key.SetValue("UseShimApi", UseShimApi ? 1 : 0); | |
320 | |
321 key.Close(); | |
322 } | |
323 | |
324 public override void Unregister(RegistrationContext context) { | |
325 context.RemoveKey(KeyName(context)); | |
326 } | |
327 | |
328 #region Private Implementation | |
329 | |
330 string FormatGuid(string guid) { | |
331 return string.Format("{{{0}}}", guid.Trim()); | |
332 } | |
333 | |
334 #endregion | |
335 | |
336 #region Private Implementation | |
337 | |
338 string KeyName(RegistrationContext context) { | |
339 return string.Format("AD7Metrics\\Engine\\{{{0}}}", DebugEngineId); | |
340 } | |
341 | |
342 #endregion | |
343 } | |
344 } | |
OLD | NEW |