pahole: Introduce --lang to ask for only compilation units written in some languages

Works with all options, i.e. to test it one can use:

$ pahole --lang rust

And, using /sys/kernel/btf/vmlinux, the default, nothing will be
printed, as BTF doesn't have the language information and everything is
considered to be written in "C".

So, still using BTF, this:

$ pahole --lang c

is equivalent to:

$ pahole

I.e. will print all types.

Using DWARF it will use the DW_AT_language attribute of the
DW_TAG_compile_unit to honour this filter.

I.e.:

$ pahole -F dwarf --lang c,c89,rust

is equivalent to:

$ pahole -F dwarf

As the kernel is written in those languages.

The real use case will be serviced in the following patch, which is to
not process compilation units written in rust when generating BTF.

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