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 System.Diagnostics; | |
6 using System.IO; | |
7 using System.IO.Pipes; | |
8 using System.Runtime.InteropServices; | |
9 using Microsoft.VisualStudio; | |
10 using Microsoft.VisualStudio.Debugger.Interop; | |
11 using Microsoft.VisualStudio.Shell.Interop; | |
12 using NaClVsx.DebugHelpers; | |
13 | |
14 namespace Google.NaClVsx.DebugSupport { | |
15 [ComVisible(true)] | |
16 [Guid(kClsId)] | |
17 [ClassInterface(ClassInterfaceType.None)] | |
18 public class ProgramProvider : IDebugProgramProvider2 { | |
19 #region constants | |
20 | |
21 public const string kClsId = "69303596-96E6-4741-905C-769ABCA7D550"; | |
22 | |
23 #endregion | |
24 | |
25 #region Private Implementation | |
26 | |
27 private ushort locale_ = 1033; // defaults to en-US | |
28 | |
29 #endregion | |
30 | |
31 public ProgramProvider() { | |
32 Trace.WriteLine("Entered ProgramProvider constructor"); | |
33 Trace.WriteLine(typeof(Engine).Assembly.ToString()); | |
34 } | |
35 | |
36 #region Implementation of IDebugProgramProvider2 | |
37 | |
38 public int GetProviderProcessData(enum_PROVIDER_FLAGS flags, | |
39 IDebugDefaultPort2 pPort, | |
40 AD_PROCESS_ID processId, | |
41 CONST_GUID_ARRAY engineFilter, | |
42 PROVIDER_PROCESS_DATA[] pProcesses) { | |
43 Trace.WriteLine("ProgramProvider.GetProviderProcessData"); | |
44 int result = VSConstants.S_FALSE; | |
45 pProcesses[0] = new PROVIDER_PROCESS_DATA(); | |
46 /* | |
47 if ((flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0) { | |
48 try { | |
49 if (GdbProxy.CanConnect((int)(processId.dwProcessId))) { | |
50 IDebugProgramNode2 node = | |
51 (IDebugProgramNode2) new ProgramNode((int)(processId.dwProcessId
)); | |
52 | |
53 IntPtr[] programNodes = { | |
54 Marshal.GetComInterfaceForObject( | |
55 node, | |
56 typeof (IDebugProgramNode2)) | |
57 }; | |
58 | |
59 IntPtr destinationArray = | |
60 Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length); | |
61 Marshal.Copy(programNodes, | |
62 0, | |
63 destinationArray, | |
64 programNodes.Length); | |
65 | |
66 pProcesses[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; | |
67 pProcesses[0].ProgramNodes.Members = destinationArray; | |
68 pProcesses[0].ProgramNodes.dwCount = (uint) programNodes.Length; | |
69 | |
70 IDebugCoreServer3 server; | |
71 pPort.GetServer(out server); | |
72 | |
73 // server.CreateInstanceInServer(typeof(Engine).Assembly.CodeBase,0
, ref new Guid(Engine.ClsId), ) | |
74 | |
75 result = VSConstants.S_OK; | |
76 } | |
77 } | |
78 catch (Exception e) { | |
79 Debug.WriteLine(e.ToString()); | |
80 result = VSConstants.E_INVALIDARG; | |
81 } | |
82 } | |
83 */ | |
84 return result; | |
85 } | |
86 | |
87 public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, | |
88 IDebugDefaultPort2 pPort, | |
89 AD_PROCESS_ID ProcessId, | |
90 ref Guid guidEngine, | |
91 ulong programId, | |
92 out IDebugProgramNode2 ppProgramNode) { | |
93 Trace.WriteLine("ProgramProvider.GetProv
iderProgramNode"); | |
94 ppProgramNode = null; | |
95 return 0; | |
96 } | |
97 | |
98 public int WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, | |
99 IDebugDefaultPort2 pPort, | |
100 AD_PROCESS_ID ProcessId, | |
101 CONST_GUID_ARRAY EngineFilter, | |
102 ref Guid guidLaunchingEngine, | |
103 IDebugPortNotify2 pEventCallback) { | |
104 Trace.WriteLine("ProgramProvider.WatchForProviderEvents"); | |
105 return VSConstants.S_OK; | |
106 } | |
107 | |
108 public int SetLocale(ushort wLangID) { | |
109 Trace.WriteLine("ProgramProvider.SetLocale"); | |
110 locale_ = wLangID; | |
111 return VSConstants.S_OK; | |
112 } | |
113 | |
114 #endregion | |
115 | |
116 | |
117 } | |
118 } | |
OLD | NEW |