From 66e640508e4d00f582df2bbf66f7e461129946c3 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 9 Jan 2020 14:16:52 -0300 Subject: [PATCH] dwarves: Make function__for_each_parameter receive 'cu' arg Needed to find the right 'struct ftype' to iterate function arguments on. This is due to how BTF works with this and how we implemented it, at some point this can get improved to avoid the need for checking if it is BTF, doing it in a more format abstracted way, but for now, abstract this away in the for_each_parameter helpers. Signed-off-by: Arnaldo Carvalho de Melo --- dwarves.h | 4 ++-- syscse.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dwarves.h b/dwarves.h index cd44381..a9fcd9a 100644 --- a/dwarves.h +++ b/dwarves.h @@ -818,8 +818,8 @@ static __pure inline int tag__is_function(const struct tag *tag) * @func: struct function instance to iterate * @pos: struct parameter iterator */ -#define function__for_each_parameter(func, pos) \ - ftype__for_each_parameter(&func->proto, pos) +#define function__for_each_parameter(func, cu, pos) \ + ftype__for_each_parameter(func->btf ? tag__ftype(cu__type(cu, func->proto.tag.type)) : &func->proto, pos) const char *function__name(struct function *func, const struct cu *cu); diff --git a/syscse.c b/syscse.c index 9369634..6df8674 100644 --- a/syscse.c +++ b/syscse.c @@ -61,7 +61,7 @@ static void emit_wrapper(struct function *f, struct cu *cu) const char *name = function__name(f, cu); int regparm = 0, needs_wrapper = 0; - function__for_each_parameter(f, parm) { + function__for_each_parameter(f, cu, parm) { const type_id_t type_id = parm->tag.type; struct tag *type = cu__type(cu, type_id);