Skip to content

Commit d136bbc

Browse files
committed
Expose limited call graph via goto-instrument
1 parent 9c29bee commit d136bbc

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,22 @@ int goto_instrument_parse_optionst::doit()
659659
return CPROVER_EXIT_SUCCESS;
660660
}
661661

662+
if(cmdline.isset("reachable-call-graph"))
663+
{
664+
do_indirect_call_and_rtti_removal();
665+
call_grapht call_graph =
666+
call_grapht::create_from_root_function(
667+
goto_model, goto_functionst::entry_point(), false);
668+
if(cmdline.isset("xml"))
669+
call_graph.output_xml(std::cout);
670+
else if(cmdline.isset("dot"))
671+
call_graph.output_dot(std::cout);
672+
else
673+
call_graph.output(std::cout);
674+
675+
return 0;
676+
}
677+
662678
if(cmdline.isset("dot"))
663679
{
664680
namespacet ns(goto_model.symbol_table);
@@ -1455,6 +1471,9 @@ void goto_instrument_parse_optionst::help()
14551471
" --list-calls-args list all function calls with their arguments\n"
14561472
// NOLINTNEXTLINE(whitespace/line_length)
14571473
" --print-path-lengths print statistics about control-flow graph paths\n"
1474+
" --call-graph show graph of function calls\n"
1475+
// NOLINTNEXTLINE(whitespace/line_length)
1476+
" --reachable-call-graph show graph of function calls potentially reachable from main function\n"
14581477
"\n"
14591478
"Safety checks:\n"
14601479
" --no-assertions ignore user assertions\n"

src/goto-instrument/goto_instrument_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Author: Daniel Kroening, [email protected]
4343
"(log):" \
4444
"(max-var):(max-po-trans):(ignore-arrays)" \
4545
"(cfg-kill)(no-dependencies)(force-loop-duplication)" \
46-
"(call-graph)" \
46+
"(call-graph)(reachable-call-graph)" \
4747
"(no-po-rendering)(render-cluster-file)(render-cluster-function)" \
4848
"(nondet-volatile)(isr):" \
4949
"(stack-depth):(nondet-static)" \

0 commit comments

Comments
 (0)