我想为我的简单 java 程序使用 JRAT 分析器,如下所示:
public class MainController {
public static int a=4;
public static void main(String[] args) {
for(int i=0;i<30;i++)
{
methodA();
//System.out.println("Hello");
}
}
static void methodA()
{
System.out.println("This is Method A");
methodB();
}
static void methodB()
{
System.out.println("This is Method B");
methodC();
}
static void methodC()
{
System.out.println("This is Method C");
}
}
我运行 JRAT 命令如下: java -javaagent:shiftone-jrat.jar cased/test/MainController
我运行以下命令来查看输出: java -Xmx256M -jar shiftone-jrat.jar
我在 outputfile 中看到的不是那么好。在某些视图中,我期待方法签名和方法调用层次结构。输出如下所示:
viewer="org.shiftone.jrat.ui.viewer.SimpleTextOutputViewBuilder"
JRat:INFO (May/11 12:32:57,613) (main) RuntimeContextImpl - logfile created
JRat:INFO (May/11 12:32:57,613) (main) RuntimeContextImpl - Running JRat version 1-alpha2 - built on July 31 2006
JRat:INFO (May/11 12:32:57,614) (main) Settings - string 'jrat.factory' = 'org.shiftone.jrat.provider.silent.SilentMethodHandler'
JRat:INFO (May/11 12:32:57,614) (main) RootFactory - JRat creating root handler factory...
JRat:INFO (May/11 12:32:57,618) (JRat-Shutdown) ShutdownRegistry - shutting down...[Transformer[AsmInjectorStrategy(uses http://asm.objectweb.org)], FileOutputRegistry[PrintWriter[001_JRat-LOG.jrat]]]
JRat:INFO (May/11 12:32:57,618) (JRat-Shutdown) ShutdownRegistry - shutting down FileOutputRegistry[PrintWriter[001_JRat-LOG.jrat]]...
JRat:INFO (May/11 12:32:57,618) (JRat-Shutdown) FileOutputRegistry - closeFileOutputs [PrintWriter[001_JRat-LOG.jrat]]
JRat:INFO (May/11 12:32:57,618) (JRat-Shutdown) FileOutputRegistry - closing : PrintWriter[001_JRat-LOG.jrat]
JRat:INFO (May/11 12:32:57,619) (JRat-Shutdown) FileOutputPrintWriter - closing
JRat:INFO (May/11 12:32:57,619) (JRat-Shutdown) FileOutputRegistry - remove PrintWriter[001_JRat-LOG.jrat]
有谁知道如何获取方法调用和方法签名以及方法层次结构(如调用图)?还有什么是仪表和注入选项在查看器中的作用?我是分析和 JRAT 的新手。我真的很感激任何帮助。
谢谢。