public static CorDebugFunction CorDebugFunctionFromMethodIndex(uint methodIndex, CorDebugAppDomain appDomain) { CorDebugFunction function = null; CorDebugAssembly assembly = appDomain.AssemblyFromIdx(nanoCLR_TypeSystem.IdxAssemblyFromIndex(methodIndex)); if (assembly != null) { uint tk = nanoCLR_TypeSystem.nanoCLRTokenFromMethodIndex(methodIndex); function = assembly.GetFunctionFromTokennanoCLR(tk); } return(function); }
public static CorDebugClass CorDebugClassFromTypeIndex(uint typeIndex, CorDebugAppDomain appDomain) { CorDebugClass cls = null; CorDebugAssembly assembly = appDomain.AssemblyFromIdx(nanoCLR_TypeSystem.IdxAssemblyFromIndex(typeIndex)); if (assembly != null) { uint typedef = nanoCLR_TypeSystem.CLR_TkFromType(nanoCLR_TypeSystem.CLR_TABLESENUM.TBL_TypeDef, nanoCLR_TypeSystem.IdxFromIndex(typeIndex)); cls = assembly.GetClassFromTokennanoCLR(typedef); } return(cls); }
public ManagedCallbackAssembly(CorDebugAssembly assembly, EventType eventType) { m_assembly = assembly; m_eventType = eventType; }
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_htTokennanoCLRToPdbx = 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); } } } }
public bool UpdateAssemblies() { uint[] assemblies = null; List <ManagedCallbacks.ManagedCallback> callbacks = new System.Collections.Generic.List <ManagedCallbacks.ManagedCallback>(); if (this.Process.Engine.Capabilities.AppDomains) { var resolveAppDomain = this.Process.Engine.ResolveAppDomainAsync(m_id); resolveAppDomain.Wait(); WireProtocol.Commands.Debugging_Resolve_AppDomain.Reply reply = resolveAppDomain.Result; if (reply != null) { m_name = reply.Name; assemblies = reply.m_data; } if (assemblies == null) { //assembly is already unloaded assemblies = new uint[0]; } } else { using (CancellationTokenSource cts = new CancellationTokenSource()) { var resolveAllAssemblies = this.Process.Engine.ResolveAllAssembliesAsync(cts.Token); resolveAllAssemblies.Wait(); List <WireProtocol.Commands.DebuggingResolveAssembly> reply = resolveAllAssemblies.Result; assemblies = new uint[reply.Count]; for (int iAssembly = 0; iAssembly < assemblies.Length; iAssembly++) { assemblies[iAssembly] = reply[iAssembly].Idx; } } } //Convert Assembly Index to Idx. for (uint iAssembly = 0; iAssembly < assemblies.Length; iAssembly++) { assemblies[iAssembly] = nanoCLR_TypeSystem.IdxAssemblyFromIndex(assemblies[iAssembly]); } //Unload dead assemblies for (int iAssembly = m_assemblies.Count - 1; iAssembly >= 0; iAssembly--) { CorDebugAssembly assembly = (CorDebugAssembly)m_assemblies[iAssembly]; if (Array.IndexOf(assemblies, assembly.Idx) < 0) { callbacks.Add(new ManagedCallbacks.ManagedCallbackAssembly(assembly, ManagedCallbacks.ManagedCallbackAssembly.EventType.UnloadModule)); callbacks.Add(new ManagedCallbacks.ManagedCallbackAssembly(assembly, ManagedCallbacks.ManagedCallbackAssembly.EventType.UnloadAssembly)); m_assemblies.RemoveAt(iAssembly); } } //Load new assemblies for (int i = 0; i < assemblies.Length; i++) { uint idx = assemblies[i]; CorDebugAssembly assembly = AssemblyFromIdx(idx); if (assembly == null) { //Get the primary assembly from CorDebugProcess assembly = this.Process.AssemblyFromIdx(idx); Debug.Assert(assembly != null); //create a new CorDebugAssemblyInstance assembly = assembly.CreateAssemblyInstance(this); Debug.Assert(assembly != null); m_assemblies.Add(assembly); //cpde expects mscorlib to be the first assembly it hears about int index = (assembly.Name == "mscorlib") ? 0 : callbacks.Count; callbacks.Insert(index, new ManagedCallbacks.ManagedCallbackAssembly(assembly, ManagedCallbacks.ManagedCallbackAssembly.EventType.LoadAssembly)); callbacks.Insert(index + 1, new ManagedCallbacks.ManagedCallbackAssembly(assembly, ManagedCallbacks.ManagedCallbackAssembly.EventType.LoadModule)); } } this.Process.EnqueueEvents(callbacks); return(callbacks.Count > 0); }
public CorDebugAssembly AssemblyFromIndex(uint index) { return(CorDebugAssembly.AssemblyFromIndex(index, m_assemblies)); }
public CorDebugAssembly AssemblyFromIdx(uint idx) { return(CorDebugAssembly.AssemblyFromIdx(idx, m_assemblies)); }
public CorDebugClass(CorDebugAssembly assembly, uint tkSymbolless) : this(assembly, null) { m_tkSymbolless = tkSymbolless; }
public CorDebugClass(CorDebugAssembly assembly, Pdbx.Class cls) { m_assembly = assembly; m_pdbxClass = cls; }
public static uint ClassMemberIndexFromnanoCLRToken(uint token, CorDebugAssembly assembly) { uint idx = nanoCLR_TypeSystem.CLR_DataFromTk(token); return(nanoCLR_TypeSystem.IndexFromIdxAssemblyIdx(assembly.Idx, idx)); }
public static uint ClassMemberIndexFromCLRToken(uint token, CorDebugAssembly assembly) { Pdbx.ClassMember cm = assembly.GetPdbxClassMemberFromTokenCLR(token); return(ClassMemberIndexFromnanoCLRToken(cm.Token.nanoCLR, assembly)); }