Adrninistrator / java-all-call-graph

Generate all call graph for Java Code.
Apache License 2.0
426 stars 110 forks source link

向下调用链存在循环时,部分调用关系不显示 #15

Open gcf0082 opened 2 years ago

gcf0082 commented 2 years ago

如下场景存在循环调用时的向下调用链,没有test_func_5(); public static void test_func_1() { test_func_4(); }

public static void test_func_2() {
    test_func_1();
}

public static void test_func_3() {
    test_func_1();
    **test_func_5();**
}

public static void test_func_4() {
    test_func_3();
}

public static void test_func_5() {
    test_func_4();
}

调用链如下: test.call_graph.method_call.TestMCCallee:test_func_1() [0]#test.call_graph.method_call.TestMCCallee:test_func_1 [1]# [TestMCCallee:36] test.call_graph.method_call.TestMCCallee:test_func_4 [2]# [TestMCCallee:49] test.call_graph.method_call.TestMCCallee:test_func_3 [3]# [TestMCCallee:44] test.call_graph.method_call.TestMCCallee:test_func_1 !cycle[0]!

Adrninistrator commented 2 years ago

这里是出现了循环调用了哈,在生成输出文件时会进行特殊处理,不然生成的文件也会循环输出不会停止了

上面生成结果的!cycle[0]!就代表循环调用了第0个方法,即“[0]#test.call_graph.method_call.TestMCCallee:test_func_1”

相关说明在https://github.com/Adrninistrator/java-all-call-graph/blob/main/other_functions.md#13-%E5%A4%84%E7%90%86%E5%BE%AA%E7%8E%AF%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8

gcf0082 commented 2 years ago

这里是出现了循环调用了哈,在生成输出文件时会进行特殊处理,不然生成的文件也会循环输出不会停止了

上面生成结果的!cycle[0]!就代表循环调用了第0个方法,即“[0]#test.call_graph.method_call.TestMCCallee:test_func_1”

相关说明在https://github.com/Adrninistrator/java-all-call-graph/blob/main/other_functions.md#13-%E5%A4%84%E7%90%86%E5%BE%AA%E7%8E%AF%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8

是的,循环应该要退出来,只是另外一条路径缺失了。如果另外一条路径也能显示应该会更好些,而且这里路径没有循环 test_func_1->test_func_4->test_func_3->test_func_5

Adrninistrator commented 2 years ago

这里是出现了循环调用了哈,在生成输出文件时会进行特殊处理,不然生成的文件也会循环输出不会停止了 上面生成结果的!cycle[0]!就代表循环调用了第0个方法,即“[0]#test.call_graph.method_call.TestMCCallee:test_func_1” 相关说明在https://github.com/Adrninistrator/java-all-call-graph/blob/main/other_functions.md#13-%E5%A4%84%E7%90%86%E5%BE%AA%E7%8E%AF%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8

是的,循环应该要退出来,只是另外一条路径缺失了。如果另外一条路径也能显示应该会更好些,而且这里路径没有循环 test_func_1->test_func_4->test_func_3->test_func_5

试了一下,确实存在这个问题,后面的版本我优化一下

Adrninistrator commented 2 years ago

如下场景存在循环调用时的向下调用链,没有test_func_5(); public static void test_func_1() { test_func_4(); }

public static void test_func_2() {
    test_func_1();
}

public static void test_func_3() {
    test_func_1();
    **test_func_5();**
}

public static void test_func_4() {
    test_func_3();
}

public static void test_func_5() {
    test_func_4();
}

调用链如下: test.call_graph.method_call.TestMCCallee:test_func_1() [0]#test.call_graph.method_call.TestMCCallee:test_func_1 [1]# [TestMCCallee:36] test.call_graph.method_call.TestMCCallee:test_func_4 [2]# [TestMCCallee:49] test.call_graph.method_call.TestMCCallee:test_func_3 [3]# [TestMCCallee:44] test.call_graph.method_call.TestMCCallee:test_func_1 !cycle[0]!

在0.7.7版本修复了这个BUG哈,可以试一下

Adrninistrator commented 1 year ago

可以试用最新版,详细文档暂未完成 版本:1.0.0