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 <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2020-01-09 14:16:52 -03:00
parent 252b0fcc91
commit 66e640508e
2 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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);