a94b511f6c
As we won't find them in CTF land... I also have to add a new pfunct cmdline option to ask for inline functions not to be printed, as they aren't on the symtab. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
58 lines
1.0 KiB
Bash
Executable File
58 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
results_dir=/tmp/ctfdwdiff
|
|
|
|
diff_tool() {
|
|
local tool=$1
|
|
local dwarf_options=$2
|
|
local ctf_options=$3
|
|
local obj=$4
|
|
|
|
diff=$results_dir/$obj.$tool.diff
|
|
ctf=$results_dir/$obj.$tool.ctf.c
|
|
dwarf=$results_dir/$obj.$tool.dwarf.c
|
|
$tool -F ctf $ctf_options $obj > $ctf
|
|
$tool -F dwarf $dwarf_options $obj > $dwarf
|
|
diff -up $dwarf $ctf > $diff
|
|
if [ -s $diff ] ; then
|
|
[ $# -gt 4 ] && vim $diff
|
|
exit 0
|
|
else
|
|
rm -f $diff $ctf $dwarf
|
|
fi
|
|
}
|
|
|
|
diff_one() {
|
|
local obj=$1
|
|
diff_tool "pahole" "--flat_arrays --show_private_classes --fixup_silly_bitfields" " " $obj $2
|
|
diff_tool "pfunct" "-V --no_parm_names" "-V" $obj $2
|
|
}
|
|
|
|
|
|
diff_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
|
|
pahole -Z $obj
|
|
diff_one $obj $1
|
|
done
|
|
cd - > /dev/null
|
|
done
|
|
}
|
|
|
|
rm -rf $results_dir
|
|
mkdir $results_dir
|
|
|
|
if [ $# -lt 2 ] ; then
|
|
diff_dir
|
|
else
|
|
diff_one $*
|
|
fi
|