示例#1
0
 public AD7DocumentContext(string fileName, TEXT_POSITION begPos, TEXT_POSITION endPos, AD7MemoryAddress codeContext)
 {
     m_fileName = fileName;
     m_begPos = begPos;
     m_endPos = endPos;
     m_codeContext = codeContext;
 }
示例#2
0
    // Get the document context for this pending breakpoint. A document context is a abstract representation of a source file 
    // location.
    public AD7DocumentContext GetDocumentContext(uint address) {
      IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(mBpRequestInfo.bpLocation.unionmember2));
      string documentName;
      EngineUtils.CheckOk(docPosition.GetFileName(out documentName));

      // Get the location in the document that the breakpoint is in.
      TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
      TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
      EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

      AD7MemoryAddress codeContext = new AD7MemoryAddress(mEngine, address);

      return new AD7DocumentContext(documentName, startPosition[0], startPosition[0], codeContext);
    }
示例#3
0
 // Retrieves a list of all code contexts associated with this document context.
 // The engine sample only supports one code context per document context and 
 // the code contexts are always memory addresses.
 int IDebugDocumentContext2.EnumCodeContexts(out IEnumDebugCodeContexts2 ppEnumCodeCxts)
 {
     ppEnumCodeCxts = null;
     try
     {
         AD7MemoryAddress[] codeContexts = new AD7MemoryAddress[1];
         codeContexts[0] = m_codeContext;
         ppEnumCodeCxts = new AD7CodeContextEnum(codeContexts);
         return VSConstants.S_OK;
     }
     //catch (ComponentException e)
     //{
       //  return e.HResult;
     //}
     catch (Exception e)
     {
         return EngineUtils.UnexpectedException(e);
     }
 }
        // 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) != enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) { 
                // 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.HasFlag(enum_BPRESI_FIELDS.BPRESI_PROGRAM)) {
                pBPResolutionInfo[0].pProgram = (IDebugProgram2)m_engine;
                pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
            }
	       
            return VSConstants.S_OK;
        }
 // Adds a specified value to the current context's address to create a new context.
 public int Add(ulong dwCount, out IDebugMemoryContext2 newAddress)
 {
     newAddress = new AD7MemoryAddress(m_engine, (uint)dwCount + m_address);
     return VSConstants.S_OK;
 }
 // Subtracts a specified value from the current context's address to create a new context.
 public int Subtract(ulong dwCount, out IDebugMemoryContext2 ppMemCxt)
 {
     ppMemCxt = new AD7MemoryAddress(m_engine, (uint)dwCount - m_address);
     return VSConstants.S_OK;
 }