rti800: fix straight-binary/2's-complement option for DAC channel 1
[comedi.git] / scripts / call_trace
1 #!/usr/bin/perl
2 # vi: set ts=4:
3
4
5 $ARGV=shift @ARGV;
6 @output=`objdump -dr $ARGV`;
7
8 $obj=$ARGV;
9
10 $state=0;
11 while($_=shift @output){
12         chomp;
13         if(m/^\w+\.o:\s+file format.*/){
14                 $obj = $_;
15                 $obj =~ s/^(\w+\.o):\s+file format.*/\1/
16         }
17         if(m/^0[0-9a-fA-F]+\s<\w+>:$/){
18                 $func = $_;
19                 $func =~ s/^0[0-9a-fA-F]+\s<(\w+)>:$/\1/;
20
21                 $addr = $_;
22                 $addr =~ s/^(0[0-9a-fA-F]+)\s<\w+>:$/\1/;
23
24                 if(@cfuncs){
25                         @cfuncs = sort @cfuncs;
26                         @last="";
27                         foreach $f (@cfuncs) {
28                                 if($f ne $last){
29                                         if($f ne "::_GLOBAL_OFFSET_TABLE_"){
30                                                 print " $f\n";
31                                         }
32                                 }
33                                 $last=$f;
34                         }
35                 }
36                 @cfuncs=();
37                 print "${obj}::$func:\n";
38
39                 $state=0;
40         }
41         if(m/\scall\s/){
42                 if(m/\scall\s.*<.*>/){
43                         $cfunc = $_;
44                         $cfunc =~ s/.*\scall\s.*<(.*)>$/\1/;
45         
46                         if($cfunc =~ m/$func\+0x/){
47                                 # wait for a reloc
48                                 $state=1;
49                         }else{
50                                 push @cfuncs, "${obj}::$cfunc";
51                                 $state=0;
52                         }
53                 }else{
54                         if($state==2){
55                                 push @cfuncs, "#$cfunc";
56                         }else{
57                                 push @cfuncs, "#";
58                         }
59                         $state=0;
60                 }
61         }
62         if(m/^\s+[0-9a-fA-F]+:\s\w+\s+\w+$/){
63                 $cfunc = $_;
64                 $cfunc =~ s/.*\s(\w+)$/\1/;
65                 if($state==0){
66                         # it just showed up.  We might attach it to the next line.
67                         $state=2;
68                 }elsif($state==1){
69                         # we're waiting for a reloc
70                         push @cfuncs, "::$cfunc";
71                         $state=0;
72                 }
73         }
74 }
75