Usage: pahole [OPTION...] FILE
-a, --anon_include include anonymous classes
-A, --nested_anon_include include nested (inside other structs) anonymous
classes
--btf_attributes Allow generation of attributes in BTF. Attributes
are the type tags and decl tags with the kind_flag
set to 1.
--btf_base=PATH Path to the base BTF file
--btf_encode_detached=FILENAME
Encode as BTF in a detached file
--btf_encode_force Ignore those symbols found invalid when encoding
BTF.
--btf_features=FEATURE_LIST
Specify supported BTF features in FEATURE_LIST or
'default' for default set of supported features.
See the pahole manual page for the list of
supported, default features.
--btf_features_strict=FEATURE_LIST_STRICT
Specify supported BTF features in
FEATURE_LIST_STRICT or 'default' for default set
of supported features. Unlike --btf_features,
unrecognized features will trigger an error.
--btf_gen_all Allow using all the BTF features supported by
pahole.
--btf_gen_floats Allow producing BTF_KIND_FLOAT entries.
--btf_gen_optimized Generate BTF for functions with
optimization-related suffixes (.isra,
.constprop).
-B, --bit_holes=NR_HOLES Show only structs at least NR_HOLES bit holes
--classes_as_structs Use 'struct' when printing classes
--compile Emit compilable types
--contains_enumerator=ENUMERATOR
Show enumerations that contains ENUMERATOR
--count=COUNT Print only COUNT input records
-c, --cacheline_size=SIZE set cacheline size to SIZE
-C, --class_name=CLASS_NAME Show just this class
--devel_version Print development version with git SHA (e.g.,
v1.31-189-g437fced33da3393e)
-d, --recursive recursive mode, affects several other flags
-D, --decl_exclude=PREFIX exclude classes declared in files with PREFIX
-E, --expand_types expand class members
--features=FEATURE_LIST Specify supported features in FEATURE_LIST or
'default' for default set of supported features.
See the pahole manual page for the list of
supported, default features.
--first_obj_only Only process the first object file in the binary
--fixup_silly_bitfields Fix silly bitfields such as int foo:32
--flat_arrays Flat arrays
-f, --find_pointers_to=CLASS_NAME
Find pointers to CLASS_NAME
-F, --format_path=FORMAT_LIST List of debugging formats to try
--hashbits=BITS Number of bits for the hash table key
--header_type=TYPE File header type
--hex Print offsets and sizes in hexadecimal
-H, --holes=NR_HOLES show only structs with at least NR_HOLES holes
-i, --contains=CLASS_NAME Show classes that contains CLASS_NAME
-I, --show_decl_info Show the file and line number where the tags were
defined
-j, --jobs[=NR_JOBS] run N jobs in parallel [default to number of
online processors + 10%]
-J, --btf_encode Encode as BTF
--kabi_prefix=STRING When the prefix of the string is STRING, treat the
string as STRING.
--lang=LANGUAGES Only consider compilation units written in these
languages
--lang_exclude=LANGUAGES Don't consider compilation units written in
these languages
-l, --show_first_biggest_size_base_type_member
show first biggest size base_type member
-m, --nr_methods show number of methods
-M, --show_only_data_members show only the members that use space in the
class layout
--numeric_version Print a numeric version, i.e. 119 instead of v1.19
-n, --nr_members show number of members
-N, --class_name_len show size of classes
--packed Show just packed structs
--padding_ge=SIZE_PADDING show only structs with at least SIZE_PADDING
bytes padding at its end
--prettify=PATH Path to the raw data to pretty print
--ptr_table_stats Print internal data structures stats
-p, --expand_pointers expand class pointer members
-P, --packable show only structs that has holes that can be
packed
-q, --quiet be quieter
--range=STRUCT Data struct with 'offset' and 'size' fields to
determine --seek_bytes and --size_bytes
--reproducible_build Generate reproducile BTF output
--running_kernel_vmlinux Search for, possibly getting from a debuginfo
server, a vmlinux matching the running kernel
build-id (from /sys/kernel/notes)
-r, --rel_offset show relative offsets of members in inner structs
-R, --reorganize reorg struct trying to kill holes
--seek_bytes=BYTES Seek COUNT input records
--show_private_classes Show classes that are defined inside other classes
or in functions
--size_bytes=BYTES Read only this number of bytes from this point
onwards
--skip=COUNT Skip COUNT input records
--skip_emitting_atomic_typedefs
Do not emit 'typedef _Atomic int atomic_int' &
friends.
--skip_encoding_btf_decl_tag
Do not encode TAGs in BTF.
--skip_encoding_btf_enum64 Do not encode ENUM64sin BTF.
--skip_encoding_btf_inconsistent_proto
Skip functions that have multiple inconsistent
function prototypes sharing the same name, or that
use unexpected registers for parameter values.
--skip_encoding_btf_type_tag
Do not encode TAGs in BTF.
--skip_encoding_btf_vars Do not encode any VARs in BTF [if this is not
specified, only percpu variables are encoded. To
encode global variables too, use
--encode_btf_global_vars].
--skip_missing skip missing types passed to -C rather than stop
--sort Sort types by name
--structs Show just structs
--supported_btf_features Show list of btf_features supported by pahole
and exit.
--suppress_aligned_attribute
Suppress __attribute__((aligned(N))
--suppress_force_paddings Suppress int :N paddings at the end
--suppress_packed Suppress output of inferred
__attribute__((__packed__))
-s, --sizes show size of classes
-S, --show_reorg_steps show the struct layout at each reorganization
step
-t, --separator=SEP use SEP as the field separator
-T, --nr_definitions show how many times struct was defined
--unions Show just unions
-u, --defined_in show CUs where CLASS_NAME (-C) is defined
-V, --verbose be verbose
--with_embedded_flexible_array
show only structs with an embedded flexible array
(containing a struct that has a flexible array)
--with_flexible_array show only structs with a flexible array
-w, --word_size=WORD_SIZE change the arch word size to WORD_SIZE
-x, --exclude=PREFIX exclude PREFIXed classes
-X, --cu_exclude=PREFIX exclude PREFIXed compilation units
-y, --prefix_filter=PREFIX include PREFIXed classes
-z, --hole_size_ge=HOLE_SIZE show only structs with at least one hole
greater or equal to HOLE_SIZE
-Z, --ctf_encode Encode as CTF: DISABLED, consider helping porting
to libctf
-?, --help Give this help list
--usage Give a short usage message
--version Print program version
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
Options (92)
| Option | Description | Source |
|---|---|---|
-a, --anon_include | Include anonymous classes. | help + man |
-A, --nested_anon_include | Include nested (inside other structs) anonymous classes. | help + man |
--btf_attributes | Allow generation of attributes in BTF. | help |
--btf_base PATH | Path to the base BTF file, for instance: vmlinux when encoding kernel module BTF information. | help + man |
--btf_encode_detached FILENAME | Same thing as -J/--btf_encode, but storing the raw BTF info into a separate file. | help + man |
--btf_encode_force | Ignore those symbols found invalid when encoding BTF. | help + man |
--btf_features_strict FEATURE_LIST_STRICT | Specify supported BTF features in FEATURE_LIST_STRICT or 'default' for default set of supported features. | help + man |
--btf_gen_all | Allow using all the BTF features supported by pahole. | help + man |
--btf_gen_floats | Allow producing BTF_KIND_FLOAT entries in systems where the vmlinux DWARF information has float types. | help + man |
--btf_gen_optimized | Generate BTF for functions with optimization-related suffixes (.isra, .constprop). | help + man |
-B, --bit_holes NR_HOLES | Show only structs at least NR_HOLES bit holes. | help + man |
--classes_as_structs | Use 'struct' when printing classes | help |
--compile | Generate compileable code, with all definitions for all types, i.e.: | help + man |
--contains_enumerator ENUMERATOR | Show enumeration that contains ENUMERATOR_NAME. | help + man |
--count COUNT | Pretty print the first COUNT records from input. | help + man |
-c, --cacheline_size SIZE | Set cacheline size to SIZE bytes. | help + man |
-C, --class_name CLASS_NAME | Show just these classes. | help + man |
--devel_version | Print development version with git SHA (e.g., v1.31-189-g437fced33da3393e) | help |
-d, --recursive | Recursive mode, affects several other flags. | help + man |
-D, --decl_exclude PREFIX | exclude classes declared in files with PREFIX. | help + man |
-E, --expand_types | Expand class members. | help + man |
--features FEATURE_LIST | This is also available as --btf_features=FEATURE_LIST, unknown features, like those added in newer versions of pahole, are ignored. | help + man |
--first_obj_only | Only process the first object file in the binary | help |
--fixup_silly_bitfields | Converts silly bitfields such as "int foo:32" to plain "int foo". | help + man |
--flat_arrays | Flatten arrays, so that array[10][2] becomes array[20]. | help + man |
-f, --find_pointers_to CLASS_NAME | Find pointers to CLASS_NAME. | help + man |
-F, --format_path FORMAT_LIST | Allows specifying a list of debugging formats to try, in order. | help + man |
--hashbits BITS | Allows specifying the number of bits for the debugging format loader to use. | help + man |
--header_type TYPE | File header type | help |
--hex | Print offsets and sizes in hexadecimal. | help + man |
-H, --holes NR_HOLES | Show only structs with at least NR_HOLES holes. | help + man |
-i, --contains CLASS_NAME | Show classes that contains CLASS_NAME. | help + man |
-I, --show_decl_info | Show the file and line number where the tags were defined, if available in the debugging information. | help + man |
-j, --jobs NR_JOBS | run N jobs in parallel [default to number of online processors + 10%] | help + man |
-J, --btf_encode | Encode BTF information from DWARF, used in the Linux kernel build process when CONFIG_DEBUG_INFO_BTF=y is present, introduced in Linux v5.2. | help + man |
--kabi_prefix STRING | When the prefix of the string is STRING, treat the string as STRING. | help + man |
--lang LANGUAGES | Only process compilation units built from source code written in the specified languages. | help + man |
--lang_exclude LANGUAGES | To filter out compilation units written in Rust, for instance, use: | help + man |
-l, --show_first_biggest_size_base_type_member | Show first biggest size base_type member. | help + man |
-m, --nr_methods | Show number of methods of all classes, i.e., the number of functions have arguments that are pointers to a given class. | help + man |
-M, --show_only_data_members | Show only the members that use space in the class layout. | help + man |
--numeric_version | Show a numeric only version, suitable for use in Makefiles and scripts where one wants to know what if the installed version has some feature, i.e.: 118 instead of "v1.18". | help + man |
-n, --nr_members | Show number of members. | help + man |
-N, --class_name_len | Show size of classes. | help + man |
--packed | Show only packed structs, all the other filters apply, i.e. to show just the sizes of all packed structs combine --packed with --sizes, etc. | help + man |
--padding_ge SIZE_PADDING | Show only structs with at least SIZE_PADDING bytes of padding at its end. | help + man |
--prettify PATH | Path to the raw data to pretty print | help |
--ptr_table_stats | Print statistics about ptr_table data structures, used to hold all the types, tags and functions data structures, for development tuning of such tables, tuned for a typical 2021 vmlinux file. | help + man |
-p, --expand_pointers | Expand class pointer members. | help + man |
-P, --packable | Show only structs that has holes that can be packed if members are reorganized, for instance when using the --reorganize option. | help + man |
-q, --quiet | Be quieter. | help + man |
--range STRUCT | Data struct with 'offset' and 'size' fields to determine --seek_bytes and --size_bytes | help |
--reproducible_build | Generate reproducile BTF output | help |
--running_kernel_vmlinux | Search for, possibly getting from a debuginfo server, a vmlinux matching the running kernel build-id (from /sys/kernel/notes). | help + man |
-r, --rel_offset | Show relative offsets of members in inner structs. | help + man |
-R, --reorganize | Reorganize struct, demoting and combining bitfields, moving members to remove alignment holes and padding. | help + man |
--seek_bytes BYTES | Seek COUNT input records | help |
--size_bytes BYTES | Read only this number of bytes from this point onwards | help |
--skip COUNT | Skip COUNT input records. | help + man |
--skip_emitting_atomic_typedefs | Do not emit 'typedef _Atomic int atomic_int' & friends when used with options like --compile. | help + man |
--skip_encoding_btf_decl_tag | Do not encode decl tags in BTF. | help + man |
--skip_encoding_btf_enum64 | Do not encode ENUM64sin BTF. | help + man |
--skip_encoding_btf_type_tag | Do not encode type tags in BTF. | help + man |
--skip_encoding_btf_vars | Do not encode any VARs in BTF [if this is not specified, only percpu variables are encoded. | help + man |
--skip_missing | skip missing types passed to -C rather than stop | help |
--sort | Sort the output by type name, maybe this will grow to allow sorting by other criteria. | help + man |
--structs | Show only structs, all the other filters apply, i.e. to show just the sizes of all structs combine --structs with --sizes, etc. | help + man |
--supported_btf_features | Show set of BTF features supported by --btf_features option and exit. | help + man |
--suppress_aligned_attribute | Suppress forced alignment markers, so that one can compare BTF or CTF output, that don't have that info, to output from DWARF >= 5. | help + man |
--suppress_force_paddings | Suppress bitfield forced padding at the end of structs, as this requires something like DWARF's DW_AT_alignment, so that one can compare BTF or CTF output, that don't have that info. | help + man |
--suppress_packed | Suppress the output of the inference of __attribute__((__packed__)), so that one can compare BTF or CTF output, the inference algorithm uses things like DW_AT_alignment, so until it is improved to… | help + man |
-s, --sizes | Show size of classes. | help + man |
-S, --show_reorg_steps | Show the struct layout at each reorganization step. | help + man |
-t, --separator SEP | Use SEP as the field separator. | help + man |
-T, --nr_definitions | Show how many times struct was defined. | help + man |
--unions | Show only unions, all the other filters apply, i.e. to show just the sizes of all unions combine --union with --sizes, etc. | help + man |
-u, --defined_in | Show CUs where CLASS_NAME (-C) is defined. | help + man |
-V, --verbose | be verbose | help + man |
--with_embedded_flexible_array | Show only structs that have an embedded flexible array, i.e., a contained struct that has flexible array(s) "in the middle". | help + man |
--with_flexible_array | Show only structs that have a flexible array. | help + man |
-w, --word_size WORD_SIZE | Change the arch word size to WORD_SIZE. | help + man |
-x, --exclude PREFIX | Exclude PREFIXed classes. | help + man |
-X, --cu_exclude PREFIX | Exclude PREFIXed compilation units. | help + man |
-z, --hole_size_ge HOLE_SIZE | Show only structs with at least one hole greater or equal to HOLE_SIZE. | help + man |
-Z, --ctf_encode | Encode as CTF: DISABLED, consider helping porting to libctf | help |
-?, --help | Give this help list | help |
--usage | Give a short usage message | help |
--version | Show a traditional string version, i.e.: "v1.18". | help + man |
--padding SIZE_PADDING | Show only structs with SIZE_PADDING bytes of padding at its end. (in the manual page but not in --help) | man |
--skip_encoding_btf_inconsistent_proto | Do not encode functions with multiple inconsistent prototypes or unexpected register use for their parameters, where the registers used do not match calling conventions. (in the manual page but not in --help) | man |
-O, --dwarf_offset OFFSET | Show tag with DWARF OFFSET. (in the manual page but not in --help) | man |
-y, --prefix_filter PREFIX | Include PREFIXed classes. (in the manual page but not in --help) | man |
Examples (11) from the manual page, untested
pahole -C __u64
Show a type:pahole raw_spinlock_t
Works as well if the only argument is a type name:pahole raw_spinlock_t,raw_spinlock
Multiple types can be passed, separated by commas:pahole -E raw_spinlock
Types can be expanded:pahole --hex thread_struct
When decoding OOPSes you may want to see the offsets and sizes in hexadecimal:pahole --hex -E thread_struct | egrep '(0x178|struct fpu)' -B4 -A4
OK, I know the offset that causes its a 'struct thread_struct' and that the offset is 0x178, so must be in that 'fpu' struct...pahole -I thread_struct | head -2
Want to know where 'struct thread_struct' is defined in the kernel sources?pahole -Fdwarf -I thread_struct | head -2
Not present in BTF, so use DWARF, takes a little bit longer, and assuming it finds the matching vmlinux file:pahole -s | sort -k2 -nr | head -5
To find the biggest data structures in the Linux kernel:pahole --contains raw_spinlock_t --prefix rcu
Show data structures that have a raw spinlock and are related to the RCU mechanism:pahole rcu_state | grep raw_spinlock_t -B1 -A5
To see that in context, combine it with grep: