pahole: Search for unions as well with '-C'

So that this now works:

  $ pahole -C kvm_mmu_page_role ../build/v4.20-rc5/arch/x86/kvm/kvm.o
  union kvm_mmu_page_role {
	  struct {
		  unsigned int       level:4;            /*     0:28  4 */
		  unsigned int       cr4_pae:1;          /*     0:27  4 */
		  unsigned int       quadrant:2;         /*     0:25  4 */
		  unsigned int       direct:1;           /*     0:24  4 */
		  unsigned int       access:3;           /*     0:21  4 */
		  unsigned int       invalid:1;          /*     0:20  4 */
		  unsigned int       nxe:1;              /*     0:19  4 */
		  unsigned int       cr0_wp:1;           /*     0:18  4 */
		  unsigned int       smep_andnot_wp:1;   /*     0:17  4 */
		  unsigned int       smap_andnot_wp:1;   /*     0:16  4 */
		  unsigned int       ad_disabled:1;      /*     0:15  4 */
		  unsigned int       guest_mode:1;       /*     0:14  4 */
		  unsigned int       smm:8;              /*     0: 0  4 */
	  };                                             /*     0     4 */
  };
  $

Suggested-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2018-12-03 13:15:14 -03:00
parent da632a3686
commit d843945ba5
1 changed files with 5 additions and 6 deletions

View File

@ -1153,9 +1153,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu,
static uint16_t class_id;
bool include_decls = find_pointers_in_structs != 0 ||
stats_formatter == nr_methods_formatter;
struct tag *class = cu__find_struct_by_name(cu, pos->s,
include_decls,
&class_id);
struct tag *class = cu__find_struct_or_union_by_name(cu, pos->s, include_decls, &class_id);
if (class == NULL)
continue;
@ -1170,9 +1168,10 @@ static enum load_steal_kind pahole_stealer(struct cu *cu,
strlist__remove(class_names, pos);
class__find_holes(tag__class(class));
if (reorganize)
do_reorg(class, cu);
else if (find_containers)
if (reorganize) {
if (tag__is_struct(class))
do_reorg(class, cu);
} else if (find_containers)
print_containers(cu, class_id, 0);
else if (find_pointers_in_structs)
print_structs_with_pointer_to(cu, class_id);