public void VisitFunPtr(LoadFunctionAddress load) { int i = m_methods.BinarySearch(load.Method, m_comparer); if (i >= 0) { Log.TraceLine(this, "removing {0} (address is taken)", m_methods[i]); m_methods.RemoveAt(i); } }
// ldftn System.Void Smokey.Tests.StaticSetterTest/GoodCase::DoThread(System.Object) // newobj System.Void System.Threading.ParameterizedThreadStart::.ctor(System.Object,System.IntPtr) // // ldftn System.Void Smokey.Tests.StaticSetterTest/BadCase3::DoThread() // newobj System.Void System.Threading.ThreadStart::.ctor(System.Object,System.IntPtr) // // ldftn System.Void Smokey.Tests.StaticSetterTest/BadCase5::DoCallback(System.Object) // newobj System.Void System.Threading.WaitCallback::.ctor(System.Object,System.IntPtr) // // ldftn System.Void Smokey.Tests.StaticSetterTest/BadCase7::DoCallback(System.Object) // newobj System.Void System.Threading.TimerCallback::.ctor(System.Object,System.IntPtr) public void VisitNewObj(NewObj newobj) { if (newobj.Ctor.ToString().Contains("System.Threading")) // optimize common case where it's not a threading call { if (newobj.Ctor.ToString().Contains("System.Threading.ParameterizedThreadStart::.ctor") || newobj.Ctor.ToString().Contains("System.Threading.ThreadStart::.ctor") || newobj.Ctor.ToString().Contains("System.Threading.WaitCallback::.ctor") || newobj.Ctor.ToString().Contains("System.Threading.TimerCallback::.ctor")) { LoadFunctionAddress fptr = m_info.Instructions[newobj.Index - 1] as LoadFunctionAddress; if (fptr != null) { Log.DebugLine(this, "found thread function: {0}", fptr.Method); m_threadRoots.Add(fptr.Method); } } } }