#!/bin/perl -w #Darryl Gove #http://blogs.sun.com/d/ $file = shift @ARGV; print $file; open IN,$file; open OUT,">dot.dot"; print OUT "digraph G {\n"; while (defined($line=)) { if ($line=~/file=(.*);\s+needed by\s+.*\/(\S*)/) { $library = $2; $needs = $1; $library=~s/\./\_/g; $library=~s/\-/\_/g; $library=~s/\+/\_/g; $library=~s/\%/\_/g; $library=~s/^(\d)/\_$1/; $needs =~s/\./\_/g; $needs =~s/\-/\_/g; $needs =~s/\+/\_/g; $needs =~s/\%/\_/g; $needs=~s/^(\d)/\_$1/; print "\n$library $needs \n$line"; print OUT "$library -> $needs [style=bold];\n" } if ($line=~/file=(.*);\s+lazy loading from file=.*\/(\S*):/) { $library = $2; $needs = $1; $library=~s/\./\_/g; $library=~s/\-/\_/g; $library=~s/\+/\_/g; $library=~s/\%/\_/g; $library=~s/^(\d)/\_$1/; $needs =~s/\./\_/g; $needs =~s/\-/\_/g; $needs =~s/\+/\_/g; $needs =~s/\%/\_/g; $needs=~s/^(\d)/\_$1/; if (!defined($mapped{$library}{$needs})) { print "\n$library $needs \n$line"; print OUT "$library -> $needs;\n"; $mapped{$library}{$needs}=1; } } if ($line=~/file=.*\/(.*);\s+dlopen\(\) called from file=.*\/(\S*)\s+\[/) { $library = $2; $needs = $1; $library=~s/\./\_/g; $library=~s/\-/\_/g; $library=~s/\+/\_/g; $library=~s/\%/\_/g; $library=~s/^(\d)/\_$1/; $needs =~s/\./\_/g; $needs =~s/\-/\_/g; $needs =~s/\+/\_/g; $needs =~s/\%/\_/g; $needs=~s/^(\d)/\_$1/; if (!defined($mapped{$library}{$needs})) { print "\n$library $needs \n$line"; print OUT "$library -> $needs [style=dotted];\n"; $mapped{$library}{$needs}=1; } } if ($line=~/file=.*\/(.*);\s+filter for.*\/(\S*)/) { $library = $2; $needs = $1; $library=~s/\./\_/g; $library=~s/\-/\_/g; $library=~s/\+/\_/g; $library=~s/\%/\_/g; $library=~s/^(\d)/\_$1/; $needs =~s/\./\_/g; $needs =~s/\-/\_/g; $needs =~s/\+/\_/g; $needs =~s/\%/\_/g; $needs=~s/^(\d)/\_$1/; if (!defined($mapped{$library}{$needs})) { print "\n$library $needs \n$line"; print OUT "$library -> $needs [style=dotted];\n"; $mapped{$library}{$needs}=1; } } if ($line=~/file=.*\/(.*);\s+filtered by.*\/(\S*)/) { $library = $2; $needs = $1; $library=~s/\./\_/g; $library=~s/\-/\_/g; $library=~s/\+/\_/g; $library=~s/\%/\_/g; $library=~s/^(\d)/\_$1/; $needs =~s/\./\_/g; $needs =~s/\-/\_/g; $needs =~s/\+/\_/g; $needs =~s/\%/\_/g; $needs=~s/^(\d)/\_$1/; if (!defined($mapped{$library}{$needs})) { print "\n$library $needs \n$line"; print OUT "$library -> $needs [style=dotted];\n"; $mapped{$library}{$needs}=1; } }} print OUT"}\n"; close OUT; close IN;