public override EnterMethodFlags EnterMethod(Method method) { //Console.WriteLine(method.FullName); if (this.methodStack.Count == 0 && !bStartMonitoring) { var assemblyShortname = method.Definition.Module.Assembly.ShortName; if (assemblyShortname == this.currentAssemblyLoc) { //Whereever the main method, it is the assembly under analysis, //since our tool assumes that there is only one assembly var assembly = method.Definition.Module.Assembly; DUCoverMain.Initialize(assembly); bStartMonitoring = true; } } if (bStartMonitoring) { this.methodStack.Push(method); var tempLastLoadedFields = new SafeList <Field>(); tempLastLoadedFields.AddRange(lastLoadedFields); this.lastLoadedFieldsStack.Push(tempLastLoadedFields); this.lastLoadedFields.Clear(); } return(base.EnterMethod(method)); // 'true' indicates that we want callbacks for the argument values }
public override void LeaveMethod() { if (!bStartMonitoring) { return; } if (this.methodStack.Count == 0) { return; } var poppedMethod = this.methodStack.Pop(); var previousLoadedFields = this.lastLoadedFieldsStack.Pop(); this.lastLoadedFields.Clear(); this.lastLoadedFields.AddRange(previousLoadedFields); if (poppedMethod.ShortName.Equals("Main") || poppedMethod.ShortName.Equals("DUCoverTerminate")) { DUCoverMain.Terminate(); //bStartMonitoring = false; } }