Re: [PATCH 1/2] btf_encoder: Factor filter_functions function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 26, 2020 at 08:05:11PM -0800, Andrii Nakryiko wrote:
> On Tue, Nov 24, 2020 at 8:22 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> >
> > Reorder the filter_functions function so we can add
> > processing of kernel modules in following patch.
> >
> > There's no functional change intended.
> >
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > ---
> >  btf_encoder.c | 57 +++++++++++++++++++++++++++++++++------------------
> >  1 file changed, 37 insertions(+), 20 deletions(-)
> >
> > diff --git a/btf_encoder.c b/btf_encoder.c
> > index c40f059580da..467c4657b2c0 100644
> > --- a/btf_encoder.c
> > +++ b/btf_encoder.c
> > @@ -101,14 +101,17 @@ static int addrs_cmp(const void *_a, const void *_b)
> >         return *a < *b ? -1 : 1;
> >  }
> >
> > -static int filter_functions(struct btf_elf *btfe, struct funcs_layout *fl)
> > +static int get_vmlinux_addrs(struct btf_elf *btfe, struct funcs_layout *fl,
> > +                            unsigned long **paddrs, unsigned long *pcount)
> >  {
> > -       unsigned long *addrs, count, offset, i;
> > -       int functions_valid = 0;
> > +       unsigned long *addrs, count, offset;
> >         Elf_Data *data;
> >         GElf_Shdr shdr;
> >         Elf_Scn *sec;
> >
> > +       if (!fl->mcount_start || !fl->mcount_stop)
> > +               return 0;
> > +
> 
> probably better to explicitly assign paddrs and pcount to NULL and 0 here

ok

SNIP

> > -       if (functions_cnt && has_all_symbols(&fl)) {
> > -               qsort(functions, functions_cnt, sizeof(functions[0]), functions_cmp);
> > -               if (filter_functions(btfe, &fl)) {
> > -                       fprintf(stderr, "Failed to filter dwarf functions\n");
> > -                       return -1;
> > -               }
> > -               if (btf_elf__verbose)
> > -                       printf("Found %d functions!\n", functions_cnt);
> > -       } else {
> > -               if (btf_elf__verbose)
> > -                       printf("ftrace symbols not detected, falling back to DWARF data\n");
> > -               delete_functions();
> > +       if (functions_cnt && setup_functions(btfe, &fl)) {
> > +               fprintf(stderr, "Failed to filter dwarf functions\n");
> 
> DWARF

ook

thanks,
jirka




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux