//
        // IEnumerator interface
        //

        #region IEnumerator Members

        public bool MoveNext()
        {
            var a = new ICorDebugAppDomain[1];
            uint c = 0;
            int r = m_enum.Next((uint) a.Length, a, out c);
            if (r == 0 && c == 1) // S_OK && we got 1 new element
                m_ad = new CorAppDomain(a[0]);
            else
                m_ad = null;
            return m_ad != null;
        }
Esempio n. 2
0
        /// <summary>
        /// Resolves a Function from a Module, Class Name, Function Name, and AppDomain.
        /// </summary>
        /// <param name="moduleName">The Module name that has the Function.</param>
        /// <param name="className">The name of the Class that has the Function.</param>
        /// <param name="functionName">The name of the Function.</param>
        /// <param name="appDomain">The AppDomain to look in.</param>
        /// <returns>The MDbgFunction that matches the given parameters.</returns>
        public MDbgFunction ResolveFunctionName(string moduleName, string className, string functionName,
                                                CorAppDomain appDomain)
        {
            Debug.Assert(className != null);
            Debug.Assert(functionName != null);


            MDbgFunction func = null;

            if (moduleName != null)
            {
                MDbgModule module = Modules.Lookup(moduleName);
                if (module != null)
                {
                    CorAppDomain moduleAppDomain = module.CorModule.Assembly.AppDomain;
                    if (moduleAppDomain == null // not a shared assembly
                        || appDomain == null // we don't limit us to the certain appDomain
                        || appDomain == moduleAppDomain // the module is from correct domain
                        )
                    {
                        func = ResolveFunctionName(module, className, functionName);
                    }
                }
            }
            else
            {
                foreach (MDbgModule m in Modules)
                {
                    CorAppDomain moduleAppDomain = m.CorModule.Assembly.AppDomain;
                    if (moduleAppDomain == null // is a shared assembly
                        || appDomain == null // we don't limit us to the certain appDomain
                        || appDomain == moduleAppDomain // the module is from correct domain
                        )
                    {
                        func = ResolveFunctionName(m, className, functionName);
                        if (func != null)
                            break;
                    }
                }
            }

            return func;
        }
 public CorModuleEventArgs(CorAppDomain appDomain, CorModule managedModule)
     : base(appDomain)
 {
     m_managedModule = managedModule;
 }
 public CorClassEventArgs(CorAppDomain appDomain, CorClass managedClass)
     : base(appDomain)
 {
     m_class = managedClass;
 }
 public CorExceptionEventArgs(CorAppDomain appDomain,
                              CorThread thread,
                              bool unhandled)
     : base(appDomain, thread)
 {
     m_unhandled = unhandled;
 }
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                         CorEval eval)
     : base(appDomain, thread)
 {
     m_eval = eval;
 }
 public CorException2EventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               CorFrame frame,
                               int offset,
                               CorDebugExceptionCallbackType eventType,
                               int flags,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_frame = frame;
     m_offset = offset;
     m_eventType = eventType;
     m_flags = flags;
 }
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                 CorStepper stepper, CorDebugStepReason stepReason)
     : base(appDomain, thread)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                          CorThread thread,
                                          CorFunction managedFunction,
                                          ManagedCallbackType callbackType
     )
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
 }
 public CorExceptionUnwind2EventArgs(CorAppDomain appDomain, CorThread thread,
                                     CorDebugExceptionUnwindCallbackType eventType,
                                     int flags,
                                     ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eventType = eventType;
     m_flags = flags;
 }
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                          CorThread thread,
                                          CorFunction managedFunction
     )
     : base(appDomain, thread)
 {
     m_managedFunction = managedFunction;
 }
 public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain,
                                             CorThread thread,
                                             CorFunction oldFunction,
                                             CorFunction newFunction,
                                             int oldILoffset,
                                             ManagedCallbackType callbackType
     )
     : base(appDomain, thread, callbackType)
 {
     m_oldFunction = oldFunction;
     m_newFunction = newFunction;
     m_oldILoffset = oldILoffset;
 }
 public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain,
                                             CorThread thread,
                                             CorFunction oldFunction,
                                             CorFunction newFunction,
                                             int oldILoffset
     )
     : base(appDomain, thread)
 {
     m_oldFunction = oldFunction;
     m_newFunction = newFunction;
     m_oldILoffset = oldILoffset;
 }
 public CorBreakpointSetErrorEventArgs(CorAppDomain appDomain,
                                       CorThread thread,
                                       CorBreakpoint breakpoint,
                                       int errorCode,
                                       ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_breakpoint = breakpoint;
     m_errorCode = errorCode;
 }
 private static CorProcess GetProcessFromController(ICorDebugController pController)
 {
     CorProcess p;
     var p2 = pController as ICorDebugProcess;
     if (p2 != null)
     {
         p = CorProcess.GetCorProcess(p2);
     }
     else
     {
         var a2 = (ICorDebugAppDomain) pController;
         p = new CorAppDomain(a2).Process;
     }
     return p;
 }
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               CorBreakpoint managedBreakpoint,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_break = managedBreakpoint;
 }
 public CorAppDomainEventArgs(CorProcess process, CorAppDomain ad)
     : base(process)
 {
     m_ad = ad;
 }
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                 CorStepper stepper, CorDebugStepReason stepReason,
                                 ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
 public CorAppDomainEventArgs(CorProcess process, CorAppDomain ad,
                              ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
     m_ad = ad;
 }
 public CorExceptionEventArgs(CorAppDomain appDomain,
                              CorThread thread,
                              bool unhandled,
                              ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_unhandled = unhandled;
 }
 public CorAppDomainBaseEventArgs(CorAppDomain ad)
     : base(ad)
 {
 }
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                         CorEval eval, ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eval = eval;
 }
 public CorAppDomainBaseEventArgs(CorAppDomain ad, ManagedCallbackType callbackType)
     : base(ad, callbackType)
 {
 }
 public CorModuleEventArgs(CorAppDomain appDomain, CorModule managedModule,
                           ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_managedModule = managedModule;
 }
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread)
     : base(appDomain != null ? appDomain : thread.AppDomain)
 {
     Thread = thread;
 }
 public CorClassEventArgs(CorAppDomain appDomain, CorClass managedClass,
                          ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_class = managedClass;
 }
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread,
                           ManagedCallbackType callbackType)
     : base(appDomain != null ? appDomain : thread.AppDomain, callbackType)
 {
     Thread = thread;
 }
Esempio n. 28
0
        /// <summary>
        /// Resolve Function name based on given AppDomain.
        /// </summary>
        /// <param name="functionName">The name of the function to resolve.</param>
        /// <param name="appDomain">The AppDomain to resolve in.</param>
        /// <returns></returns>
        public MDbgFunction ResolveFunctionNameFromScope(string functionName, CorAppDomain appDomain)
        {
            Debug.Assert(functionName != null &&
                         functionName.Length > 0);
            string moduleName = null;
            string className = null;
            string funcName = null;

            string tempParser = functionName;

            int bangIndex = tempParser.IndexOf("!");
            if (bangIndex != -1)
            {
                moduleName = tempParser.Substring(0, bangIndex);
                tempParser = tempParser.Substring(bangIndex + 1);
            }

            int periodIndex = tempParser.LastIndexOf(".");
            if (periodIndex == -1)
            {
                // only function is specified -- assuming current class
                className = Threads.Active.CurrentFrame.Function.MethodInfo.DeclaringType.Name;
                funcName = tempParser;
            }
            else
            {
                className = tempParser.Substring(0, periodIndex);
                funcName = tempParser.Substring(periodIndex + 1);
            }

            // The last argument to the ResolveFunctionName is appDomain we are refering to.
            // That will cause to resolution happen only on modules loaded into that appdomain.
            return ResolveFunctionName(moduleName, className, funcName, appDomain);
        }
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               CorBreakpoint managedBreakpoint)
     : base(appDomain, thread)
 {
     m_break = managedBreakpoint;
 }
 public void Reset()
 {
     m_enum.Reset();
     m_ad = null;
 }
Esempio n. 31
0
 public void Reset()
 {
     m_enum.Reset();
     m_ad = null;
 }