dwarves/ctfdwdiff
Arnaldo Carvalho de Melo 17b83fcbf1 ctfdwdiff: Handle files without DWARF info too
Such as some built-in.o files in the Linux kernel build process.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-20 23:44:12 -03:00

40 lines
759 B
Bash
Executable File

#!/bin/bash
results_dir=/tmp/ctfdwdiff
diff_one() {
local obj=$1
diff=$results_dir/$obj.diff
ctf=$results_dir/$obj.ctf.c
dwarf=$results_dir/$obj.dwarf.c
pahole -Z $obj
pahole -F ctf $obj > $ctf
pahole --flat_arrays \
--show_private_classes \
--fixup_silly_bitfields -F dwarf $obj > $dwarf
diff -up $dwarf $ctf > $diff
if [ -s $diff ] ; then
[ $# -gt 1 ] && vim $results_dir/$obj.diff
exit 0
else
rm -f $diff $ctf $dwarf
fi
}
rm -rf $results_dir
mkdir $results_dir
find . -type d | \
while read dir ; do
cd $dir
ls *.o 2> /dev/null |
while read obj ; do
ncus=$(readelf -wi $obj | grep DW_TAG_compile_unit | wc -l)
if [ $ncus -ne 1 ] ; then
continue
fi
echo $obj
diff_one $obj $1
done
cd - > /dev/null
done