当前位置: 首页>>代码示例>>C#>>正文


C# IDebugMemoryContext2类代码示例

本文整理汇总了C#中IDebugMemoryContext2的典型用法代码示例。如果您正苦于以下问题:C# IDebugMemoryContext2类的具体用法?C# IDebugMemoryContext2怎么用?C# IDebugMemoryContext2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IDebugMemoryContext2类属于命名空间,在下文中一共展示了IDebugMemoryContext2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadAt

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int ReadAt (IDebugMemoryContext2 pStartContext, uint dwCount, byte [] rgbMemory, out uint pdwRead, ref uint pdwUnreadable)
    {
      // 
      // Reads a sequence of bytes, starting at a given location.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        CONTEXT_INFO [] contextInfoArray = new CONTEXT_INFO [1];

        LoggingUtils.RequireOk (pStartContext.GetInfo (enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE, contextInfoArray));

        string command = string.Format ("-data-read-memory-bytes {0} {1}", contextInfoArray [0].bstrAddressAbsolute, dwCount);

        MiResultRecord resultRecord = m_debugger.GdbClient.SendSyncCommand (command);

        MiResultRecord.RequireOk (resultRecord, command);

        MiResultValueList memoryStreamList = (MiResultValueList) resultRecord ["memory"] [0];

        for (int s = 0; s < memoryStreamList.Values.Count; ++s)
        {
          if (!memoryStreamList [s].HasField ("contents"))
          {
            throw new InvalidOperationException ("-data-read-memory-bytes result missing 'contents' field");
          }

          string hexValue = memoryStreamList [s] ["contents"] [0].GetString ();

          if ((hexValue.Length / 2) != dwCount)
          {
            throw new InvalidOperationException ();
          }

          for (int i = 0; i < dwCount; ++i)
          {
            rgbMemory [i] = byte.Parse (hexValue.Substring (i * 2, 2), NumberStyles.HexNumber);
          }
        }

        pdwRead = dwCount;

        pdwUnreadable = 0;

        return Constants.S_OK;
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        pdwRead = 0;

        pdwUnreadable = dwCount;

        return Constants.E_FAIL;
      }
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:63,代码来源:CLangDebuggeeMemoryBytes.cs

示例2: Compare

 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="Compare">A value from the CONTEXT_COMPARE enumeration that determines the type of comparison.</param>
 /// <param name="rgpMemoryContextSet">An array of references to the IDebugMemoryContext2 objects to compare against.</param>
 /// <param name="dwMemoryContextSetLen">The number of contexts in the rgpMemoryContextSet array.</param>
 /// <param name="pdwMemoryContext">Returns the index of the first memory context that satisfies the comparison.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code. Returns E_COMPARE_CANNOT_COMPARE if the two contexts cannot be compared.</returns>
 /// <remarks>A debug engine (DE) does not have to support all types of comparisons, but it must support at least CONTEXT_EQUAL, CONTEXT_LESS_THAN, CONTEXT_GREATER_THAN and CONTEXT_SAME_SCOPE.</remarks>
 public virtual int Compare( enum_CONTEXT_COMPARE Compare,
     IDebugMemoryContext2[] rgpMemoryContextSet,
     uint dwMemoryContextSetLen,
     out uint pdwMemoryContext)
 {
     Logger.Debug( string.Empty );
     pdwMemoryContext = 0;
     return VSConstants.E_NOTIMPL;
 }
开发者ID:IntelliTect,项目名称:PowerStudio,代码行数:18,代码来源:CodeDocumentContext.cs

示例3: Compare

        public int Compare(enum_CONTEXT_COMPARE Compare, IDebugMemoryContext2[] rgpMemoryContextSet, uint dwMemoryContextSetLen, out uint pdwMemoryContext)
        {
            for(int i = 0; i < dwMemoryContextSetLen; ++i)
            {
                pdwMemoryContext = (uint)i;
                var other = rgpMemoryContextSet[i] as DebugCodeContext;
                if (other == null)
                    return HResults.E_COMPARE_CANNOT_COMPARE;

                var isSameMethod = Equals(Location.Class, other.Location.Class) && Equals(Location.Method, other.Location.Method);

                switch (Compare)
                {
                    case enum_CONTEXT_COMPARE.CONTEXT_EQUAL:
                        if (location.Equals(other.Location))
                            return VSConstants.S_OK;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN:
                        if (!isSameMethod) return HResults.E_COMPARE_CANNOT_COMPARE;

                        if(Location.CompareTo(other.Location) > 0)
                            return VSConstants.S_OK;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                        if (!isSameMethod) return HResults.E_COMPARE_CANNOT_COMPARE;
                        if (Location.CompareTo(other.Location) >= 0)
                            return VSConstants.S_OK;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN:
                        if (!isSameMethod) return HResults.E_COMPARE_CANNOT_COMPARE;
                        if (Location.CompareTo(other.Location) < 0)
                            return VSConstants.S_OK;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN_OR_EQUAL:
                        if (!isSameMethod) return HResults.E_COMPARE_CANNOT_COMPARE;
                        if (Location.CompareTo(other.Location) <= 0)
                            return VSConstants.S_OK;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_PROCESS:
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
                        return VSConstants.S_OK;
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
                        if(isSameMethod)
                            return VSConstants.S_OK;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
                        // TODO: analyze scopes.
                        if(isSameMethod)
                            return VSConstants.S_OK;
                        break;
                }
            }

            pdwMemoryContext = (uint)0;
            return VSConstants.S_FALSE;
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:56,代码来源:DebugCodeContext.cs

示例4: switch

        int IDebugMemoryContext2.Compare(enum_CONTEXT_COMPARE Compare, IDebugMemoryContext2[] rgpMemoryContextSet, uint dwMemoryContextSetLen, out uint pdwMemoryContext) {
            pdwMemoryContext = 0;

            for (int i = 0; i < rgpMemoryContextSet.Length; ++i) {
                var other = rgpMemoryContextSet[i] as AD7MemoryAddress;
                if (other == null || other.Engine != Engine) {
                    continue;
                }

                bool match = false;
                switch (Compare) {
                    case enum_CONTEXT_COMPARE.CONTEXT_EQUAL:
                        match = (LineNumber == other.LineNumber);
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN:
                        match = (LineNumber < other.LineNumber);
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN_OR_EQUAL:
                        match = (LineNumber <= other.LineNumber);
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN:
                        match = (LineNumber > other.LineNumber);
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                        match = (LineNumber >= other.LineNumber);
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_PROCESS:
                        match = true;
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
                        match = (FileName == other.FileName);
                        break;
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
                        match = (LineNumber == other.LineNumber && FileName == other.FileName);
                        break;
                    default:
                        return VSConstants.E_NOTIMPL;
                }

                if (match) {
                    pdwMemoryContext = (uint)i;
                    return VSConstants.S_OK;
                }
            }

            return VSConstants.S_FALSE;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:48,代码来源:AD7MemoryAddress.cs

示例5: Compare

 public int Compare(enum_CONTEXT_COMPARE Compare, IDebugMemoryContext2[] rgpMemoryContextSet,
     uint dwMemoryContextSetLen, out uint pdwMemoryContext)
 {
     throw new NotImplementedException();
 }
开发者ID:aluitink,项目名称:aspnet-debug2,代码行数:5,代码来源:AD7DocumentContext.cs

示例6: GetMemoryContext

 // Returns the memory context for a property value.
 public int GetMemoryContext(out IDebugMemoryContext2 ppMemory)
 {
     ppMemory = null;
     if (_variableInformation.Error)
         return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
     // try to interpret the result as an address
     string v = _variableInformation.Value;
     v = v.Trim();
     if (v.Length == 0)
     {
         return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
     }
     if (v[0] == '{')
     {
         // strip type name and trailing spaces
         v = v.Substring(v.IndexOf('}') + 1);
         v = v.Trim();
     }
     int i = v.IndexOf(' ');
     if (i > 0)
     {
         v = v.Substring(0, i);
     }
     uint addr;
     if (!UInt32.TryParse(v, System.Globalization.NumberStyles.Any, null, out addr))
     {
         if (v.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
         {
             v = v.Substring(2);
             if (!UInt32.TryParse(v, System.Globalization.NumberStyles.AllowHexSpecifier, null, out addr))
             {
                 return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
             }
         }
         else
         {
             return AD7_HRESULT.S_GETMEMORYCONTEXT_NO_MEMORY_CONTEXT;
         }
     }
     ppMemory = new AD7MemoryAddress(DebuggedProcess.g_Process.Engine, addr, null);
     return Constants.S_OK;
 }
开发者ID:robindegen,项目名称:MIEngine,代码行数:43,代码来源:AD7Property.cs

示例7: Subtract

 public int Subtract(ulong dwCount, out IDebugMemoryContext2 ppMemCxt)
 {
     throw new NotImplementedException();
 }
开发者ID:aluitink,项目名称:aspnet-debug2,代码行数:4,代码来源:AD7DocumentContext.cs

示例8:

 int IDebugProperty2.GetMemoryContext(out IDebugMemoryContext2 ppMemory) {
     ppMemory = null;
     return VSConstants.E_NOTIMPL;
 }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:4,代码来源:AD7Property.cs

示例9: Compare

        // 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 contextCompare, IDebugMemoryContext2[] compareToItems, uint compareToLength, out uint foundIndex)
        {
            foundIndex = uint.MaxValue;

            try
            {
                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 = (_address == compareTo._address);
                            break;

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

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

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

                        case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                            result = (_address >= compareTo._address);
                            break;

                        // The debug engine doesn't understand scopes
                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
                            result = (_address == compareTo._address);
                            break;

                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
                            if (_address == compareTo._address)
                            {
                                result = true;
                                break;
                            }
                            string funcThis = Engine.GetAddressDescription(_address);
                            if (string.IsNullOrEmpty(funcThis))
                            {
                                result = false;
                                break;
                            }
                            string funcCompareTo = Engine.GetAddressDescription(compareTo._address);
                            result = (funcThis == funcCompareTo);
                            break;

                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
                            result = (_address == compareTo._address);
                            if (result == false)
                            {
                                DebuggedModule module = _engine.DebuggedProcess.ResolveAddress(_address);

                                if (module != null)
                                {
                                    result = module.AddressInModule(compareTo._address);
                                }
                            }
                            break;

                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_PROCESS:
                            result = true;
                            break;

                        default:
                            // A new comparison was invented that we don't support
                            return Constants.E_NOTIMPL;
                    }

                    if (result)
                    {
                        foundIndex = c;
                        return Constants.S_OK;
                    }
                }

                return Constants.S_FALSE;
            }
            catch (MIException e)
            {
                return e.HResult;
//.........这里部分代码省略.........
开发者ID:robindegen,项目名称:MIEngine,代码行数:101,代码来源:AD7MemoryAddress.cs

示例10: GetMemoryContext

 /// <summary>
 /// Returns the memory context for a property value. (http://msdn.microsoft.com/en-ca/library/bb147028.aspx)
 /// Not implemented. 
 /// </summary>
 /// <param name="ppMemory"> Returns the IDebugMemoryContext2 object that represents the memory associated with this property. </param>
 /// <returns> Not implemented. </returns>
 public int GetMemoryContext(out IDebugMemoryContext2 ppMemory)
 {
     throw new Exception("The method or operation is not implemented.");
 }
开发者ID:blackberry,项目名称:VSPlugin,代码行数:10,代码来源:AD7Property.cs

示例11: Compare

 public int Compare(enum_CONTEXT_COMPARE Compare, IDebugMemoryContext2[] rgpMemoryContextSet, uint dwMemoryContextSetLen, out uint pdwMemoryContext)
 {
     pdwMemoryContext = 0;
     return VSConstants.E_FAIL;
 }
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:5,代码来源:DebugDocumentCodeContext.cs

示例12: Subtract

 // 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, _address - (uint)dwCount, null);
     return Constants.S_OK;
 }
开发者ID:robindegen,项目名称:MIEngine,代码行数:6,代码来源:AD7MemoryAddress.cs

示例13:

 int IDebugCodeContext2.Subtract(ulong dwCount, out IDebugMemoryContext2 ppMemCxt) {
     return IDebugMemoryContext2.Subtract(dwCount, out ppMemCxt);
 }
开发者ID:Microsoft,项目名称:RTVS,代码行数:3,代码来源:AD7MemoryAddress.cs

示例14: Compare

        // 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;

            try
            {
                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(this.m_engine, compareTo.m_engine))
                    {
                        continue;
                    }

                    bool result;

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

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

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

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

                        case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                            result = (this.m_address >= compareTo.m_address);
                            break;

                        // The sample debug engine doesn't understand scopes or functions
                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
                            result = (this.m_address == compareTo.m_address);
                            break;

                        case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
                            result = (this.m_address == compareTo.m_address);
                            if (result == false)
                            {
                                //DebuggedModule module = m_engine.DebuggedProcess.ResolveAddress(m_address);

                                //if (module != null)
                                //{
                                //    result = (compareTo.m_address >= module.BaseAddress) &&
                                //        (compareTo.m_address < module.BaseAddress + module.Size);
                                //}
                            }
                            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;
            }
            //catch (ComponentException e)
            //{
            //    return e.HResult;
            //}
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }
        }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:94,代码来源:AD7MemoryAddress.cs

示例15: Subtract

 // 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(m_engine, (uint)dwCount - m_address);
     return VSConstants.S_OK;
 }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:6,代码来源:AD7MemoryAddress.cs


注:本文中的IDebugMemoryContext2类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。