Added graphviz output to xref7 so that we can see the call graph.
This commit is contained in:
+26
@@ -111,6 +111,7 @@ foreach my $file (@ARGV) {
|
|||||||
|
|
||||||
#print Dumper(\%Label);
|
#print Dumper(\%Label);
|
||||||
print_output();
|
print_output();
|
||||||
|
print_callgraph();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
sub parse_file {
|
sub parse_file {
|
||||||
@@ -226,3 +227,28 @@ sub print_output {
|
|||||||
print("\n\n");
|
print("\n\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Print a graphview call graph file
|
||||||
|
sub print_callgraph {
|
||||||
|
open(my $OUT, ">", "kernel_calls.gv")
|
||||||
|
|| die("Can't write kernel_calls.gv: $!\n");
|
||||||
|
print $OUT <<EOF;
|
||||||
|
digraph callgraph {
|
||||||
|
ratio=compress; size="16.53,11.69";
|
||||||
|
{rank=same; ".capt" ".chdir" ".chmod" ".chown" ".close" ".creat" ".exit"
|
||||||
|
".fork" ".halt" ".link" ".open" ".read" ".rele" ".rename" ".rmes"
|
||||||
|
".save" ".seek" ".setuid" ".smes" ".status" ".sysloc" ".tell"
|
||||||
|
".unlink" ".write"}
|
||||||
|
EOF
|
||||||
|
foreach $curlabel ( sort( keys(%Label) ) ) {
|
||||||
|
my $count = keys( %{ $Label{$curlabel} } );
|
||||||
|
next if ( $count == 2 );
|
||||||
|
|
||||||
|
my $calls = join( '"; "', sort( keys( %{ $Label{$curlabel}{calls} } ) ) );
|
||||||
|
if ( $calls ne '' ) {
|
||||||
|
print($OUT "\"$curlabel\" -> { \"$calls\" ; }\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print($OUT "}\n");
|
||||||
|
close($OUT);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user