示例#1
0
        /// <summary>
        /// Gets the stack frame locals.
        /// </summary>
        /// <param name="block">The block.</param>
        /// <param name="relativeAddress">The relative address or uint.MaxValue if only first children are desired.</param>
        /// <param name="variables">The variables.</param>
        /// <param name="frame">The frame.</param>
        /// <param name="module">The module.</param>
        /// <param name="arguments">if set to <c>true</c> only arguments will be returned.</param>
        private static void GetFrameLocals(IDiaSymbol block, uint relativeAddress, List <Variable> variables, StackFrame frame, Module module, bool arguments)
        {
            IEnumerable <IDiaSymbol> symbols;

            if (relativeAddress != uint.MaxValue)
            {
                IDiaEnumSymbols symbolsEnum = block.findChildrenExByRVA(SymTagEnum.Null, null, 0, relativeAddress);

                symbols = symbolsEnum.Enum();
            }
            else
            {
                symbols = block.GetChildren(SymTagEnum.Data);
            }

            foreach (var symbol in symbols)
            {
                SymTagEnum tag = symbol.symTag;

                if (tag == SymTagEnum.Data)
                {
                    DataKind symbolDataKind = symbol.dataKind;

                    if ((arguments && symbolDataKind != DataKind.Param) || symbol.locationType == LocationType.Null)
                    {
                        continue;
                    }
                }
                else if (tag != SymTagEnum.FunctionArgType || !arguments)
                {
                    continue;
                }

                CodeType codeType     = module.TypesById[symbol.typeId];
                ulong    address      = ResolveAddress(module.Process, symbol, frame.FrameContext);
                var      variableName = symbol.name;

                variables.Add(Variable.CreateNoCast(codeType, address, variableName, variableName));
            }
        }
示例#2
0
        /// <summary>
        /// Gets the children using wildcard search: Applies a case-sensitive name match using asterisks (*) and question marks (?) as wildcards.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="nameWildcard">The name wildcard.</param>
        /// <param name="tag">The tag.</param>
        public static IEnumerable <IDiaSymbol> GetChildrenWildcard(this IDiaSymbol symbol, string nameWildcard, SymTagEnum tag = SymTagEnum.Null)
        {
            IDiaEnumSymbols symbols = symbol.findChildren(tag, nameWildcard, NameSearchOptions.RegularExpression);

            return(symbols.Enum());
        }
示例#3
0
        /// <summary>
        /// Gets the children.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="tag">The tag.</param>
        public static IEnumerable <IDiaSymbol> GetChildren(this IDiaSymbol symbol, SymTagEnum tag = SymTagEnum.Null)
        {
            IDiaEnumSymbols symbols = symbol.findChildren(tag, null, NameSearchOptions.None);

            return(symbols.Enum());
        }
示例#4
0
        /// <summary>
        /// Gets the child symbol.
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="name">The name.</param>
        /// <param name="tag">The tag.</param>
        public static IDiaSymbol GetChild(this IDiaSymbol symbol, string name, SymTagEnum tag = SymTagEnum.Null)
        {
            IDiaEnumSymbols symbols = symbol.findChildren(tag, name, NameSearchOptions.None);

            return(symbols.Enum().FirstOrDefault());
        }