public static uint Map(bool fCLR, Pdbx.IL [] ilMap, uint offset)
            {
                ILComparer ilComparer = new ILComparer(fCLR);
                Pdbx.IL il = new Pdbx.IL();
                ilComparer.SetIL(il, offset);
                int i = Array.BinarySearch(ilMap, il, ilComparer);
                uint ret = 0;

                if (i >= 0)
                {
                    //Exact match
                    ret = GetIL(!fCLR, ilMap[i]);
                }
                else
                {

                    i = ~i;

                    if (i == 0)
                    {
                        //Before the IL diverges
                        ret = offset;
                    }
                    else
                    {
                        //Somewhere in between
                        i--;

                        il = ilMap[i];
                        ret = offset - GetIL(fCLR, il) + GetIL(!fCLR, il);
                    }
                }

                Debug.Assert(ret >= 0);
                return ret;
            }
 private void SetIL(Pdbx.IL il, uint offset)
 {
     SetIL(m_fCLR, il, offset);
 }
 public CorDebugFunction(CorDebugClass cls, Pdbx.Method method)
 {
     m_class = cls;
     m_pdbxMethod = method;            
 }
 private uint GetIL(Pdbx.IL il)
 {
     return GetIL(m_fCLR, il);
 }
 private static void SetIL(bool fCLR, Pdbx.IL il, uint offset)
 {
     if (fCLR)
         il.CLR = offset;
     else
         il.TinyCLR = offset;
 }
 private static uint GetIL(bool fCLR, Pdbx.IL il)
 {
     return fCLR ? il.CLR : il.TinyCLR;
 }
Пример #7
0
 public CorDebugClass(CorDebugAssembly assembly, Pdbx.Class cls)
 {
     m_assembly = assembly;
     m_pdbxClass = cls;
 }
        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 );
                    }
                }
            }
        }
 private void AddTokenToHashtables( Pdbx.Token token, object o )
 {
     m_htTokenCLRToPdbx[token.CLR] = o;
     m_htTokenTinyCLRToPdbx[token.TinyCLR] = o;
 }
Пример #10
0
		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);
				}
			}
		}