コード例 #1
0
 public SymbolValue(string name, string typeName, string strValue, uint size, DEBUG_SYMBOL_ENTRY debugSymbolEntry, DEBUG_SYMBOL_PARAMETERS debugSymbolParameters)
 {
     Name                  = name;
     TypeName              = typeName;
     StrValue              = strValue;
     Size                  = size;
     DebugSymbolEntry      = debugSymbolEntry;
     DebugSymbolParameters = debugSymbolParameters;
 }
コード例 #2
0
        } // end WireUpChildren()

        /// <summary>
        ///    Creates a new DbgLocalSymbol object.
        /// </summary>
        internal DbgLocalSymbol(DbgSymbolGroup symGroup,
                                uint idx,
                                string name,
                                DEBUG_SYMBOL_PARAMETERS symParams,
                                DEBUG_SYMBOL_ENTRY?dse,
                                DbgTarget target)
            : base(_GetDebugger(symGroup), name, target)
        {
            if (null == symGroup)
            {
                throw new ArgumentNullException("symGroup");
            }

            m_symGroup            = symGroup;
            m_idx                 = idx;
            m_nativeParams        = symParams;
            m_dse                 = dse;
            m_metaDataUnavailable = (null == dse);

            if (!m_metaDataUnavailable && DbgTypeInfo.IsDbgGeneratedType(m_dse.Value.TypeId))
            {
                // HACK HACKALERT WORKAROUND
                //
                // This is a workaround for the fact that we can't get at the type
                // information that the debugger generates. It tends to do this to create
                // pointer types, pointing to UDTs (not sure why the pointer types don't
                // exist in the PDB).
                //
                // It of course knows what the pointee type is, but it isn't exposed in
                // any way. I'd like to add a new IDebugAdvancedN::Request request to grab
                // it out, but until I get to that, I'll cheat and parse it out of some
                // string output.
                //
                // I don't know how robust this is, because I've rarely seen it (only once
                // with this code).
                //
                _GenerateSyntheticTypeToMatchDbgEngGeneratedType(name, Debugger, m_dse.Value);
            } // end if( it's a debugger-generated type )

            m_pointerAdjustment = 0;
            if (0 == Util.Strcmp_OI(name, "this"))
            {
                try
                {
                    ulong displacementDontCare;
                    var   sym  = Debugger.GetSymbolByAddress(symGroup.Frame.InstructionPointer, out displacementDontCare);
                    var   ftti = sym.Type as DbgFunctionTypeTypeInfo;
                    Util.Assert(null != ftti);   // if we made it this far, we should have the right type
                    m_pointerAdjustment = ftti.ThisAdjust;
                }
                catch (DbgEngException dee)
                {
                    LogManager.Trace("Could not get thisadjust: {0}", Util.GetExceptionMessages(dee));
                }
            }
        } // end constructor
コード例 #3
0
 internal void Refresh(uint idx,
                       DEBUG_SYMBOL_PARAMETERS nativeParams,
                       DEBUG_SYMBOL_ENTRY?dse)
 {
     if (null != m_orphanChildren)
     {
         m_orphanChildren.Clear(); // in preparation for WireUpChildren being called again.
     }
     m_idx          = idx;
     m_nativeParams = nativeParams;
     m_dse          = dse;
 } // end Refresh()
コード例 #4
0
 private DEBUG_SYMBOL_PARAMETERS[] GetSymbolParameters(uint start, uint count)
 {
     DEBUG_SYMBOL_PARAMETERS[] parameters = new DEBUG_SYMBOL_PARAMETERS[count];
     if (count > 0)
     {
         int res = _group.GetSymbolParameters(start, count, parameters);
         if (res != 0)
         {
             ThrowDebuggerException(res, "IDebugSymbolGroups2.GetSymbolParameters");
         }
     }
     return(parameters);
 }
コード例 #5
0
ファイル: SymbolIdentity.cs プロジェクト: zha0/DbgShell
        } // end constructor

        public SymbolIdentity(string name,
                              DEBUG_SYMBOL_PARAMETERS nativeParams,
                              DEBUG_SYMBOL_ENTRY?dse,
                              DbgEngContext processContext)
        {
            Name       = name;
            ModuleBase = nativeParams.Module;
            if (null == dse)
            {
                Offset = DebuggerObject.InvalidAddress;
            }
            else
            {
                Offset = ((DEBUG_SYMBOL_ENTRY)dse).Offset;
            }

            _SetContext(processContext);
        } // end constructor
コード例 #6
0
ファイル: WinDbgWrapper.cs プロジェクト: sihaisz/windbg-debug
        private IEnumerable<Variable> DoGetVariablesFromSymbols(IDebugSymbolGroup2 symbols, uint startIndex, uint parentSymbolListIndex, int parentId)
        {
            List<Variable> result = new List<Variable>();
            uint variableCount;
            var hr = symbols.GetNumberSymbols(out variableCount);
            if (hr != HResult.Ok)
                return result;

            DEBUG_SYMBOL_PARAMETERS[] parameters = new DEBUG_SYMBOL_PARAMETERS[variableCount];
            hr = symbols.GetSymbolParameters(0, variableCount, parameters);
            if (hr != HResult.Ok)
                return result;

            for (uint variableIndex = startIndex; variableIndex < variableCount; variableIndex++)
            {
                if (parentSymbolListIndex != Defaults.NoParent && !IsChild(parentSymbolListIndex, parameters, variableIndex))
                    continue;

                DEBUG_SYMBOL_ENTRY entry;
                symbols.GetSymbolEntryInformation(variableIndex, out entry);

                StringBuilder buffer = new StringBuilder(Defaults.BufferSize);
                uint nameSize;

                hr = symbols.GetSymbolNameWide(variableIndex, buffer, Defaults.BufferSize, out nameSize);
                if (hr != HResult.Ok)
                    continue;
                var variableName = buffer.ToString();

                hr = symbols.GetSymbolTypeNameWide(variableIndex, buffer, Defaults.BufferSize, out nameSize);
                if (hr != HResult.Ok)
                    continue;
                var typeName = buffer.ToString();

                hr = symbols.GetSymbolValueTextWide(variableIndex, buffer, Defaults.BufferSize, out nameSize);
                if (hr != HResult.Ok)
                    continue;
                var value = buffer.ToString();

                var typedData = _requestHelper.CreateTypedData(entry.ModuleBase, entry.Offset, entry.TypeId);
                VisualizationResult handledVariable;
                Variable variable;
                if (_visualizers.TryHandle(new VariableMetaData(variableName, typeName, typedData), out handledVariable))
                {
                    variable = State.AddVariable(
                        parentId,
                        (id) => new Variable(id, variableName, typeName, handledVariable.Value, handledVariable.HasChildren),
                        typedData);
                }
                else
                {
                    bool hasChildren = false;
                    if (parameters.Length > variableIndex)
                        hasChildren = parameters[variableIndex].SubElements > 0;

                    variable = State.AddVariable(parentId, (id) => new Variable(id, variableName, typeName, value, hasChildren), typedData);
                }
                result.Add(variable);
            }

            return result;
        }
コード例 #7
0
 public void AddSymbol(string name, string typeName, string strValue, uint size, DEBUG_SYMBOL_ENTRY debugSymbolEntry, DEBUG_SYMBOL_PARAMETERS debugSymbolParameters)
 {
     _symbols.Add(new SymbolValue(name, typeName, strValue, size, debugSymbolEntry, debugSymbolParameters));
 }