Example #1
0
		internal DnAppDomain(DnProcess ownerProcess, ICorDebugAppDomain appDomain, int incrementedId) {
			this.ownerProcess = ownerProcess;
			this.assemblies = new DebuggerCollection<ICorDebugAssembly, DnAssembly>(CreateAssembly);
			this.appDomain = new CorAppDomain(appDomain);
			this.incrementedId = incrementedId;
			NameChanged();
		}
		// Do not pass the pBreakpoint parameter as ICorDebugBreakpoint - marshaling of it fails in .NET 1.1
		public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, IntPtr pBreakpoint)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);
			if (managedCallback != null) {
				managedCallback.Breakpoint(pAppDomain, pThread, pBreakpoint);
			}
		}
		public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);
			if (managedCallback != null) {
				managedCallback.StepComplete(pAppDomain, pThread, pStepper, reason);
			}
		}
 public virtual void Breakpoint(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugBreakpoint breakpoint)
 {
     this.DefaultHandler(appDomain);
 }
        private DebuggeeProcess GetProcessWrapper(ICorDebugAppDomain appDomain)
        {
            ICorDebugProcess process;
            appDomain.GetProcess(out process);
            return GetProcessWrapper(process);

        }
Example #6
0
        public void Break(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            EnterCallback(PausedReason.Break, "Break", pThread);

            pauseOnNextExit = true;
            ExitCallback();
        }
 public CorDebugAppDomain(ICorDebugAppDomain _appdomain) {
     m_appdomain = _appdomain;
     uint size = 0;
     m_appdomain.GetName(0, out size, null);
     StringBuilder name = new StringBuilder((int)size);
     _appdomain.GetName((uint)name.Capacity, out size, name);
     Name = name.ToString();
 }
 public void Breakpoint(
     ICorDebugAppDomain pAppDomain, 
     ICorDebugThread pThread, 
     ICorDebugBreakpoint pBreakpoint)
 {
     m_listner.PostBreakPoint(new CorThread(pThread));
     //controller.Continue(0);
 }
 public virtual void EditAndContinueRemap(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugFunction function, 
     bool accurate)
 {
     this.DefaultHandler(appDomain);
 }
Example #10
0
		internal DnAppDomain(DnProcess ownerProcess, ICorDebugAppDomain appDomain, int uniqueId, int uniqueIdProcess) {
			Process = ownerProcess;
			assemblies = new DebuggerCollection<ICorDebugAssembly, DnAssembly>(CreateAssembly);
			CorAppDomain = new CorAppDomain(appDomain);
			UniqueId = uniqueId;
			UniqueIdProcess = uniqueIdProcess;
			NameChanged();
		}
Example #11
0
        public void CreateAppDomain(ICorDebugProcess pProcess, ICorDebugAppDomain pAppDomain)
        {
            var domain = new DebugDomain(null, pAppDomain);
            Logger.WriteLine("App domain {0} created", domain.Name);

            pAppDomain.Attach();

            pProcess.Continue(0);
        }
        private void HandleEvalEvent(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
        {
            var domain = GetProcessWrapper(pAppDomain).GetAppDomain(pAppDomain);
            var thread = domain.GetThread(pThread);
            var eval = Session.ComInstanceCollector.GetWrapper<RuntimeEvaluation>(pEval);

            var eventArgs = new DebuggerEventArgs(domain, true);
            eval.DispatchEvaluationCompleted(eventArgs);
            FinalizeEvent(eventArgs);
        }
Example #13
0
        public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint)
        {
            var handler = OnBreakpoint;
            if (handler != null)
            {
                handler(this, new DebuggerBreakpointEventArgs(pThread, pBreakpoint));
            }

            pAppDomain.Continue(0);
        }
		public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugAppDomain pAppDomain)
		{
			ICorDebugProcess pProcess;
			try {
				pProcess = pAppDomain.Process;
			} catch (COMException e) {
				debugger.TraceMessage("Ignoring callback \"" + name + "\": " + e.Message);
				return null;
			}
			return GetProcessCallbackInterface(name, pProcess);
		}
        //
        // 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;
        }
Example #16
0
        // Warning! Marshaing of ICorBreakpoint fails in .NET 1.1
        public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint corBreakpoint)
        {
            EnterCallback(PausedReason.Breakpoint, "Breakpoint", pThread);

            Breakpoint breakpoint = process.Debugger.Breakpoints[corBreakpoint];
            // The event will be risen outside the callback
            process.BreakpointHitEventQueue.Enqueue(breakpoint);

            pauseOnNextExit = true;

            ExitCallback();
        }
Example #17
0
        /// <summary>
        /// Finds appropriete SequncePointMap instances and builds SequencePointRemapper, gets new IL offset and call RemapFunction.
        /// </summary>
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            ICorDebugILFrame2 frame = (ICorDebugILFrame2) pThread.GetActiveFrame();

            uint nToken = pOldFunction.GetToken();

            SequencePointRemapper remapper;
            if(!remappers.TryGetValue(nToken,out remapper)){
                throw new KeyNotFoundException("Methods sequence points not found.");
            }
            frame.__RemapFunction(remapper.TranslateILOffset(oldILOffset));
        }
Example #18
0
        private IList<DebugDomain> LoadDomains()
        {
            ICorDebugAppDomainEnum domainsEnum;
            _debugProcess.EnumerateAppDomains(out domainsEnum);

            uint domainsCount;
            domainsEnum.GetCount(out domainsCount);

            ICorDebugAppDomain[] domains = new ICorDebugAppDomain[domainsCount];
            uint domainsFetched;
            domainsEnum.Next(domainsCount, domains, out domainsFetched);

            var list = new List<DebugDomain>((int)domainsFetched);

            for (int i = 0; i < domainsFetched; i++)
            {
                list.Add(new DebugDomain(_debugEngine, domains[i]));
            }

            return list;
        }
Example #19
0
 public virtual void EvalException(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
 {
     pAppDomain.Continue(0);
 }
 public void UpdateModuleSymbols(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, System.Runtime.InteropServices.ComTypes.IStream pSymbolStream)
 {
     HandleEvent(pAppDomain);
 }
 public void LogSwitch(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, uint ulReason, string pLogSwitchName, string pParentName)
 {
     HandleEvent(pAppDomain);
 }
 public void UnloadClass(ICorDebugAppDomain pAppDomain, ICorDebugClass c)
 {
     HandleEvent(pAppDomain);
 }
 public void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
 {
     HandleEvalEvent(pAppDomain, pThread, pEval);
 }
Example #24
0
        public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
        {
            EnterCallback(PausedReason.Other, "FunctionRemapComplete", pThread);

            ExitCallback();
        }
Example #25
0
        public void UnloadAssembly(ICorDebugAppDomain pAppDomain, ICorDebugAssembly pAssembly)
        {
            EnterCallback(PausedReason.Other, "UnloadAssembly", pAppDomain);

            ExitCallback();
        }
Example #26
0
        public void UnloadClass(ICorDebugAppDomain pAppDomain, ICorDebugClass c)
        {
            EnterCallback(PausedReason.Other, "UnloadClass", pAppDomain);

            ExitCallback();
        }
Example #27
0
        public void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval corEval)
        {
            EnterCallback(PausedReason.EvalComplete, "EvalComplete", pThread);

            HandleEvalComplete(pAppDomain, pThread, corEval, false);
        }
Example #28
0
        public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
        {
            EnterCallback(PausedReason.Other, "EditAndContinueRemap", pThread);

            ExitCallback();
        }
Example #29
0
        public void LogSwitch(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, uint ulReason, string pLogSwitchName, string pParentName)
        {
            EnterCallback(PausedReason.Other, "LogSwitch", pThread);

            ExitCallback();
        }
Example #30
0
        public void BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError)
        {
            EnterCallback(PausedReason.Other, "BreakpointSetError", pThread);

            ExitCallback();
        }
 public void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int unhandled)
 {
     HandleEvent(pAppDomain);
 }
Example #32
0
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            EnterCallback(PausedReason.Other, "FunctionRemapOpportunity", pThread);

            ExitCallback();
        }
 public void EvalException(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
 {
     Log("Exception occured during evaluation.");
     HandleEvalEvent(pAppDomain, pThread, pEval);
 }
Example #34
0
 void ICorDebugManagedCallback.LogMessage(
                         ICorDebugAppDomain appDomain,
                         ICorDebugThread thread,
                         int level,
                         string logSwitchName,
                         string message)
 {
     HandleEvent(ManagedCallbackType.OnLogMessage,
                        new CorLogMessageEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                   thread == null ? null : new CorThread(thread),
                                                   level, logSwitchName, message,
                                                   ManagedCallbackType.OnLogMessage));
 }
 public void LogMessage(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, string pLogSwitchName, string pMessage)
 {
     Log(pMessage);
     HandleEvent(pAppDomain);
 }
Example #36
0
 void ICorDebugManagedCallback.ExitAppDomain(
                            ICorDebugProcess process,
                            ICorDebugAppDomain appDomain)
 {
     HandleEvent(ManagedCallbackType.OnAppDomainExit,
                       new CorAppDomainEventArgs( process == null ? null : CorProcess.GetCorProcess(process),
                                                  appDomain == null ? null : new CorAppDomain(appDomain),
                                                  ManagedCallbackType.OnAppDomainExit));
 }
 public void NameChange(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
 {
     HandleEvent(pAppDomain);
 }
Example #38
0
 void ICorDebugManagedCallback.NameChange(
                         ICorDebugAppDomain appDomain,
                         ICorDebugThread thread)
 {
     HandleEvent(ManagedCallbackType.OnNameChange,
                       new CorThreadEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                               thread == null ? null : new CorThread(thread),
                                               ManagedCallbackType.OnNameChange));
 }
Example #39
0
 public virtual void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
 {
     pAppDomain.Continue(0);
 }
Example #40
0
 public virtual void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int unhandled)
 {
     pAppDomain.Continue(0);
 }
Example #41
0
 public virtual void Break(ICorDebugAppDomain pAppDomain, ICorDebugThread thread)
 {
     pAppDomain.Continue(0);
 }
Example #42
0
 public virtual void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
 {
     pAppDomain.Continue(0);
 }
Example #43
0
 void ICorDebugManagedCallback.EditAndContinueRemap(
                                  ICorDebugAppDomain appDomain,
                                  ICorDebugThread thread,
                                  ICorDebugFunction managedFunction,
                                  int isAccurate)
 {
     Debug.Assert(false); //OBSOLETE callback
 }
Example #44
0
 public virtual void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
 {
     pAppDomain.Continue(0);
 }
Example #45
0
 void ICorDebugManagedCallback2.FunctionRemapOpportunity(ICorDebugAppDomain appDomain,
                                                                ICorDebugThread thread,
                                                                ICorDebugFunction oldFunction,
                                                                ICorDebugFunction newFunction,
                                                                uint oldILoffset)
 {
     HandleEvent(ManagedCallbackType.OnFunctionRemapOpportunity,
                               new CorFunctionRemapOpportunityEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                                        thread == null ? null : new CorThread(thread),
                                                                        oldFunction == null ? null : new CorFunction(oldFunction),
                                                                        newFunction == null ? null : new CorFunction(newFunction),
                                                                        (int)oldILoffset,
                                                                        ManagedCallbackType.OnFunctionRemapOpportunity));
 }
Example #46
0
 void ICorDebugManagedCallback2.Exception(ICorDebugAppDomain ad, ICorDebugThread thread,
                                          ICorDebugFrame frame, uint offset,
                                          CorDebugExceptionCallbackType eventType, uint flags) 
 {
     HandleEvent(ManagedCallbackType.OnException2,
                               new CorException2EventArgs(ad == null ? null : new CorAppDomain(ad),
                                                 thread == null ? null : new CorThread(thread),
                                                 frame == null ? null : new CorFrame(frame),
                                                 (int)offset,
                                                 eventType,
                                                 (int)flags,
                                                 ManagedCallbackType.OnException2));
 }
Example #47
0
 void EnterCallback(PausedReason pausedReason, string name, ICorDebugAppDomain pAppDomain)
 {
     EnterCallback(pausedReason, name, pAppDomain.GetProcess());
 }
Example #48
0
 public virtual void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint)
 {
     pAppDomain.Continue(0);
 }
Example #49
0
 void ICorDebugManagedCallback.LogSwitch(
                        ICorDebugAppDomain appDomain,
                        ICorDebugThread thread,
                        int level,
                        uint reason,
                        string logSwitchName,
                        string parentName)
 {
     HandleEvent(ManagedCallbackType.OnLogSwitch,
                       new CorLogSwitchEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                                  thread == null ? null : new CorThread(thread),
                                                  level, (int)reason, logSwitchName, parentName,
                                                  ManagedCallbackType.OnLogSwitch));
 }
Example #50
0
 void ICorDebugManagedCallback.EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
 {
     // TODO HandleEvent(ManagedCallbackType.On new CorEventArgs(new CorAppDomain(pAppDomain)));
 }
Example #51
0
 void ICorDebugManagedCallback.UnloadAssembly(
                             ICorDebugAppDomain appDomain,
                             ICorDebugAssembly assembly)
 {
     HandleEvent(ManagedCallbackType.OnAssemblyUnload,
                       new CorAssemblyEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                                 assembly == null ? null : new CorAssembly(assembly),
                                                 ManagedCallbackType.OnAssemblyUnload));
 }
Example #52
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
 {
     // TODO HandleEvent(<new CorEventArgs(new CorAppDomain(pAppDomain)));
 }
Example #53
0
        void ICorDebugManagedCallback.UpdateModuleSymbols(
                                         ICorDebugAppDomain appDomain,
                                         ICorDebugModule managedModule,
 IStream stream)
        {
            HandleEvent(ManagedCallbackType.OnUpdateModuleSymbols,
                              new CorUpdateModuleSymbolsEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                                  managedModule == null ? null : new CorModule(managedModule),
                                                                  stream,
                                                                  ManagedCallbackType.OnUpdateModuleSymbols));
        }
Example #54
0
 /** Create an CorAppDomain object. */
 internal CorAppDomain(ICorDebugAppDomain appDomain)
     : base(appDomain)
 {
 }
Example #55
0
 void ICorDebugManagedCallback.BreakpointSetError(
                                ICorDebugAppDomain appDomain,
                                ICorDebugThread thread,
                                ICorDebugBreakpoint breakpoint,
                                UInt32 errorCode)
 {
     HandleEvent(ManagedCallbackType.OnBreakpointSetError,
                       new CorBreakpointSetErrorEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                 thread == null ? null : new CorThread(thread),
                                                 null, 
                                                 (int)errorCode,
                                                 ManagedCallbackType.OnBreakpointSetError));
 }
Example #56
0
 internal DnAppDomain TryAdd(ICorDebugAppDomain comAppDomain) => appDomains.Add(comAppDomain);
Example #57
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(ICorDebugAppDomain appDomain,
                                                      ICorDebugThread thread,
                                                      ICorDebugFunction managedFunction)
 {
     HandleEvent(ManagedCallbackType.OnFunctionRemapComplete,
                        new CorFunctionRemapCompleteEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                               thread == null ? null : new CorThread(thread),
                                               managedFunction == null ? null : new CorFunction(managedFunction),
                                               ManagedCallbackType.OnFunctionRemapComplete));
 }
Example #58
0
 internal DnAppDomain TryGetAppDomain(ICorDebugAppDomain comAppDomain) => appDomains.TryGet(comAppDomain);
Example #59
0
 void ICorDebugManagedCallback2.ExceptionUnwind(ICorDebugAppDomain ad, ICorDebugThread thread,
                                                CorDebugExceptionUnwindCallbackType eventType, uint flags)
 {
     HandleEvent(ManagedCallbackType.OnExceptionUnwind2,
                               new CorExceptionUnwind2EventArgs(ad == null ? null : new CorAppDomain(ad),
                                                 thread == null ? null : new CorThread(thread),
                                                 eventType,
                                                 (int)flags,
                                                 ManagedCallbackType.OnExceptionUnwind2));
 }
Example #60
0
 DnAppDomain CreateAppDomain(ICorDebugAppDomain appDomain) =>
 new DnAppDomain(this, appDomain, Debugger.GetNextAppDomainId(), Interlocked.Increment(ref nextAppDomainId));