From e7ebc05d12e18feaba72fceec54340feb405171f Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 4 Apr 2019 17:40:22 -0300 Subject: [PATCH] emit: Unwind the definitions for typedefs in type__emit_definitions() For instance, with the existing code we ended up with: typedef __kernel_size_t size_t; size_t tcp_opt_stats_get_size(void) { } Which lacks unwinding what a __kernel_size_t is, i.e. type__emit_definitions() was only emitting definitions for the members of structs and unions, do it for typedefs too, and then we end up what we need, which is: typedef long unsigned int __kernel_ulong_t; typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_size_t size_t; size_t tcp_opt_stats_get_size(void) { } Signed-off-by: Arnaldo Carvalho de Melo --- dwarves_emit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dwarves_emit.c b/dwarves_emit.c index 062cdea..893837c 100644 --- a/dwarves_emit.c +++ b/dwarves_emit.c @@ -294,6 +294,9 @@ int type__emit_definitions(struct tag *tag, struct cu *cu, return 0; } + if (tag__is_typedef(tag)) + return typedef__emit_definitions(tag, cu, emissions, fp); + type_emissions__add_definition(emissions, ctype); type__for_each_member(ctype, pos)