From c0d42c075506a42ed44ced17d1d623f3506df8a8 Mon Sep 17 00:00:00 2001 From: Wadim Mueller Date: Tue, 3 Jan 2023 16:47:32 +0100 Subject: [PATCH] pahole: expand named typedefs if expanding types is requested If your code contains named typedefs like typedef struct foo_s { /*some stuff here*/ }foo; and your run pahole with something like pahole -E -C foo it only prints something like this typedef struct foo_s foo I think what the user would like (at least this is what I was expecting) is that the typedef is expanded. I know that this is irrelevant for the linux kernel because nobody is doing such silly stuff there. But there is a lot of strange software out there which typedefs nearly every structure for some reason. I think applying this patch would make pahole -E more intuitive Signed-off-by: Wadim Mueller --- dwarves_fprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c index e62bce1e..91085dff 100644 --- a/dwarves_fprintf.c +++ b/dwarves_fprintf.c @@ -345,7 +345,7 @@ size_t typedef__fprintf(const struct tag *tag, const struct cu *cu, case DW_TAG_structure_type: { struct type *ctype = tag__type(tag_type); - if (type__name(ctype) != NULL) + if (type__name(ctype) != NULL && conf->expand_types != true) return printed + fprintf(fp, "struct %s %s", type__name(ctype), type__name(type)); struct conf_fprintf tconf = *pconf;