Ejemplo n.º 1
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            if (pBPResolutionInfo == null)
                throw new ArgumentNullException("pBPResolutionInfo");
            if (pBPResolutionInfo.Length == 0)
                throw new ArgumentException();

            pBPResolutionInfo[0].dwFields = 0;

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_PROGRAM) != 0)
            {
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
                pBPResolutionInfo[0].pProgram = _program;
            }

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_THREAD) != 0 && _thread != null)
            {
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_THREAD;
                pBPResolutionInfo[0].pThread = _thread;
            }

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0 && false)
            {
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
                _location.ToNativeForm(out pBPResolutionInfo[0].bpResLocation);
            }

            return VSConstants.S_OK;
        }
Ejemplo n.º 2
0
        // Gets the breakpoint resolution information that describes this breakpoint.
        int IDebugBreakpointResolution2.GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0)
            {
                BP_RESOLUTION_LOCATION location = new BP_RESOLUTION_LOCATION();
                location.bpType = (uint)_breakType;
                if (_breakType == enum_BP_TYPE.BPT_CODE)
                {
                    // The debugger will not QI the IDebugCodeContex2 interface returned here. We must pass the pointer
                    // to IDebugCodeContex2 and not IUnknown.
                    AD7MemoryAddress codeContext = new AD7MemoryAddress(_engine, Addr, _functionName);
                    codeContext.SetDocumentContext(_documentContext);
                    location.unionmember1 = HostMarshal.RegisterCodeContext(codeContext);
                    pBPResolutionInfo[0].bpResLocation = location;
                    pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
                }
                else if (_breakType == enum_BP_TYPE.BPT_DATA)
                {
                    location.unionmember1 = HostMarshal.GetIntPtrForDataBreakpointAddress(EngineUtils.AsAddr(Addr, _engine.DebuggedProcess.Is64BitArch));
                    pBPResolutionInfo[0].bpResLocation = location;
                    pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
                }
            }

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_PROGRAM) != 0)
            {
                pBPResolutionInfo[0].pProgram = (IDebugProgram2)_engine;
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
            }

            return Constants.S_OK;
        }
Ejemplo n.º 3
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            var info = new BP_RESOLUTION_INFO();

            info.pProgram = program;
            info.dwFields = enum_BPRESI_FIELDS.BPRESI_PROGRAM;

            if (Thread != null)
            {
                info.pThread   = Thread;
                info.dwFields |= enum_BPRESI_FIELDS.BPRESI_THREAD;
            }

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0 && locationBP != null)
            {
                info.bpResLocation.bpType = (uint)enum_BP_TYPE.BPT_CODE;

                var codeContext = new DebugCodeContext(locationBP.Location);
                var docLoc      = locationBP.DocumentLocation;
                if (docLoc != null)
                {
                    codeContext.DocumentContext = new DebugDocumentContext(docLoc, codeContext);
                }

                // The debugger will not QI the IDebugCodeContex2 interface returned here. We must pass the pointer
                // to IDebugCodeContex2 and not IUnknown.
                info.bpResLocation.unionmember1 = Marshal.GetComInterfaceForObject(codeContext, typeof(IDebugCodeContext2));
                info.dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
            }

            pBPResolutionInfo[0] = info;
            return(VSConstants.S_OK);
        }
Ejemplo n.º 4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int GetResolutionInfo(enum_BPRESI_FIELDS requestedFields, BP_RESOLUTION_INFO [] resolutionInfo)
        {
            //
            // Gets the breakpoint resolution information that describes this breakpoint.
            //

            LoggingUtils.PrintFunction();

            try
            {
                resolutionInfo [0] = new BP_RESOLUTION_INFO();

                if ((requestedFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0)
                {
                    enum_BP_TYPE bpType;

                    GetBreakpointType(out bpType);

                    if (bpType == enum_BP_TYPE.BPT_CODE)
                    {
                        resolutionInfo [0].bpResLocation.bpType = (uint)bpType;

                        resolutionInfo [0].bpResLocation.unionmember1 = Marshal.GetComInterfaceForObject(m_codeContext, typeof(IDebugCodeContext2));
                    }
                    else if (bpType == enum_BP_TYPE.BPT_DATA)
                    {
                        resolutionInfo [0].bpResLocation.bpType = (uint)bpType;

                        throw new NotImplementedException();
                    }

                    resolutionInfo [0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
                }

                if ((requestedFields & enum_BPRESI_FIELDS.BPRESI_PROGRAM) != 0)
                {
                    LoggingUtils.RequireOk(m_codeContext.GetProgram(out resolutionInfo [0].pProgram));

                    resolutionInfo [0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
                }

                if ((requestedFields & enum_BPRESI_FIELDS.BPRESI_THREAD) != 0)
                {
                }

                return(Constants.S_OK);
            }
            catch (NotImplementedException e)
            {
                LoggingUtils.HandleException(e);

                return(Constants.E_NOTIMPL);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                return(Constants.E_FAIL);
            }
        }
Ejemplo n.º 5
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            var info = new BP_RESOLUTION_INFO();
            info.pProgram = program;
            info.dwFields = enum_BPRESI_FIELDS.BPRESI_PROGRAM;

            if (Thread != null)
            {
                info.pThread = Thread;
                info.dwFields |= enum_BPRESI_FIELDS.BPRESI_THREAD;
            }

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0 && locationBP != null)
            {
                info.bpResLocation.bpType = (uint)enum_BP_TYPE.BPT_CODE;

                var codeContext = new DebugCodeContext(locationBP.Location);
                var docLoc = locationBP.DocumentLocation;
                if(docLoc != null) codeContext.DocumentContext = new DebugDocumentContext(docLoc, codeContext);

                // The debugger will not QI the IDebugCodeContex2 interface returned here. We must pass the pointer
                // to IDebugCodeContex2 and not IUnknown.
                info.bpResLocation.unionmember1 = Marshal.GetComInterfaceForObject(codeContext, typeof(IDebugCodeContext2));
                info.dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
            }

            pBPResolutionInfo[0] = info;
            return VSConstants.S_OK;
        }
Ejemplo n.º 6
0
        // Gets the breakpoint resolution information that describes this breakpoint.
        int IDebugBreakpointResolution2.GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0)
            {
                // The sample engine only supports code breakpoints.
                BP_RESOLUTION_LOCATION location = new BP_RESOLUTION_LOCATION();
                location.bpType = (uint)enum_BP_TYPE.BPT_CODE;

                // The debugger will not QI the IDebugCodeContex2 interface returned here. We must pass the pointer
                // to IDebugCodeContex2 and not IUnknown.
                AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, m_address);
                codeContext.SetDocumentContext(m_documentContext);
                location.unionmember1 = Marshal.GetComInterfaceForObject(codeContext, typeof(IDebugCodeContext2));
                pBPResolutionInfo[0].bpResLocation = location;
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;

            }

            if ((dwFields & enum_BPRESI_FIELDS.BPRESI_PROGRAM) != 0)
            {
                pBPResolutionInfo[0].pProgram = (IDebugProgram2)m_engine;
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
            }

            return Constants.S_OK;
        }
Ejemplo n.º 7
0
        int IDebugBreakpointResolution2.GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo) {
            if (dwFields.HasFlag(enum_BPRESI_FIELDS.BPRESI_PROGRAM)) {
                pBPResolutionInfo[0].pProgram = Engine;
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
            }

            if (dwFields.HasFlag(enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION)) {
                string fileName;
                int lineNumber;
                TEXT_POSITION start, end;
                BoundBreakpoint.PendingBreakpoint.GetLocation(out fileName, out lineNumber, out start, out end);

                var addr = new AD7MemoryAddress(Engine, fileName, lineNumber);
                addr.DocumentContext = new AD7DocumentContext(fileName, start, end, addr);

                var location = new BP_RESOLUTION_LOCATION {
                    bpType = (uint)enum_BP_TYPE.BPT_CODE,
                    unionmember1 = Marshal.GetComInterfaceForObject(addr, typeof(IDebugCodeContext2))
                };

                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
            }

            return VSConstants.S_OK;
        }
Ejemplo n.º 8
0
        public void GetResolutionInfo()
        {
            enum_BPRESI_FIELDS fields = enum_BPRESI_FIELDS.BPRESI_ALLFIELDS;

            BP_RESOLUTION_INFO[] resolutionInfos = new BP_RESOLUTION_INFO[1];
            Assert.AreEqual(VSConstants.S_OK,
                            breakpointResolution.GetResolutionInfo(fields, resolutionInfos));
            Assert.AreEqual(expectedResolutionInfo, resolutionInfos[0]);
        }
Ejemplo n.º 9
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            if (dwFields == enum_BPRESI_FIELDS.BPRESI_ALLFIELDS)
            {
                pBPResolutionInfo[0].dwFields = enum_BPRESI_FIELDS.BPRESI_PROGRAM;
                pBPResolutionInfo[0].pProgram = _engine;
            }

            return VSConstants.S_OK;
        }
Ejemplo n.º 10
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            var info = new BP_RESOLUTION_INFO();
            info.pProgram = program;
            info.dwFields = enum_BPRESI_FIELDS.BPRESI_PROGRAM;

            if (Thread != null)
            {
                info.pThread = Thread;
                info.dwFields |= enum_BPRESI_FIELDS.BPRESI_THREAD;
            }

            pBPResolutionInfo[0] = info;
            return VSConstants.S_OK;
        }
Ejemplo n.º 11
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            var info = new BP_RESOLUTION_INFO();

            info.pProgram = program;
            info.dwFields = enum_BPRESI_FIELDS.BPRESI_PROGRAM;

            if (Thread != null)
            {
                info.pThread   = Thread;
                info.dwFields |= enum_BPRESI_FIELDS.BPRESI_THREAD;
            }

            pBPResolutionInfo[0] = info;
            return(VSConstants.S_OK);
        }
Ejemplo n.º 12
0
 int IDebugErrorBreakpointResolution2.GetResolutionInfo(enum_BPERESI_FIELDS dwFields, BP_ERROR_RESOLUTION_INFO[] pErrorResolutionInfo)
 {
     Debug.WriteLine("AD7DebugErrorBreakpointResolution: GetResolutionInfo");
     if ((dwFields == enum_BPERESI_FIELDS.BPERESI_ALLFIELDS) ||
         ((dwFields & enum_BPERESI_FIELDS.BPERESI_TYPE) != 0) ||
         ((dwFields & enum_BPERESI_FIELDS.BPERESI_MESSAGE) != 0))
     {
         BP_RESOLUTION_INFO[] resolutionInfo = new BP_RESOLUTION_INFO[1];
         ((IDebugBreakpointResolution2)bp).GetResolutionInfo(enum_BPRESI_FIELDS.BPRESI_ALLFIELDS, resolutionInfo);
         pErrorResolutionInfo[0].dwFields      = dwFields;
         pErrorResolutionInfo[0].bpResLocation = resolutionInfo[0].bpResLocation;
         pErrorResolutionInfo[0].pProgram      = resolutionInfo[0].pProgram;
         pErrorResolutionInfo[0].pThread       = resolutionInfo[0].pThread;
         pErrorResolutionInfo[0].dwType        = enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING;
         pErrorResolutionInfo[0].bstrMessage   = "Breakpoint invalid in this location.";
     }
     return(VSConstants.S_OK);
 }
 int IDebugErrorBreakpointResolution2.GetResolutionInfo(enum_BPERESI_FIELDS dwFields, BP_ERROR_RESOLUTION_INFO[] pErrorResolutionInfo)
 {
   Debug.WriteLine("AD7DebugErrorBreakpointResolution: GetResolutionInfo");
   if ( (dwFields == enum_BPERESI_FIELDS.BPERESI_ALLFIELDS) ||
     (( dwFields & enum_BPERESI_FIELDS.BPERESI_TYPE ) != 0 ) ||
     (( dwFields & enum_BPERESI_FIELDS.BPERESI_MESSAGE ) != 0 ) )
   {
     BP_RESOLUTION_INFO[] resolutionInfo = new BP_RESOLUTION_INFO[1];
     ((IDebugBreakpointResolution2)bp).GetResolutionInfo( enum_BPRESI_FIELDS.BPRESI_ALLFIELDS, resolutionInfo);
     pErrorResolutionInfo[0].dwFields = dwFields;
     pErrorResolutionInfo[0].bpResLocation = resolutionInfo[0].bpResLocation;
     pErrorResolutionInfo[0].pProgram = resolutionInfo[0].pProgram;
     pErrorResolutionInfo[0].pThread = resolutionInfo[0].pThread;
     pErrorResolutionInfo[0].dwType = enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING;
     pErrorResolutionInfo[0].bstrMessage = "Breakpoint invalid in this location.";
   }
   return VSConstants.S_OK;
 }
        public void GetResolutionInfo()
        {
            var fields       = enum_BPRESI_FIELDS.BPRESI_ALLFIELDS;
            var expectedInfo = new BP_RESOLUTION_INFO
            {
                dwFields = enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION |
                           enum_BPRESI_FIELDS.BPRESI_PROGRAM,
                bpResLocation = new BP_RESOLUTION_LOCATION
                {
                    unionmember1 = System.Runtime.InteropServices.Marshal.StringToBSTR(EXPRESSION)
                },
                pProgram = mockProgram
            };
            var infos = new BP_RESOLUTION_INFO[1];

            Assert.AreEqual(VSConstants.S_OK, resolution.GetResolutionInfo(fields, infos));
            Assert.AreEqual(EXPRESSION, System.Runtime.InteropServices.Marshal.PtrToStringBSTR(
                                infos[0].bpResLocation.unionmember1));
            Assert.AreEqual(mockProgram, infos[0].pProgram);
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Gets the breakpoint resolution information that describes this breakpoint.
 /// </summary>
 /// <param name="dwFields">A combination of flags from the BPRESI_FIELDS enumeration that determine which fields of the pBPResolutionInfo parameter are to be filled out.</param>
 /// <param name="pBPResolutionInfo">The BP_RESOLUTION_INFO structure to be filled in with information about this breakpoint.</param>
 /// <returns>If successful, returns S_OK; otherwise returns an error code.</returns>
 public virtual int GetResolutionInfo( enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo )
 {
     Logger.Debug( string.Empty );
     return VSConstants.E_NOTIMPL;
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int GetResolutionInfo (enum_BPRESI_FIELDS requestedFields, BP_RESOLUTION_INFO [] resolutionInfo)
    {
      // 
      // Gets the breakpoint resolution information that describes this breakpoint.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        resolutionInfo [0] = new BP_RESOLUTION_INFO ();

        if ((requestedFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0)
        {
          enum_BP_TYPE bpType;

          GetBreakpointType (out bpType);

          if (bpType == enum_BP_TYPE.BPT_CODE)
          {
            resolutionInfo [0].bpResLocation.bpType = (uint)bpType;

            resolutionInfo [0].bpResLocation.unionmember1 = Marshal.GetComInterfaceForObject (m_codeContext, typeof (IDebugCodeContext2));
          }
          else if (bpType == enum_BP_TYPE.BPT_DATA)
          {
            resolutionInfo [0].bpResLocation.bpType = (uint)bpType;

            throw new NotImplementedException ();
          }

          resolutionInfo [0].dwFields |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
        }

        if ((requestedFields & enum_BPRESI_FIELDS.BPRESI_PROGRAM) != 0)
        {
          LoggingUtils.RequireOk (m_codeContext.GetProgram (out resolutionInfo [0].pProgram));

          resolutionInfo [0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
        }

        if ((requestedFields & enum_BPRESI_FIELDS.BPRESI_THREAD) != 0)
        {
        }

        return Constants.S_OK;
      }
      catch (NotImplementedException e)
      {
        LoggingUtils.HandleException (e);

        return Constants.E_NOTIMPL;
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        return Constants.E_FAIL;
      }
    }
Ejemplo n.º 17
0
    int IDebugBreakpointResolution2.GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
    {
      Debug.WriteLine("AD7Breakpoint: GetResolutionInfo");
      AD7DocumentContext documentContext = new AD7DocumentContext(_node.FileName, ( int )_lineNumber, _beginPosition, _endPosition, this._node.Debugger.Debugger.CurrentScope );
      if (dwFields == enum_BPRESI_FIELDS.BPRESI_ALLFIELDS)
      {
        var loc = new BP_RESOLUTION_LOCATION
        {
          bpType = (uint)enum_BP_TYPE.BPT_CODE,
          unionmember1 = Marshal.GetComInterfaceForObject(documentContext, typeof(IDebugCodeContext2))
        };

        pBPResolutionInfo[0].bpResLocation = loc;
        pBPResolutionInfo[0].pProgram = _node;
        pBPResolutionInfo[0].pThread = _node;
      }

      return VSConstants.S_OK;
    }
Ejemplo n.º 18
0
        public int GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo)
        {
            //VS line\column is zero based. PowerShell is 1
            var documentContext = new ScriptDocumentContext(File, Line - 1, Column, "");

            Log.Debug("ScriptBreakpoint: GetResolutionInfo");
            if (dwFields == enum_BPRESI_FIELDS.BPRESI_ALLFIELDS)
            {
                var loc = new BP_RESOLUTION_LOCATION
                              {
                                  bpType = (uint)enum_BP_TYPE.BPT_CODE,
                                  unionmember1 = Marshal.GetComInterfaceForObject(documentContext, typeof(IDebugCodeContext2))
                              };

                pBPResolutionInfo[0].bpResLocation = loc;
                pBPResolutionInfo[0].pProgram = _node;
                pBPResolutionInfo[0].pThread = _node;
            }

            return VSConstants.S_OK;
        }