// 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) { var codeContexts = new AD7MemoryAddress[1]; codeContexts[0] = _codeContext; ppEnumCodeCxts = new AD7CodeContextEnum(codeContexts); return VSConstants.S_OK; }
// 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. var 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. var codeContext = new AD7MemoryAddress(m_engine, m_address.Filename, (uint) m_address.Line); 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 = m_engine; pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM; } return VSConstants.S_OK; }
public AD7DocumentContext(string fileName, TEXT_POSITION begPos, TEXT_POSITION endPos, AD7MemoryAddress codeContext) { _fileName = fileName; _begPos = begPos; _endPos = endPos; _codeContext = codeContext; }
// Get the document context for this pending breakpoint. A document context is a abstract representation of a source file // location. public AD7DocumentContext GetDocumentContext(NodeBreakpoint address) { var docPosition = (IDebugDocumentPosition2) (Marshal.GetObjectForIUnknown(_bpRequestInfo.bpLocation.unionmember2)); string documentName; EngineUtils.CheckOk(docPosition.GetFileName(out documentName)); // Get the location in the document that the breakpoint is in. var startPosition = new TEXT_POSITION[1]; var endPosition = new TEXT_POSITION[1]; EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition)); var codeContext = new AD7MemoryAddress(_engine, documentName, startPosition[0].dwLine); return new AD7DocumentContext(documentName, startPosition[0], startPosition[0], codeContext); }
// Gets the code context for this stack frame. The code context represents the current instruction pointer in this stack frame. int IDebugStackFrame2.GetCodeContext(out IDebugCodeContext2 memoryAddress) { memoryAddress = new AD7MemoryAddress(_engine, _stackFrame.FileName, (uint) _stackFrame.Line, _stackFrame); return VSConstants.S_OK; }
// Gets the code context for this stack frame. The code context represents the current instruction pointer in this stack frame. int IDebugStackFrame2.GetCodeContext(out IDebugCodeContext2 memoryAddress) { memoryAddress = new AD7MemoryAddress(_engine, _stackFrame.FileName, (uint)_stackFrame.Line, _stackFrame); return(VSConstants.S_OK); }
public int Add(ulong dwCount, out IDebugMemoryContext2 newAddress) { newAddress = new AD7MemoryAddress(_engine, _filename, (uint) dwCount + _lineNo); 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(_engine, _filename, (uint) dwCount - _lineNo); return VSConstants.S_OK; }