On Fri, Oct 23, 2020 at 11:22:05AM -0700, Andrii Nakryiko wrote: > On Thu, Oct 22, 2020 at 11:58 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > > > > On Fri, Oct 23, 2020 at 07:36:57AM +0200, Jiri Olsa wrote: > > > On Thu, Oct 22, 2020 at 01:00:19PM -0700, Andrii Nakryiko wrote: > > > > > > SNIP > > > > > > > > > > > > > hi, > > > > > FYI there's still no solution yet, so far the progress is: > > > > > > > > > > the proposed workaround was to use the negation -> we don't have > > > > > DW_AT_declaration tag, so let's find out instead which DW_TAG_subprogram > > > > > tags have attached code and skip them if they don't have any: > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97060#c10 > > > > > > > > > > the attached patch is doing that, but the resulting BTF is missing > > > > > several functions due to another bug in dwarf: > > > > > https://bugzilla.redhat.com/show_bug.cgi?id=1890107 > > > > > > > > It seems fine if there are only few functions (especially if those are > > > > unlikely to be traced). Do you have an estimate of how many functions > > > > have this second DWARF bug? > > > > > > it wasn't that many, I'll recheck > > > > 127 functions missing if the workaround is applied, list attached > > > > some of those seem pretty useful... I guess the quick workaround in > pahole would be to just remember function names that were emitted > already. The problem with that is that we can pick a version without > parameter names, which is not the end of the world, but certainly > annoying. with the change below I seem to get all argument names the change assumes that we can skip dwarf functions with no argument names, because if the function is defined in the object, it needs to have argument names so there will be eventualy dwarf definition of that function with full argument names I wonder we could use this code as a check that the function is present in the object ;-) but I think we need to keep the symbols check as well I'll send that out together with the rest of the changes jirka --- diff --git a/btf_encoder.c b/btf_encoder.c index 7e370eb48174..0c14ac210425 100644 --- a/btf_encoder.c +++ b/btf_encoder.c @@ -397,6 +397,19 @@ static int config(struct btf_elf *btfe, bool do_percpu_vars) return 0; } +static bool has_arg_names(struct cu *cu, struct ftype *ftype) +{ + struct parameter *param; + const char *name; + + ftype__for_each_parameter(ftype, param) { + name = dwarves__active_loader->strings__ptr(cu, param->name); + if (name == NULL) + return false; + } + return true; +} + int cu__encode_btf(struct cu *cu, int verbose, bool force, bool skip_encoding_vars) { @@ -472,6 +485,9 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force, int btf_fnproto_id, btf_fn_id; const char *name; + if (!has_arg_names(cu, &fn->proto)) + continue; + if (!generate_func(btfe, function__name(fn, cu))) continue;