Back to home page

LXR

 
 

    


0001 #!/bin/sh
0002 # A script to dump mixed source code & assembly
0003 # with correct relocations from System.map
0004 # Requires the following lines in makefile:
0005 #%.lst: %.c
0006 #       $(CC) $(c_flags) -g -c -o $*.o $< &&
0007 #       $(srctree)/scripts/makelst $*.o System.map $(OBJDUMP) > $@
0008 #
0009 # Copyright (C) 2000 IBM Corporation
0010 # Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
0011 #            William Stearns <wstearns@pobox.com>
0012 #
0013 
0014 # awk style field access
0015 field() {
0016   shift $1 ; echo $1
0017 }
0018 
0019 t1=`$3 --syms $1 | grep .text | grep -m1 " F "`
0020 if [ -n "$t1" ]; then
0021   t2=`field 6 $t1`
0022   if [ ! -r $2 ]; then
0023     echo "No System.map" >&2
0024   else
0025     t3=`grep $t2 $2`
0026     t4=`field 1 $t3`
0027     t5=`field 1 $t1`
0028     t6=`printf "%lu" $((0x$t4 - 0x$t5))`
0029   fi
0030 fi
0031 $3 -r --source --adjust-vma=${t6:-0} $1