From: Douglas Raillard <douglas.raillard@xxxxxxx> Allow prefixing type names and enum members with an arbitrary string as a way of creating a manual namespace for additional types displayed with --expand_types. Signed-off-by: Douglas Raillard <douglas.raillard@xxxxxxx> --- man-pages/pahole.1 | 5 +++++ pahole.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/man-pages/pahole.1 b/man-pages/pahole.1 index c1ec63e..f845e24 100644 --- a/man-pages/pahole.1 +++ b/man-pages/pahole.1 @@ -122,6 +122,11 @@ Skip COUNT input records. Expand class members. Useful to find in what member of inner structs where an offset from the beginning of a struct is. +.TP +.B \-\-expanded_prefix +Add prefix to type names that are not specified using --class_name. This helps +avoiding conflicts with existing headers in types expanded by --expand_types. + .TP .B \-F, \-\-format_path Allows specifying a list of debugging formats to try, in order. Right now this diff --git a/pahole.c b/pahole.c index e0a1438..e828c31 100644 --- a/pahole.c +++ b/pahole.c @@ -1127,6 +1127,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version; #define ARGP_skip_encoding_btf_decl_tag 331 #define ARGP_skip_missing 332 #define ARGP_skip_encoding_btf_type_tag 333 +#define ARGP_expanded_prefix 334 static const struct argp_option pahole__options[] = { { @@ -1234,6 +1235,12 @@ static const struct argp_option pahole__options[] = { .key = 'E', .doc = "expand class members", }, + { + .name = "expanded_prefix", + .key = ARGP_expanded_prefix, + .arg = "NAME_PREFIX", + .doc = "Add prefix to all the nested types displayed with --expand_types", + }, { .name = "nr_members", .key = 'n', @@ -1666,6 +1673,8 @@ static error_t pahole__options_parser(int key, char *arg, conf_load.skip_missing = true; break; case ARGP_skip_encoding_btf_type_tag: conf_load.skip_encoding_btf_type_tag = true; break; + case ARGP_expanded_prefix: + conf.name_prefix = arg; break; default: return ARGP_ERR_UNKNOWN; } -- 2.25.1