Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: experimental/visual_studio_plugin/src/MsAd7.BaseImpl/ErrorBreakpointResolution.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
5 #region
6
7 using System;
8 using System.Diagnostics;
9 using System.Runtime.InteropServices;
10 using Microsoft.VisualStudio;
11 using Microsoft.VisualStudio.Debugger.Interop;
12
13 #endregion
14
15 namespace Google.MsAd7.BaseImpl {
16 /// <summary>
17 /// For documentation of IDebugErrorBreakpointResolution2 members, please se e the VS 2008 MSDN
18 /// documentation.
19 /// </summary>
20 public class ErrorBreakpointResolution : IDebugErrorBreakpointResolution2 {
21 public ErrorBreakpointResolution() {
22 resolutionInfo_.dwFields = 0;
23 resolutionInfo_.bpResLocation.unionmember1 = IntPtr.Zero;
24 }
25
26 /// <summary>
27 /// Set the error message field.
28 /// </summary>
29 /// <value>The message to display to the user.</value>
30 public string Message {
31 set {
32 resolutionInfo_.bstrMessage = value;
33 resolutionInfo_.dwFields = resolutionInfo_.dwFields |
34 enum_BPERESI_FIELDS.BPERESI_MESSAGE;
35 }
36 }
37
38 /// <summary>
39 /// Sets the type field.
40 /// </summary>
41 /// <value>The type and severity of the problem that was encountered.</value >
42 public enum_BP_ERROR_TYPE Type {
43 set {
44 resolutionInfo_.dwType = value;
45 resolutionInfo_.dwFields = resolutionInfo_.dwFields |
46 enum_BPERESI_FIELDS.BPERESI_TYPE;
47 }
48 get { return resolutionInfo_.dwType; }
49 }
50
51 #region Implementation of IDebugBreakpointResolution2
52
53 public int GetBreakpointType(enum_BP_TYPE[] pBPType) {
54 Debug.WriteLine("ErrorBreakpointResolution.GetBreakpointType");
55 pBPType[0] = enum_BP_TYPE.BPT_CODE;
56 return VSConstants.S_OK;
57 }
58
59 public int GetResolutionInfo(enum_BPERESI_FIELDS dwFields,
60 BP_ERROR_RESOLUTION_INFO[] pBpResolutionInfo) {
61 var rValue = VSConstants.S_FALSE;
62 if (resolutionInfo_.dwFields != 0 && pBpResolutionInfo != null) {
63 if (((int) dwFields & (int) enum_BPERESI_FIELDS.BPERESI_ALLFIELDS) ==
64 (int) enum_BPRESI_FIELDS.BPRESI_ALLFIELDS) {
65 pBpResolutionInfo[0] = resolutionInfo_;
66 rValue = VSConstants.S_OK;
67 } else {
68 pBpResolutionInfo[0].dwFields = dwFields & resolutionInfo_.dwFields;
69
70 var locMask = (int) pBpResolutionInfo[0].dwFields &
71 (int) enum_BPERESI_FIELDS.BPERESI_BPRESLOCATION;
72 var msgMask = (int) pBpResolutionInfo[0].dwFields &
73 (int) enum_BPERESI_FIELDS.BPERESI_MESSAGE;
74 var progMask = (int) pBpResolutionInfo[0].dwFields &
75 (int) enum_BPERESI_FIELDS.BPERESI_PROGRAM;
76 var threadMask = (int) pBpResolutionInfo[0].dwFields &
77 (int) enum_BPERESI_FIELDS.BPERESI_THREAD;
78 var typeMask = (int) pBpResolutionInfo[0].dwFields &
79 (int) enum_BPERESI_FIELDS.BPERESI_TYPE;
80
81 if (locMask != 0) {
82 pBpResolutionInfo[0].bpResLocation = resolutionInfo_.bpResLocation;
83 }
84 if (msgMask != 0) {
85 pBpResolutionInfo[0].bstrMessage = resolutionInfo_.bstrMessage;
86 }
87 if (progMask != 0) {
88 pBpResolutionInfo[0].pProgram = resolutionInfo_.pProgram;
89 }
90 if (threadMask != 0) {
91 pBpResolutionInfo[0].pThread = resolutionInfo_.pThread;
92 }
93 if (typeMask != 0) {
94 pBpResolutionInfo[0].dwType = resolutionInfo_.dwType;
95 }
96 rValue = VSConstants.S_OK;
97 }
98 }
99 return rValue;
100 }
101
102 #endregion
103
104 /// <summary>
105 /// Can be used to set the location of the error point that results from e rror resolution, or
106 /// other resolution information.
107 /// </summary>
108 /// <param name = "bpType">The type of breakpoint being resolved.</param>
109 /// <param name = "address">The address of the code referenced by the resolv ed breakpoint.</param>
110 /// <param name = "docContext">The location of the breakpoint in the code, a fter resolution.</param>
111 public void SetLocation(enum_BP_TYPE bpType,
112 ulong address,
113 DocumentContext docContext) {
114 var codeContext =
115 new CodeContext(
116 string.Format("{0}:{1}", docContext.Path, docContext.Line),
117 address,
118 1,
119 docContext);
120
121 resolutionInfo_.bpResLocation.bpType = (uint) bpType;
122
123 if (resolutionInfo_.bpResLocation.unionmember1 != IntPtr.Zero) {
124 Marshal.Release(resolutionInfo_.bpResLocation.unionmember1);
125 resolutionInfo_.bpResLocation.unionmember1 = IntPtr.Zero;
126 }
127 resolutionInfo_.bpResLocation.unionmember1 =
128 Marshal.GetIUnknownForObject(codeContext);
129
130 resolutionInfo_.dwFields = resolutionInfo_.dwFields |
131 enum_BPERESI_FIELDS.BPERESI_BPRESLOCATION;
132 }
133
134 #region Private Implementation
135
136 private BP_ERROR_RESOLUTION_INFO resolutionInfo_;
137
138 #endregion
139 }
140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698