Skip to content

Commit

Permalink
pfunct: Use languages__init() to honour PAHOLE_LANG_EXCLUDE
Browse files Browse the repository at this point in the history
  $ echo $PAHOLE_LANG_EXCLUDE

  $ pfunct -F dwarf `pahole --running_kernel_vmlinux` > /dev/null
  die__process_class: tag not supported 0x33 (variant_part) at <7719ef8>!
  die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x77370f1> not handled in a rust CU!
  tag__recode_dwarf_type: couldn't find name for function 0x77558a9, abstract_origin=0, specification=0x77370f1
  ^C
  $ export PAHOLE_LANG_EXCLUDE=rust
  $ pfunct -F dwarf `pahole --running_kernel_vmlinux` > /dev/null
  $

Later we need to make it also have --lang_exclude and friends to be just
like pahole, maybe even have all this in a common command line parsing
set of routines, for now its enough to make it obey the env var in the
scripts in tests/.

Cc: Alan Maguire <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Miguel Ojeda <[email protected]>
Cc: Stephen Brennan <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Oct 23, 2024
1 parent cbb1149 commit 97f2f7b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pfunct.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ static struct conf_load conf_load = {
.conf_fprintf = &conf,
};

static struct languages languages;

struct fn_stats {
struct list_head node;
struct tag *tag;
Expand Down Expand Up @@ -533,6 +535,11 @@ static enum load_steal_kind pfunct_stealer(struct cu *cu,
return LSK__DELETE;
}

static struct cu *cu__filter(struct cu *cu)
{
return languages__cu_filtered(&languages, cu, verbose) ? NULL : cu;
}

/* Name and version of program. */
ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;

Expand Down Expand Up @@ -751,6 +758,12 @@ int main(int argc, char *argv[])
goto out;
}

if (languages__init(&languages, argv[0]))
return rc;

if (languages.exclude)
conf_load.early_cu_filter = cu__filter;

if (symtab_name != NULL)
return elf_symtabs__show(argv + remaining);

Expand Down

0 comments on commit 97f2f7b

Please sign in to comment.