btfdiff: Use --show_private_classes with DWARF
In DWARF we have the information if a struct/class is defined only inside another struct/class or in a function, and then we consider those to be 'private classes', requiring the use of --show_private_classes to see those when asking for all structs. That is not the case with BTF, that doesn't have that info and thus shows all structs, private or not. So, to compare the outputs in btfdiff we need to ask for --show_private_classes when printing from DWARF. With the Linux kernel vmlinux file the only private structure noticed when not using this option, i.e. the only private class, as 'struct sun_disklabel', defined in the block/partitions/sun.c file, inside the 'sun_partition' function. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
e6c59bd11d
commit
88028b5d0c
5
btfdiff
5
btfdiff
|
@ -2,6 +2,9 @@
|
|||
# Copyright © 2019 Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
# Use pahole to produce output from BTF and from DWARF, then do a diff
|
||||
# Use --flat_arrays with DWARF as BTF, like CTF, flattens arrays.
|
||||
# Use --show_private_classes as BTF shows all structs, while pahole knows
|
||||
# if some struct is defined only inside another struct/class or in a function,
|
||||
# this information is not available when loading from BTF.
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
echo "Usage: btfdiff <filename_with_BTF_and_DWARF_info>"
|
||||
|
@ -12,7 +15,7 @@ file=$1
|
|||
btf_output=$(mktemp /tmp/btfdiff.btf.XXXXXX)
|
||||
dwarf_output=$(mktemp /tmp/btfdiff.dwarf.XXXXXX)
|
||||
|
||||
pahole -F dwarf --flat_arrays $file > $dwarf_output
|
||||
pahole -F dwarf --flat_arrays --show_private_classes $file > $dwarf_output
|
||||
pahole -F btf $file > $btf_output
|
||||
|
||||
diff -up $dwarf_output $btf_output
|
||||
|
|
Loading…
Reference in New Issue