Skip to content

lisa/_assets/kmodules/sched_tp/Makefile: Improve pahole output

Use --show_only_data_members to avoid having useless anonymous type declaration in the middle of e.g. a struct.

Consider the following type:

struct foo {
   struct { int a; } bar;
};

GCC emits DWARF info looking this way:

DW_TAG_structure_type
   DW_AT_name "foo"
   DW_TAG_member
  DW_AT_name "bar"
  DW_AT_type "struct "
  DW_AT_data_member_location <0x42 - curr_loc>
   NULL

0x42:
DW_TAG_structure_type
   DW_TAG_member
  DW_AT_name "a"
  DW_AT_type "int "
  DW_AT_data_member_location ...
   NULL

Clang emits:

DW_TAG_structure_type
   DW_AT_name "foo"
   DW_TAG_member
  DW_AT_name "bar"
  DW_AT_type "struct "
  DW_AT_data_member_location 0x0

   DW_TAG_structure_type
  DW_TAG_member
     DW_AT_name "a"
     DW_AT_type "int "
     DW_AT_data_member_location ...
  NULL
   NULL

When pahole sees clang's output, it will emit something like that:

struct foo {
   struct { int a; }; <------useless
   struct { int a; } bar;
};

But with --show_only_data_members, it will ignore any child of DW_TAG_structure_type that is not a DW_TAG_member and will print the expected code.

Merge request reports