On Fri, Nov 13, 2020 at 01:32:22PM +0900, Namhyung Kim wrote:
> On Mon, Nov 09, 2020 at 10:54:06PM +0100, Jiri Olsa wrote:
> > Adding build id to synthesized mmap2 events for
> > everything - kernel/modules/tasks.
> > 
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> >  tools/perf/util/synthetic-events.c | 33 ++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/tools/perf/util/synthetic-events.c 
> > b/tools/perf/util/synthetic-events.c
> > index a18ae502d765..a9d5d1ff2cad 100644
> > --- a/tools/perf/util/synthetic-events.c
> > +++ b/tools/perf/util/synthetic-events.c
> > @@ -347,6 +347,32 @@ static bool read_proc_maps_line(struct io *io, __u64 
> > *start, __u64 *end,
> >     }
> >  }
> >  
> > +static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 
> > *event,
> > +                                        bool is_kernel)
> > +{
> > +   struct build_id bid;
> > +   int rc;
> > +
> > +   if (is_kernel)
> > +           rc = sysfs__read_build_id("/sys/kernel/notes", &bid);
> > +   else
> > +           rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : 
> > -1;
> > +
> > +   if (rc == 0) {
> > +           memcpy(event->build_id, bid.data, sizeof(bid.data));
> > +           event->build_id_size = (u8) bid.size;
> > +   } else {
> > +           if (event->filename[0] == '/') {
> > +                   pr_debug2("Failed to read build ID for %s\n",
> > +                             event->filename);
> > +           }
> > +           memset(event->build_id, 0x0, sizeof(event->build_id));
> 
> Likewise, we should not set the misc bit here IMHO.

right, will implement the fallback

jirka

Reply via email to