3 # This script is supposed to help use the param_mapper output.
4 # Give it a function and parameter and it lists the functions
5 # and parameters which are basically equivalent.
11 print("call_tree.pl <smatch output file>\n");
12 print("call_tree.pl finds paths between two functions\n");
28 foreach my $func (@
{$path}) {
44 if ($link =~ /$target/) {
48 if (%{$param_map{$link}}->{found
} == $NOTFOUND) {
52 %{$param_map{$link}}->{found
} = $NOTFOUND;
54 foreach my $l (@
{%{$param_map{$link}}->{links
}}){
56 $found = recurse
($l, $target);
69 my $start_func = shift;
72 foreach my $link (@
{%{$param_map{$start_func}}->{links
}}){
73 %{$param_map{$start_func}}->{found
} = $NOTFOUND;
74 foreach my $l (@
{%{$param_map{$start_func}}->{links
}}){
75 %{$param_map{$l}}->{found
} = $NOTFOUND;
77 $path = [$start_func, $link];
78 %{$param_map{$link}}->{found
} = $UNKNOWN;
79 recurse
($link, $end_func);
88 if (!defined($param_map{$one})) {
89 $param_map{$one} = {found
=> $UNKNOWN, links
=> []};
91 push @
{$param_map{$one}->{links
}}, $two;
100 if (/.*?:\d+ (.*?)\(\) info: func_call (.*)/) {
101 add_link
("$1", "$2");
106 sub set_all_unknown
()
110 foreach my $func (keys %param_map){
111 %{$param_map{$func}}->{found
} = $UNKNOWN;
121 printf("Error: $file does not exist.\n");
125 print("Loading functions...\n");
132 print("Enter the start function: ");
133 $start_func = <STDIN
>;
134 $start_func =~ s/^\s+|\s+$//g;
135 print("Enter the target function: ");
137 $end_func =~ s/^\s+|\s+$//g;
140 print("$start_func to $end_func\n");
141 if ($start_func =~ /./ && $end_func =~ /./) {
142 search
($start_func, $end_func);