コード例 #1
0
        public dynamic GetValue(ClrAppDomain appDomain)
        {
            if (m_field.IsPrimitive())
            {
                object value = m_field.GetFieldValue(appDomain);
                if (value != null)
                    return new ClrPrimitiveValue(value, m_field.ElementType);
            }
            else if (m_field.IsValueClass())
            {
                ulong addr = m_field.GetFieldAddress(appDomain);
                if (addr != 0)
                    return new ClrObject(m_heap, m_field.Type, addr, true);
            }
            else if (m_field.ElementType == ClrElementType.String)
            {
                ulong addr = m_field.GetFieldAddress(appDomain);
                if (m_heap.GetRuntime().ReadPointer(addr, out addr))
                    return new ClrObject(m_heap, m_field.Type, addr);
            }
            else
            {
                object value = m_field.GetFieldValue(appDomain);
                if (value != null)
                    return new ClrObject(m_heap, m_field.Type, (ulong)value);
            }

            return new ClrNullValue(m_heap);
        }
コード例 #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ClrAppDomainAdapter" /> class.
 /// </summary>
 /// <param name="appDomain">The application domain.</param>
 /// <exception cref="ArgumentNullException">appDomain</exception>
 /// <inheritdoc />
 public ClrAppDomainAdapter(IConverter converter, ClrMd.ClrAppDomain appDomain) : base(converter)
 {
     AppDomain         = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
     Address           = AppDomain.Address;
     ApplicationBase   = AppDomain.ApplicationBase;
     ConfigurationFile = AppDomain.ConfigurationFile;
     Id   = AppDomain.Id;
     Name = AppDomain.Name;
 }
コード例 #3
0
        /// <summary>
        ///     Converts the specified application domain.
        /// </summary>
        /// <param name="appDomain">The application domain.</param>
        /// <returns>IClrAppDomain.</returns>
        public IClrAppDomain Convert(ClrMd.ClrAppDomain appDomain)
        {
            if (appDomain == null)
            {
                return(null);
            }
            var item = new ClrAppDomainAdapter(this, appDomain);

            return(Cache.GetOrAdd <IClrAppDomain>(appDomain, () => item, () => item.Setup()));
        }
コード例 #4
0
ファイル: modules.cs プロジェクト: mwatts/clrmd
 internal override Address GetDomainModule(ClrAppDomain appDomain)
 {
     return 0;
 }
コード例 #5
0
ファイル: modules.cs プロジェクト: mwatts/clrmd
 internal abstract Address GetDomainModule(ClrAppDomain appDomain);
コード例 #6
0
ファイル: modules.cs プロジェクト: mwatts/clrmd
        internal override ulong GetDomainModule(ClrAppDomain domain)
        {
            _runtime.InitDomains();
            if (domain == null)
            {
                foreach (ulong addr in _mapping.Values)
                    return addr;

                return 0;
            }

            ulong value;
            if (_mapping.TryGetValue(domain, out value))
                return value;

            return 0;
        }
コード例 #7
0
 public MDAppDomain(ClrAppDomain ad)
 {
     m_appDomain = ad;
 }
コード例 #8
0
 /// <summary>
 /// Returns whether this static field has been initialized in a particular AppDomain
 /// or not.  If a static variable has not been initialized, then its class constructor
 /// may have not been run yet.  Calling GetFieldValue on an uninitialized static
 /// will result in returning either NULL or a value of 0.
 /// </summary>
 /// <param name="appDomain">The AppDomain to see if the variable has been initialized.</param>
 /// <returns>True if the field has been initialized (even if initialized to NULL or a default
 /// value), false if the runtime has not initialized this variable.</returns>
 abstract public bool IsInitialized(ClrAppDomain appDomain);
コード例 #9
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 /// <summary>
 /// Returns the address of the static field's value in memory.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's address.</param>
 /// <returns>The address of the field's value.</returns>
 abstract public Address GetAddress(ClrAppDomain appDomain);
コード例 #10
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 /// <summary>
 /// Returns whether this static field has been initialized in a particular AppDomain
 /// or not.  If a static variable has not been initialized, then its class constructor
 /// may have not been run yet.  Calling GetFieldValue on an uninitialized static
 /// will result in returning either NULL or a value of 0.
 /// </summary>
 /// <param name="appDomain">The AppDomain to see if the variable has been initialized.</param>
 /// <returns>True if the field has been initialized (even if initialized to NULL or a default
 /// value), false if the runtime has not initialized this variable.</returns>
 abstract public bool IsInitialized(ClrAppDomain appDomain);
コード例 #11
0
ファイル: public.cs プロジェクト: mwatts/clrmd
 /// <summary>
 /// Gets the value of the field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's value.</param>
 /// <param name="thread">The thread on which to get the field's value.</param>
 /// <returns>The value of the field.</returns>
 abstract public object GetValue(ClrAppDomain appDomain, ClrThread thread);
コード例 #12
0
ファイル: public.cs プロジェクト: mwatts/clrmd
 /// <summary>
 /// Gets the value of the static field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the value.</param>
 /// <returns>The value of this static field.</returns>
 abstract public object GetValue(ClrAppDomain appDomain);
コード例 #13
0
 /// <summary>
 /// Gets the value of the field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's value.</param>
 /// <param name="thread">The thread on which to get the field's value.</param>
 /// <returns>The value of the field.</returns>
 virtual public object GetValue(ClrAppDomain appDomain, ClrThread thread)
 {
     return(GetValue(appDomain, thread, true));
 }
コード例 #14
0
 /// <summary>
 /// Returns the address of the static field's value in memory.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's address.</param>
 /// <returns>The address of the field's value.</returns>
 abstract public ulong GetAddress(ClrAppDomain appDomain);
コード例 #15
0
 /// <summary>
 /// Gets the value of the static field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the value.</param>
 /// <param name="convertStrings">When true, the value of a string field will be
 /// returned as a System.String object; otherwise the address of the String object will be returned.</param>
 /// <returns>The value of this static field.</returns>
 abstract public object GetValue(ClrAppDomain appDomain, bool convertStrings);
コード例 #16
0
 /// <summary>
 /// Gets the value of the static field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the value.</param>
 /// <returns>The value of this static field.</returns>
 virtual public object GetValue(ClrAppDomain appDomain)
 {
     return(GetValue(appDomain, true));
 }
コード例 #17
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 virtual public object GetFieldValue(ClrAppDomain domain)
 {
     return GetValue(domain);
 }
コード例 #18
0
ファイル: public.cs プロジェクト: mwatts/clrmd
        internal ClrHandle(Microsoft.Diagnostics.Runtime.Desktop.V45Runtime clr, ClrHeap heap, Microsoft.Diagnostics.Runtime.Desktop.HandleData handleData)
        {
            Address obj;
            Address = handleData.Handle;
            clr.ReadPointer(Address, out obj);

            Object = obj;
            Type = heap.GetObjectType(obj);

            uint refCount = 0;

            if (handleData.Type == (int)HandleType.RefCount)
            {
                if (handleData.IsPegged != 0)
                    refCount = handleData.JupiterRefCount;

                if (refCount < handleData.RefCount)
                    refCount = handleData.RefCount;

                if (Type != null)
                {
                    if (Type.IsCCW(obj))
                    {
                        CcwData data = Type.GetCCWData(obj);
                        if (data != null && refCount < data.RefCount)
                            refCount = (uint)data.RefCount;
                    }
                    else if (Type.IsRCW(obj))
                    {
                        RcwData data = Type.GetRCWData(obj);
                        if (data != null && refCount < data.RefCount)
                            refCount = (uint)data.RefCount;
                    }
                }

                RefCount = refCount;
            }


            HandleType = (HandleType)handleData.Type;
            AppDomain = clr.GetAppDomainByAddress(handleData.AppDomain);

            if (HandleType == HandleType.Dependent)
            {
                DependentTarget = handleData.Secondary;
                DependentType = heap.GetObjectType(handleData.Secondary);
            }
        }
コード例 #19
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 virtual public Address GetFieldAddress(ClrAppDomain domain)
 {
     return GetAddress(domain);
 }
コード例 #20
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 virtual public Address GetFieldAddress(ClrAppDomain domain, ClrThread thread)
 {
     return GetAddress(domain, thread);
 }
コード例 #21
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 /// <summary>
 /// Gets the value of the static field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the value.</param>
 /// <returns>The value of this static field.</returns>
 virtual public object GetValue(ClrAppDomain appDomain)
 {
     return GetValue(appDomain, true);
 }
コード例 #22
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 /// <summary>
 /// Gets the value of the field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's value.</param>
 /// <param name="thread">The thread on which to get the field's value.</param>
 /// <param name="convertStrings">When true, the value of a string field will be 
 /// returned as a System.String object; otherwise the address of the String object will be returned.</param>
 /// <returns>The value of the field.</returns>
 abstract public object GetValue(ClrAppDomain appDomain, ClrThread thread, bool convertStrings);
コード例 #23
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 virtual public object GetFieldValue(ClrAppDomain domain, ClrThread thread)
 {
     return GetValue(domain, thread);
 }
コード例 #24
0
 /// <summary>
 /// Gets the address of the field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's address.</param>
 /// <param name="thread">The thread on which to get the field's address.</param>
 /// <returns>The address of the field.</returns>
 abstract public ulong GetAddress(ClrAppDomain appDomain, ClrThread thread);
コード例 #25
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 /// <summary>
 /// Gets the value of the field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's value.</param>
 /// <param name="thread">The thread on which to get the field's value.</param>
 /// <returns>The value of the field.</returns>
 virtual public object GetValue(ClrAppDomain appDomain, ClrThread thread)
 {
     return GetValue(appDomain, thread, true);
 }
コード例 #26
0
ファイル: modules.cs プロジェクト: mwatts/clrmd
 internal void AddMapping(ClrAppDomain domain, ulong domainModule)
 {
     DesktopAppDomain appDomain = (DesktopAppDomain)domain;
     _mapping[domain] = domainModule;
 }
コード例 #27
0
ファイル: types.cs プロジェクト: kailer89/clrmd
 /// <summary>
 /// Gets the address of the field.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's address.</param>
 /// <param name="thread">The thread on which to get the field's address.</param>
 /// <returns>The address of the field.</returns>
 abstract public Address GetAddress(ClrAppDomain appDomain, ClrThread thread);
コード例 #28
0
 /// <summary>
 /// Returns the address of the static field's value in memory.
 /// </summary>
 /// <param name="appDomain">The AppDomain in which to get the field's address.</param>
 /// <returns>The address of the field's value.</returns>
 abstract public Address GetAddress(ClrAppDomain appDomain);