internal ChildScopeData(SymMethod symMethod, ScopeData parent, LocalScopeHandle handle)
            : base(symMethod)
        {
            Debug.Assert(parent != null);
            Debug.Assert(!handle.IsNil);

            _handle = handle;
            _parent = parent;
        }
Пример #2
0
        public int GetMethodByVersion(int methodToken, int version, out ISymUnmanagedMethod retVal)
        {
            var hr = _reader.GetMethodByVersion(methodToken, version, out retVal);

            if (retVal != null)
            {
                retVal = new SymMethod(this, retVal);
            }
            return(hr);
        }
Пример #3
0
 internal RootScopeData(SymMethod symMethod)
     : base(symMethod)
 {
 }
Пример #4
0
        public ISymbolMethod[] GetMethodsFromDocumentPosition(
				ISymbolDocument document, int line, int column)
        {
            ISymUnmanagedMethod[] unmanagedMethods;
            ISymbolMethod[] methods;
            int count = 0;
            uint i;
            m_reader.GetMethodsFromDocumentPosition(((SymbolDocument)document).InternalDocument, line, column, 0, out count, null);
            unmanagedMethods = new ISymUnmanagedMethod[count];
            m_reader.GetMethodsFromDocumentPosition(((SymbolDocument)document).InternalDocument, line, column, count, out count, unmanagedMethods);
            methods = new ISymbolMethod[count];

            for (i = 0; i < count; i++)
            {
                methods[i] = new SymMethod(unmanagedMethods[i]);
            }
            return methods;
        }
Пример #5
0
        internal int GetMethodSourceExtentInDocument(ISymUnmanagedDocument document, SymMethod method, out int startLine, out int endLine)
        {
            var symDocument = AsSymDocument(document);
            if (symDocument == null)
            {
                startLine = endLine = 0;
                return HResult.E_INVALIDARG;
            }

            var map = GetMethodMap();
            if (!map.TryGetMethodSourceExtent(symDocument.Handle, method.DebugHandle, out startLine, out endLine))
            {
                startLine = endLine = 0;
                return HResult.E_FAIL;
            }

            return HResult.S_OK;
        }
Пример #6
0
        public int GetMethodByVersion(
            int methodToken, 
            int version,
            [MarshalAs(UnmanagedType.Interface)]out ISymUnmanagedMethod method)
        {
            if (version != _version)
            {
                method = null;
                return HResult.E_INVALIDARG;
            }

            var handle = MetadataTokens.Handle(methodToken);
            if (handle.Kind != HandleKind.MethodDefinition)
            {
                method = null;
                return HResult.E_INVALIDARG;
            }

            var methodDefHandle = (MethodDefinitionHandle)handle;

            var methodBody = MetadataReader.GetMethodBody(methodDefHandle);
            if (methodBody.SequencePoints.IsNil)
            {
                // no debug info for the method
                method = null;
                return HResult.E_FAIL;
            }

            method = new SymMethod(this, methodDefHandle);
            return HResult.S_OK;
        }
Пример #7
0
        public int GetMethodsInDocument(
            ISymUnmanagedDocument document,
            int bufferLength,
            out int count,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out]ISymUnmanagedMethod[] methods)
        {
            var symDocument = AsSymDocument(document);
            if (symDocument == null)
            {
                count = 0;
                return HResult.E_INVALIDARG;
            }

            var extentsByMethod = GetMethodMap().GetMethodExtents(symDocument.Handle);
            if (bufferLength > 0)
            {
                int actualCount = Math.Min(extentsByMethod.Length, bufferLength);
                for (int i = 0; i < actualCount; i++)
                {
                    methods[i] = new SymMethod(this, extentsByMethod[i].Method);
                }

                count = actualCount;
            }
            else
            {
                count = extentsByMethod.Length;
            }

            count = 0;
            return HResult.S_OK;
        }
Пример #8
0
        public int GetMethodsFromDocumentPosition(
            ISymUnmanagedDocument document,
            int line,
            int column,
            int bufferLength,
            out int count,
            [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3), Out]ISymUnmanagedMethod[] methods)
        {
            var symDocument = AsSymDocument(document);
            if (symDocument == null)
            {
                count = 0;
                return HResult.E_INVALIDARG;
            }

            var methodBodyHandles = GetMethodMap().GetMethodsContainingLine(symDocument.Handle, line);
            if (methodBodyHandles == null)
            {
                count = 0;
                return HResult.E_FAIL;
            }

            if (bufferLength > 0)
            {
                int i = 0;
                foreach (var methodDebugHandle in methodBodyHandles)
                {
                    if (i == bufferLength)
                    {
                        break;
                    }

                    methods[i++] = new SymMethod(this, methodDebugHandle);
                }

                count = i;

                if (i > 1)
                {
                    Array.Sort(methods, 0, i, SymMethod.ByHandleComparer.Default);
                }
            }
            else
            {
                count = methodBodyHandles.Count();
            }

            return HResult.S_OK;
        }
Пример #9
0
        public int GetMethodFromDocumentPosition(
            ISymUnmanagedDocument document,
            int line,
            int column,
            [MarshalAs(UnmanagedType.Interface)]out ISymUnmanagedMethod method)
        {
            var symDocument = AsSymDocument(document);
            if (symDocument == null)
            {
                method = null;
                return HResult.E_INVALIDARG;
            }

            var methodBodyHandles = GetMethodMap().GetMethodsContainingLine(symDocument.Handle, line);
            if (methodBodyHandles == null)
            {
                method = null;
                return HResult.E_FAIL;
            }

            var comparer = HandleComparer.Default;
            var candidate = default(MethodDebugInformationHandle);
            foreach (var methodDebugHandle in methodBodyHandles)
            {
                if (candidate.IsNil || comparer.Compare(methodDebugHandle, candidate) < 0)
                {
                    candidate = methodDebugHandle;
                }
            }

            if (candidate.IsNil)
            {
                method = null;
                return HResult.E_FAIL;
            }

            method = new SymMethod(this, candidate);
            return HResult.S_OK;
        }
Пример #10
0
 internal SymVariable(SymMethod symMethod, LocalVariableHandle handle)
 {
     Debug.Assert(symMethod != null);
     _symMethod = symMethod;
     _handle = handle;
 }
Пример #11
0
 internal ScopeData(SymMethod symMethod)
 {
     Debug.Assert(symMethod != null);
     SymMethod = symMethod;
 }