예제 #1
0
 IEnumerator IEnumerable.GetEnumerator()
 {
     MDbgAppDomain[] ret = new MDbgAppDomain[m_items.Count];
     m_items.Values.CopyTo(ret, 0);
     Array.Sort(ret);
     return(ret.GetEnumerator());
 }
예제 #2
0
파일: Appdomain.cs 프로젝트: Orvid/Cosmos
 IEnumerator IEnumerable.GetEnumerator()
 {
     MDbgAppDomain[] ret = new MDbgAppDomain[m_items.Count];
     m_items.Values.CopyTo(ret,0);
     Array.Sort(ret);
     return ret.GetEnumerator();
 }
예제 #3
0
        internal MDbgAppDomain Register(CorAppDomain appDomain)
        {
            MDbgAppDomain mdbgAppDomain;

            // appdomains may get registered mutliple times if we get a fake-attach event right before a real event.
            if (!m_items.Contains(appDomain))
            {
                mdbgAppDomain = new MDbgAppDomain(m_process, appDomain, m_freeAppDomainNumber++);
                m_items.Add(appDomain, mdbgAppDomain);
                return(mdbgAppDomain);
            }
            return((MDbgAppDomain)m_items[appDomain]);
        }
예제 #4
0
 /// <summary>
 /// Allows for indexing into the Collection by appDomainNumber
 /// </summary>
 /// <param name="appDomainNumber">Which appDomainNumber to access.</param>
 /// <returns>The MDbgAppDomain with the given number.</returns>
 public MDbgAppDomain this[int appDomainNumber]
 {
     get
     {
         MDbgAppDomain appDomain = null;
         foreach (MDbgAppDomain ad in m_items.Values)
         {
             if (ad.Number == appDomainNumber)
             {
                 appDomain = ad;
                 break;
             }
         }
         return(appDomain);
     }
 }
예제 #5
0
 /// <summary>
 /// Returns an appdomain from its name.
 /// </summary>
 /// <value>
 ///     Returns null if there is no appdomain with passed-in name.
 /// </value>
 /// <exception cref="MDbgAmbiguousModuleNameException">
 /// Thrown when there are multiple appdomains with same name.
 /// </exception>
 public MDbgAppDomain this[string appDomainName]
 {
     get
     {
         MDbgAppDomain appDomain = null;
         foreach (MDbgAppDomain ad in m_items.Values)
         {
             if (String.Compare(ad.CorAppDomain.Name, appDomainName) == 0)
             {
                 if (appDomain == null)
                 {
                     appDomain = ad;
                 }
                 else
                 {
                     throw new MDbgAmbiguousModuleNameException();
                 }
             }
         }
         return(appDomain);
     }
 }
예제 #6
0
        /// <summary>
        /// Returns a string that represents current frame
        /// Currently supported formats:
        /// null or empty string: returns short frame format (just frame name)
        /// "v"                 : returns long frame format (including module &amp; arguments)
        /// </summary>
        /// <param name="format">Which format to use.</param>
        /// <returns>The formatted string that represtents the current frame.</returns>
        public override string ToString(string format)
        {
            string fn;

            switch (m_frame.FrameType)
            {
            case CorFrameType.ILFrame:
                MDbgSourcePosition sl = SourcePosition;
                string             sp;

                if (sl != null)
                {
                    string filePath = sl.Path;
                    if (!Thread.m_threadMgr.m_process.m_engine.Options.ShowFullPaths)
                    {
                        filePath = Path.GetFileName(sl.Path);
                    }
                    sp = " (" + filePath + ":" + sl.Line.ToString(System.Globalization.CultureInfo.CurrentUICulture) + ")";
                }
                else
                {
                    sp = " (source line information unavailable)";
                }

                StringBuilder sbFuncName = new StringBuilder();

                MDbgModule  module = this.Function.Module;
                MDbgProcess proc   = Thread.m_threadMgr.m_process;


                // Get class name w/ generic args.
                CorType tClass = this.FunctionType;
                if (tClass != null)
                {
                    InternalUtil.PrintCorType(sbFuncName, proc, tClass);
                }

                sbFuncName.Append('.');


                // Get method name w/ generic args.
                MethodInfo mi = this.Function.MethodInfo;
                sbFuncName.Append(mi.Name);
                InternalUtil.AddGenericArgs(sbFuncName, proc, this.FunctionTypeParameters);


                string stFuncName = sbFuncName.ToString();

                if (format == "v")
                {
                    CorModule m = module.CorModule;
                    // verbose frame output
                    // in verbose output we'll print module name + arguments to the functions
                    StringBuilder sb     = new StringBuilder();
                    bool          bFirst = true;
                    foreach (MDbgValue v in this.Function.GetArguments(this))
                    {
                        if (sb.Length != 0)
                        {
                            sb.Append(", ");
                        }
                        // skip this references
                        if (!(bFirst && v.Name == "this"))
                        {
                            sb.Append(v.Name).Append("=").Append(v.GetStringValue(0));
                        }
                        bFirst = false;
                    }

                    if (m.IsDynamic || m.IsInMemory)
                    {
                        fn = m.Name;
                    }
                    else
                    {
                        fn = System.IO.Path.GetFileName(m.Name);
                    }

                    MDbgAppDomain ad = this.Thread.m_threadMgr.m_process.AppDomains.Lookup(m.Assembly.AppDomain);
                    fn += "#" + ad.Number
                          + "!" + stFuncName + "(" + sb.ToString() + ") " + sp;
                }
                else
                {
                    fn = stFuncName + sp;
                }
                break;

            case CorFrameType.NativeFrame:
                fn = "[IL Method without Metadata]";
                break;

            case CorFrameType.InternalFrame:
                switch (m_frame.InternalFrameType)
                {
                case CorDebugInternalFrameType.STUBFRAME_NONE:
                    fn = "None";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_M2U:
                    fn = "M-->U";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_U2M:
                    fn = "U-->M";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_APPDOMAIN_TRANSITION:
                    fn = "AD Switch";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_LIGHTWEIGHT_FUNCTION:
                    fn = "LightWeight";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_FUNC_EVAL:
                    fn = "FuncEval";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_INTERNALCALL:
                    fn = "InternalCall";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_CLASS_INIT:
                    fn = "ClassInit";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_EXCEPTION:
                    fn = "Exception";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_SECURITY:
                    fn = "Security";
                    break;

                case CorDebugInternalFrameType.STUBFRAME_JIT_COMPILATION:
                    fn = "JitCompilation";
                    break;

                default:
                    fn = "UNKNOWN";
                    break;
                }
                fn = "[Internal Frame, '" + fn + "']";
                break;

            default:
                fn = "UNKNOWN Frame Type";
                break;
            }
            return(fn);
        }
예제 #7
0
        internal MDbgAppDomain Register(CorAppDomain appDomain)
        {
            MDbgAppDomain mdbgAppDomain;

            // appdomains may get registered mutliple times if we get a fake-attach event right before a real event.
            if (!m_items.Contains(appDomain))
            {
                mdbgAppDomain = new MDbgAppDomain(m_process, appDomain, m_freeAppDomainNumber++);
                m_items.Add(appDomain, mdbgAppDomain);
                return mdbgAppDomain;
            }
            return (MDbgAppDomain)m_items[appDomain];
        }