public void RegisterProcess (CorDebugProcess corDebugProcess)
		{
			lock(processes) {
				processes.Add(corDebugProcess);
				process = corDebugProcess;
			}
		}
 public CorDebugAppDomain( CorDebugProcess process, uint id )
 {
     m_process = process;
     m_id = id;
     m_assemblies = new ArrayList();
     m_guidProgramId = Guid.NewGuid();
 }
		public CorDebugThread (CorDebugProcess process, uint id, CorDebugEval eval)
		{
			m_process = process;
			m_id = id;
			m_fSuspended = false;
			m_eval = eval;
		}
		public void UnregisterProcess (CorDebugProcess process)
		{
			if(process == null)
				return;
			lock(processes) {
				if(processes.Contains(process))
					processes.Remove(process);
			}
		}
        protected CorDebugBreakpointBase( CorDebugProcess process )
        {                        
            m_breakpointDef = new BreakpointDef();
            m_breakpointDef.m_id = s_idNext++;
            m_breakpointDef.m_pid = BreakpointDef.c_PID_ANY;

            m_appDomain = null;
            m_process = process;

            Debug.Assert(s_idNext != s_idNull);
        }
		protected override void OnSetActiveThread (long processId, long threadId)
		{
			foreach (var p in processes) {
				if (p.Id == processId) {
					process = p;
					SetActiveThread (process.GetThread ((uint)threadId));
					break;
				}
			}
		}
Example #7
0
 private void RemoveProcess(CorDebugProcess process)
 {
     ((ICorDebugProcess)process).Terminate(0);
     m_alProcesses.Remove(process);
 }
Example #8
0
 public void AddProcess(CorDebugProcess process)
 {
     if(!m_alProcesses.Contains( process ))
     {
         m_alProcesses.Add( process );
     }
 }
			public ManagedCallbackProcess (CorDebugProcess process, EventType eventType)
			{
				m_process = process;
				m_eventType = eventType;
			}
Example #10
0
 public void RegisterProcess(CorDebugProcess process)
 {
     m_processes.Add(process);
 }
		int ICorDebugManagedCallback.ExitProcess (CorDebugProcess pProcess)
		{
			OnTargetEvent (new TargetEventArgs (TargetEventType.TargetExited));
			return 0;
		}
		int ICorDebugManagedCallback.CreateProcess (CorDebugProcess pProcess)
		{
			OnStarted ();
			pProcess.Continue ();
			return 0;
		}
		protected override ThreadInfo[] OnGetThreads (long processId)
		{
			foreach (var p in processes) {
				if (p.Id == processId) {
					process = p;
					break;
				}
			}
			if (process == null)
				return null;
			var threads = process.GetAllNonVirtualThreads ();
			var result = new ThreadInfo[threads.Length];
			for (int i = 0; i < result.Length; i++) {
				result [i] = new ThreadInfo (processId, threads [i].Id, "", "");
			}
			return result;
		}
		ProcessInfo GetProcess (CorDebugProcess proc)
		{
			ProcessInfo info;
			lock (processes) {
				if (!processesInfo.TryGetValue (proc.Id, out info)) {
					info = new ProcessInfo (proc.Id, "");
					processesInfo [proc.Id] = info;
				}
			}
			return info;
		}
 public ScratchPadArea(CorDebugProcess process)
 {
     m_process = process;
 }
        public CorDebugAssembly( CorDebugProcess process, string name, Pdbx.PdbxFile pdbxFile, uint idx )
        {
            m_process = process;
            m_appDomain = null;
            m_name = name;
            m_pdbxFile = pdbxFile;
            m_pdbxAssembly = (pdbxFile != null) ? pdbxFile.Assembly : null;
            m_htTokenCLRToPdbx = new Hashtable();
            m_htTokenTinyCLRToPdbx = new Hashtable();
            m_idx = idx;
            m_primaryAssembly = null;
            m_isFrameworkAssembly = false;

            if(m_pdbxAssembly != null)
            {
                if (!string.IsNullOrEmpty(pdbxFile.PdbxPath))
                {
                    string pth = pdbxFile.PdbxPath.ToLower();

                    if (pth.Contains(@"\buildoutput\"))
                    {
#region V4_1_FRAMEWORK_ASSEMBLIES
                        List<string> frameworkAssemblies = new List<string> {
                                "mfdpwsclient",
                                "mfdpwsdevice",
                                "mfdpwsextensions",
                                "mfwsstack",
                                "microsoft.spot.graphics",
                                "microsoft.spot.hardware",
                                "microsoft.spot.hardware.serialport",
                                "microsoft.spot.hardware.usb",
                                "microsoft.spot.ink",
                                "microsoft.spot.io",
                                "microsoft.spot.native",
                                "microsoft.spot.net",
                                "microsoft.spot.net.security",
                                "microsoft.spot.time",
                                "microsoft.spot.tinycore",
                                "microsoft.spot.touch",
                                "mscorlib",
                                "system.http",
                                "system.io",
                                "system.net.security",
                                "system",
                                "system.xml.legacy",
                                "system.xml", 
                                                             };
#endregion // V4_1_FRAMEWORK_ASSEMBLIES

                        m_isFrameworkAssembly = (frameworkAssemblies.Contains(name.ToLower()));
                    }
                    else
                    {
                        m_isFrameworkAssembly = pdbxFile.PdbxPath.ToLower().Contains(@"\microsoft .net micro framework\");
                    }
                }

                m_pdbxAssembly.CorDebugAssembly = this;
                foreach(Pdbx.Class c in m_pdbxAssembly.Classes)
                {
                    AddTokenToHashtables( c.Token, c );
                    foreach(Pdbx.Field field in c.Fields)
                    {
                        AddTokenToHashtables( field.Token, field );
                    }

                    foreach(Pdbx.Method method in c.Methods)
                    {
                        AddTokenToHashtables( method.Token, method );
                    }
                }
            }
        }
		int ICorDebugManagedCallback.DebuggerError (CorDebugProcess pProcess, int errorHR, uint errorCode)
		{
			return 0;
		}
Example #18
0
 public void UnregisterProcess(CorDebugProcess process)
 {
     m_processes.Remove(process);
 }
		int ICorDebugManagedCallback.CreateAppDomain (CorDebugProcess pProcess, CorDebugAppDomain pAppDomain)
		{
			pProcess.Continue ();
			return 0;
		}
			public ManagedCallbackProcessError (CorDebugProcess process, int errorHR, uint errorCode) : base (process, EventType.Other)
			{
				m_errorHR = errorHR;
				m_errorCode = errorCode;
			}
		int ICorDebugManagedCallback.ExitAppDomain (CorDebugProcess pProcess, CorDebugAppDomain pAppDomain)
		{
			return 0;
		}
		int ICorDebugManagedCallback.ControlCTrap (CorDebugProcess pProcess)
		{
			return 0;
		}
		public override void Dispose ()
		{
			foreach (var p in processes.ToArray())
				p.Dispose ();
			ObjectAdapter.Dispose ();
			ObjectAdapter = null;
			Breakpoints.Clear ();
			processes = null;
			process = null;
			VsPackage.MessageCentre.Session = null;
			documents = null;
			stepper = null;
			processesInfo = null;
			base.Dispose ();
		}
Example #24
0
        public CorDebugProcess EnsureProcess(PortDefinition portDefinition)
        {
            CorDebugProcess process = ProcessFromPortDefinition(portDefinition);            

            if (process == null)
            {
                process = new CorDebugProcess(this, portDefinition);

                uint pid;
                if (portDefinition is PortDefinition_Emulator)
                {
                    Debug.Assert(this.IsLocalPort);
                    pid = (uint)((PortDefinition_Emulator)portDefinition).Pid;
                }
                else
                {
                    pid = m_pidNext++;
                }

                process.SetPid(pid);

                AddProcess(process);
            }

            return process;
        }
        public CLREventsBreakpoint(CorDebugProcess process) : base (process)
        {
            this.Kind = BreakpointDef.c_EXCEPTION_THROWN |
                        BreakpointDef.c_EXCEPTION_CAUGHT |
#if NO_THREAD_CREATED_EVENTS                                                
                        BreakpointDef.c_EVAL_COMPLETE    |
#else 
                        BreakpointDef.c_THREAD_CREATED |
                        BreakpointDef.c_THREAD_TERMINATED |
#endif
                        BreakpointDef.c_ASSEMBLIES_LOADED | 
                        BreakpointDef.c_BREAK;

            this.Active = true;
        }
Example #26
0
 public bool ContainsProcess(CorDebugProcess process)
 {
     return m_alProcesses.Contains(process);
 }
		public CorDebugAssembly (CorDebugProcess process, string name, Pdbx.PdbxFile pdbxFile, uint idx)
		{
			m_process = process;
			m_appDomain = null;
			m_name = name;
			m_pdbxFile = pdbxFile;
			m_pdbxAssembly = (pdbxFile != null) ? pdbxFile.Assembly : null;
			m_htTokenCLRToPdbx = new Hashtable ();
			m_htTokenTinyCLRToPdbx = new Hashtable ();
			m_idx = idx;
			m_primaryAssembly = null;
			m_isFrameworkAssembly = false;

			if (m_pdbxAssembly != null) {
				if (!string.IsNullOrEmpty (pdbxFile.PdbxPath)) {
					string pth = pdbxFile.PdbxPath.ToLower ();

					if (pth.Contains (@"\buildoutput\")) {
#region V4_1_FRAMEWORK_ASSEMBLIES
						List<string> frameworkAssemblies = new List<string> {
							"mfdpwsclient",
							"mfdpwsdevice",
							"mfdpwsextensions",
							"mfwsstack",
							"microsoft.spot.graphics",
							"microsoft.spot.hardware",
							"microsoft.spot.hardware.serialport",
							"microsoft.spot.hardware.usb",
							"microsoft.spot.ink",
							"microsoft.spot.io",
							"microsoft.spot.native",
							"microsoft.spot.net",
							"microsoft.spot.net.security",
							"microsoft.spot.time",
							"microsoft.spot.tinycore",
							"microsoft.spot.touch",
							"mscorlib",
							"system.http",
							"system.io",
							"system.net.security",
							"system",
							"system.xml.legacy",
							"system.xml", 
						};
#endregion // V4_1_FRAMEWORK_ASSEMBLIES

						m_isFrameworkAssembly = (frameworkAssemblies.Contains (name.ToLower ()));
					} else {
						m_isFrameworkAssembly = pdbxFile.PdbxPath.ToLower().Contains(Path.PathSeparator + ".net micro framework" + Path.PathSeparator);
					}
				}

				m_pdbxAssembly.CorDebugAssembly = this;
				foreach (Pdbx.Class c in m_pdbxAssembly.Classes) {
					AddTokenToHashtables (c.Token, c);
					foreach (Pdbx.Field field in c.Fields) {
						AddTokenToHashtables (field.Token, field);
					}

					foreach (Pdbx.Method method in c.Methods) {
						AddTokenToHashtables (method.Token, method);
					}
				}

				if (File.Exists (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".dll")))
					MetaData = ModuleDefinition.ReadModule (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".dll"));
				else if (File.Exists (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".exe")))
					MetaData = ModuleDefinition.ReadModule (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".exe"));

				if (MetaData != null && File.Exists (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".pdb"))) {
					DebugData = new Mono.Cecil.Pdb.PdbReaderProvider ().GetSymbolReader (MetaData, Path.ChangeExtension (m_pdbxFile.PdbxPath, ".pdb"));
					MetaData.ReadSymbols (DebugData);
				} else if (MetaData != null && File.Exists (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".exe.mdb"))) {
					DebugData = new Mono.Cecil.Mdb.MdbReaderProvider ().GetSymbolReader (MetaData, Path.ChangeExtension (m_pdbxFile.PdbxPath, ".exe"));
					MetaData.ReadSymbols (DebugData);
				} else if (MetaData != null && File.Exists (Path.ChangeExtension (m_pdbxFile.PdbxPath, ".dll.mdb"))) {
					DebugData = new Mono.Cecil.Mdb.MdbReaderProvider ().GetSymbolReader (MetaData, Path.ChangeExtension (m_pdbxFile.PdbxPath, ".dll"));
					MetaData.ReadSymbols (DebugData);
				}
			}
		}