--- /dev/null
+#!/usr/bin/perl
+# vi: set ts=4:
+
+
+$ARGV=shift @ARGV;
+@output=`objdump -dr $ARGV`;
+
+$obj=$ARGV;
+
+$state=0;
+while($_=shift @output){
+ chomp;
+ if(m/^\w+\.o:\s+file format.*/){
+ $obj = $_;
+ $obj =~ s/^(\w+\.o):\s+file format.*/\1/
+ }
+ if(m/^0[0-9a-fA-F]+\s<\w+>:$/){
+ $func = $_;
+ $func =~ s/^0[0-9a-fA-F]+\s<(\w+)>:$/\1/;
+
+ $addr = $_;
+ $addr =~ s/^(0[0-9a-fA-F]+)\s<\w+>:$/\1/;
+
+ if(@cfuncs){
+ @cfuncs = sort @cfuncs;
+ @last="";
+ foreach $f (@cfuncs) {
+ if($f ne $last){
+ if($f ne "::_GLOBAL_OFFSET_TABLE_"){
+ print " $f\n";
+ }
+ }
+ $last=$f;
+ }
+ }
+ @cfuncs=();
+ print "${obj}::$func:\n";
+
+ $state=0;
+ }
+ if(m/\scall\s/){
+ if(m/\scall\s.*<.*>/){
+ $cfunc = $_;
+ $cfunc =~ s/.*\scall\s.*<(.*)>$/\1/;
+
+ if($cfunc =~ m/$func\+0x/){
+ # wait for a reloc
+ $state=1;
+ }else{
+ push @cfuncs, "${obj}::$cfunc";
+ $state=0;
+ }
+ }else{
+ if($state==2){
+ push @cfuncs, "#$cfunc";
+ }else{
+ push @cfuncs, "#";
+ }
+ $state=0;
+ }
+ }
+ if(m/^\s+[0-9a-fA-F]+:\s\w+\s+\w+$/){
+ $cfunc = $_;
+ $cfunc =~ s/.*\s(\w+)$/\1/;
+ if($state==0){
+ # it just showed up. We might attach it to the next line.
+ $state=2;
+ }elsif($state==1){
+ # we're waiting for a reloc
+ push @cfuncs, "::$cfunc";
+ $state=0;
+ }
+ }
+}
+
--- /dev/null
+#!/usr/bin/perl -w
+# vi: set ts=4:
+
+sub parse_devices;
+
+@ARGV = ('-') unless @ARGV;
+
+$ARGV=shift @ARGV;
+if(!open(FILE,$ARGV)){
+ warn "Can't open $ARGV: $!\n";
+ exit 1;
+}
+
+while(<FILE>){
+ push @lines,$_;
+}
+
+$driver = "";
+while($_=shift @lines){
+ if( m/^[\w-]+: / ){
+ if($l){
+ #print "$l\n";
+ if($l =~ m/^Driver: /){
+ $_ = $l;
+ s/^Driver: //;
+ $driver = $_;
+ }
+ }
+ chomp;
+ $l=$_;
+ }elsif( m/^ / ){
+ s/^ +//;
+ chomp;
+ $l="$l $_";
+ }else{
+ if($l){
+ #print "$l\n";
+ if($l =~ m/^Driver: /){
+ $_ = $l;
+ s/^Driver: //;
+ $driver = $_;
+ }
+ if($l =~ m/^Devices: /){
+ $_ = $l;
+ s/^Devices: //;
+ parse_devices($_);
+ }
+ $l="";
+ }
+ }
+}
+
+
+sub parse_devices
+{
+ my $devs = $_[0];
+ my $mfr = "unknown";
+ my $dev = "unknown";
+ my $name = "unknown";
+
+ #print("parse_devices $devs\n");
+
+ while($devs){
+ $_=$devs;
+ if(m/^ *\[([^\]]+)\](.*)/){
+ $mfr = $1;
+ #print "recognized mfr $mfr\n";
+ $devs = $2;
+ }elsif(m/^ *\(([^\)]+)\)(.*)/){
+ $name = $1;
+ #print "recognized name $name\n";
+ $devs = $2;
+ }elsif(m/^ *([^\(,]+)(.*)/){
+ $dev = $1;
+ $devs = $2;
+ $dev =~ s/ *$//;
+ #print "recognized dev $dev\n";
+ }elsif(m/^ *,(.*)/){
+ $devs = $1;
+ printf "%-28s %-17s %-17s %-10s\n", $mfr, $dev, $driver, $name;
+ }else{
+ print "parse error $_\n";
+ $devs = "";
+ }
+ }
+ printf "%-28s %-17s %-17s %-10s\n", $mfr, $dev, $driver, $name;
+}
+
+
--- /dev/null
+#!/usr/bin/perl
+# vi: set ts=4:
+
+@ARGV = ('-') unless @ARGV;
+
+$ARGV=shift @ARGV;
+if(!open(FILE,$ARGV)){
+ warn "Can't open $ARGV: $!\n";
+ exit 1;
+}
+
+$go=0;
+while(<FILE>) {
+ if( m/^Driver: / ){
+ $go=1;
+ }
+ if( m/\*\// ){
+ if($go){
+ print "\n\n\n";
+ }
+ $go=0;
+ }
+ if( $go ){
+ #chomp;
+ print $_;
+ }
+}
+