btfdiff: Add utility to compare pahole output produced from DWARF and BTF

  $ btfdiff
  Usage: btfdiff <filename_with_BTF_and_DWARF_info>
  $ btfdiff ~/git/build/v4.20-rc5+/net/ipv4/tcp.o
  --- /tmp/btfdiff.LRlcgc	2019-01-11 13:55:16.808989679 -0300
  +++ /tmp/btfdiff.SHuCev	2019-01-11 13:55:16.819989781 -0300
  @@ -585,11 +585,17 @@
   	__u16                      vesapm_off;           /*    48     2 */
   	__u16                      pages;                /*    50     2 */
   	__u16                      vesa_attributes;      /*    52     2 */
  -	__u32                      capabilities;         /*    54     4 */
  -	__u32                      ext_lfb_base;         /*    58     4 */
  +	__u32                      capabilities;         /*    52     4 */
  +	__u32                      ext_lfb_base;         /*    56     4 */
  +
  +	/* XXX 2 bytes hole, try to pack */
  +
   	__u8                       _reserved[2];         /*    62     2 */

   	/* size: 64, cachelines: 1, members: 36 */
  +	/* sum members: 60, holes: 1, sum holes: 2 */
  +
  +	/* BRAIN FART ALERT! 64 != 60 + 2(holes), diff = 2 */
   };
   struct apm_bios_info {
   	__u16                      version;              /*     0     2 */
  <SNIP>
  $

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed