示例#1
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);
 }
示例#2
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);
 }
示例#3
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(_engine, compareTo._engine))
                {
                    continue;
                }

                bool result;

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

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

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

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

                case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                    result = (_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 = _lineNo == compareTo._lineNo && _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);
        }
示例#4
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);
 }