Example #1
0
 public ThreadContext(ulong?addr, MITextPosition textPosition, string function, uint level, string from)
 {
     pc           = addr;
     sp           = 0;
     TextPosition = textPosition;
     Function     = function;
     Level        = level;
     From         = from;
 }
Example #2
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, Mono.Debugger.Soft.StackFrame threadContext)
        {
            Debug.Assert(threadContext != null, "ThreadContext is null");

            Engine        = engine;
            Thread        = thread;
            ThreadContext = threadContext;

            _textPosition = RoslynHelper.GetStatementRange(ThreadContext.FileName, ThreadContext.LineNumber, ThreadContext.ColumnNumber);
            _functionName = threadContext.Method.Name;

            if (_textPosition != null)
            {
                docContext = new AD7DocumentContext(_textPosition);
            }

            this.LocalVariables = threadContext.GetVisibleVariables().Select(x => new MonoProperty(threadContext, x)).ToList();
        }
        // Enumerates the code contexts for a given position in a source file.
        public int EnumCodeContexts(IDebugDocumentPosition2 pDocPos, out IEnumDebugCodeContexts2 ppEnum)
        {
            string documentName;

            EngineUtils.CheckOk(pDocPos.GetFileName(out documentName));

            // Get the location in the document
            TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition   = new TEXT_POSITION[1];
            EngineUtils.CheckOk(pDocPos.GetRange(startPosition, endPosition));
            List <IDebugCodeContext2> codeContexts = new List <IDebugCodeContext2>();

            List <ulong> addresses = null;
            uint         line      = startPosition[0].dwLine + 1;

            _debuggedProcess.WorkerThread.RunOperation(async() =>
            {
                addresses = await DebuggedProcess.StartAddressesForLine(documentName, line);
            });

            if (addresses != null && addresses.Count > 0)
            {
                foreach (var a in addresses)
                {
                    var           codeCxt = new AD7MemoryAddress(this, a, null);
                    TEXT_POSITION pos;
                    pos.dwLine   = line;
                    pos.dwColumn = 0;
                    MITextPosition textPosition = new MITextPosition(documentName, pos, pos);
                    codeCxt.SetDocumentContext(new AD7DocumentContext(textPosition, codeCxt));
                    codeContexts.Add(codeCxt);
                }
                if (codeContexts.Count > 0)
                {
                    ppEnum = new AD7CodeContextEnum(codeContexts.ToArray());
                    return(VSConstants.S_OK);
                }
            }
            ppEnum = null;
            return(VSConstants.E_FAIL);
        }
Example #4
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, ThreadContext threadContext)
        {
            Debug.Assert(threadContext != null, "ThreadContext is null");

            Engine        = engine;
            Thread        = thread;
            ThreadContext = threadContext;

            _textPosition = threadContext.TextPosition;
            _functionName = threadContext.Function;

            if (_textPosition != null)
            {
                _documentCxt = new AD7DocumentContext(_textPosition, _codeCxt);

                if (_codeCxt != null)
                {
                    _codeCxt.SetDocumentContext(_documentCxt);
                }
            }
        }
Example #5
0
 public AD7DocumentContext(MITextPosition textPosition)//, AD7MemoryAddress codeContext)
 {
     _textPosition = textPosition;
     //_codeContext = codeContext;
 }