天天看点

[Soot学习笔记][6]一点instrumentation的知识

 今天又结合这里: http://www.sable.mcgill.ca/soot/tutorial/index.html 提供的文档,主要学习了 Using Soot for profiling: developing a goto Instrumenter和 More on profiling两个文档,其实这两个文档也学得不是很懂。但是想记录一点东西:

第一篇文档对应的例子是:http://www.sable.mcgill.ca/soot/tutorial/profiler/Main.java

下下来以后看到有这样一行代码:

PackManager.v().getPack("jtp").add(new Transform("jtp.instrumenter", GotoInstrumenter.v()));
           

之前看过这篇文档(也在上面第一个链接中有)

A Survivor's Guide to Java Program Analysis with Soot

其PDF文件的21页介绍到:

"...we want Soot to run our analysis and still process all other options we might want to pass to it. How this is done depends on whether the analysis being injected is an inter or intra-procedural analysis. The former needs to be injected into thewjtp phase while the latter goes into thejtp phase."

public class MySootMainExtension
{
	public static void main(String[] args) {
		// Inject the analysis tagger into Soot
		PackManager.v().getPack("jtp").add(new
				Transform("jpt.myanalysistagger",
						MyAnalysisTagger.instance()));
		// Invoke soot.Main with arguments given
		Main.main(args);
		}
}
           

上面那句话已经说的很清楚,我们要分析intra-procedural的时候,就使用jtp,相互对照一下,就可以知道上面那个语句的含义了。

今天就先总结这么多,接下来我会继续搞清楚Using Soot for profiling: developing a goto Instrumenter和More on profiling两个文档的主要内容。