Example #1
0
 public AD7DocumentContext(string fileName, TEXT_POSITION begPos, TEXT_POSITION endPos, AD7MemoryAddress codeContext, FrameKind frameKind)
 {
     _fileName    = fileName;
     _begPos      = begPos;
     _endPos      = endPos;
     _codeContext = codeContext;
     _frameKind   = frameKind;
 }
Example #2
0
 // 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.LineNo, _stackFrame);
     return(VSConstants.S_OK);
 }
Example #3
0
 // 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(_engine, _filename, (uint)dwCount + _lineNo);
     return(VSConstants.S_OK);
 }
Example #4
0
        // Compares the memory context to each context in the given array in the manner indicated by compare flags,
        // returning an index of the first context that matches.
        public int Compare(enum_CONTEXT_COMPARE uContextCompare, IDebugMemoryContext2[] compareToItems, uint compareToLength, out uint foundIndex)
        {
            foundIndex = uint.MaxValue;

            enum_CONTEXT_COMPARE contextCompare = (enum_CONTEXT_COMPARE)uContextCompare;

            for (uint c = 0; c < compareToLength; c++)
            {
                AD7MemoryAddress compareTo = compareToItems[c] as AD7MemoryAddress;
                if (compareTo == null)
                {
                    continue;
                }

                if (!AD7Engine.ReferenceEquals(this._engine, compareTo._engine))
                {
                    continue;
                }

                bool result;

                switch (contextCompare)
                {
                case enum_CONTEXT_COMPARE.CONTEXT_EQUAL:
                    result = (this._lineNo == compareTo._lineNo);
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN:
                    result = (this._lineNo < compareTo._lineNo);
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN:
                    result = (this._lineNo > compareTo._lineNo);
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN_OR_EQUAL:
                    result = (this._lineNo <= compareTo._lineNo);
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                    result = (this._lineNo >= compareTo._lineNo);
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
                case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
                    if (_frame != null)
                    {
                        result = compareTo._filename == _filename && (compareTo._lineNo + 1) >= _frame.StartLine && (compareTo._lineNo + 1) <= _frame.EndLine;
                    }
                    else if (compareTo._frame != null)
                    {
                        result = compareTo._filename == _filename && (_lineNo + 1) >= compareTo._frame.StartLine && (compareTo._lineNo + 1) <= compareTo._frame.EndLine;
                    }
                    else
                    {
                        result = this._lineNo == compareTo._lineNo && this._filename == compareTo._filename;
                    }
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
                    result = _filename == compareTo._filename;
                    break;

                case enum_CONTEXT_COMPARE.CONTEXT_SAME_PROCESS:
                    result = true;
                    break;

                default:
                    // A new comparison was invented that we don't support
                    return(VSConstants.E_NOTIMPL);
                }

                if (result)
                {
                    foundIndex = c;
                    return(VSConstants.S_OK);
                }
            }

            return(VSConstants.S_FALSE);
        }
Example #5
0
 // 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);
 }