OLD | NEW |
| (Empty) |
1 // Copyright 2010 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.Runtime.InteropServices; | |
6 using Microsoft.VisualStudio; | |
7 using Microsoft.VisualStudio.Debugger.Interop; | |
8 | |
9 namespace Google.MsAd7.BaseImpl { | |
10 /// <summary> | |
11 /// For documentation of IDebugBreakpointRequest2 members, please see the VS 2
008 MSDN | |
12 /// documentation. | |
13 /// </summary> | |
14 public class BreakpointRequest : IDebugBreakpointRequest2 | |
15 { | |
16 /// <summary> | |
17 /// Allows our implementation of the Debug Engine to construct an implemenat
ion of this | |
18 /// interface that is specific to our purpose, from the interface whose impl
ementation is | |
19 /// opaque to us. | |
20 /// </summary> | |
21 /// <param name="rq">A breakpoint request whose implementation is opaque to
this class.</param> | |
22 public BreakpointRequest(IDebugBreakpointRequest2 rq) { | |
23 var loctype = new enum_BP_LOCATION_TYPE[1]; | |
24 rq.GetLocationType(loctype); | |
25 locationType_ = loctype[0]; | |
26 | |
27 var inf = new BP_REQUEST_INFO[1]; | |
28 rq.GetRequestInfo( | |
29 enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, | |
30 inf); | |
31 requestInfo_ = inf[0]; | |
32 | |
33 // | |
34 // BP_LOCATIONis a discriminated union in C+, and seems to | |
35 // have been ported to C# rather carelessly. This code follows | |
36 // the instructions in the MSDN docs at | |
37 // http://msdn.microsoft.com/en-us/library/bb162191(v=VS.80).aspx | |
38 // | |
39 if ((locationType_ & enum_BP_LOCATION_TYPE.BPLT_FILE_LINE) != 0) { | |
40 DocPos = | |
41 new DocumentPosition( | |
42 (IDebugDocumentPosition2) | |
43 Marshal.GetObjectForIUnknown( | |
44 requestInfo_.bpLocation.unionmember2)); | |
45 } else { | |
46 throw new ArgumentException("Unsupported breakpoint location type"); | |
47 } | |
48 } | |
49 | |
50 public enum_BP_LOCATION_TYPE LocationType { | |
51 get { return locationType_; } | |
52 } | |
53 | |
54 public BP_REQUEST_INFO RequestInfo { | |
55 get { return requestInfo_; } | |
56 } | |
57 | |
58 public DocumentPosition DocPos { get; set; } | |
59 | |
60 #region Implementation of IDebugBreakpointRequest2 | |
61 | |
62 public int GetLocationType(enum_BP_LOCATION_TYPE[] pBPLocationType) { | |
63 pBPLocationType[0] = locationType_; | |
64 return VSConstants.S_OK; | |
65 } | |
66 | |
67 public int GetRequestInfo(enum_BPREQI_FIELDS dwFields, | |
68 BP_REQUEST_INFO[] pBPRequestInfo) { | |
69 pBPRequestInfo[0] = requestInfo_; | |
70 return VSConstants.S_OK; | |
71 } | |
72 | |
73 #endregion | |
74 | |
75 #region Private Implementation | |
76 | |
77 private readonly enum_BP_LOCATION_TYPE locationType_ = | |
78 enum_BP_LOCATION_TYPE.BPLT_NONE; | |
79 | |
80 private readonly BP_REQUEST_INFO requestInfo_; | |
81 | |
82 #endregion | |
83 } | |
84 } | |
OLD | NEW |