Re: [PATCH v5 perf,bpf 12/15] perf, bpf: enable annotation of bpf program
From: Jiri Olsa
Date: Mon Mar 04 2019 - 08:53:56 EST
On Wed, Feb 27, 2019 at 09:06:40PM -0800, Song Liu wrote:
SNIP
> + fflush(s);
> + do {
> + const struct bpf_line_info *linfo = NULL;
> + struct disasm_line *dl;
> + size_t prev_buf_size;
> + const char *srcline;
> + u64 addr;
> +
> + addr = pc + ((u64 *)(info_linear->info.jited_ksyms))[sub_id];
> + count = disassemble(pc, &info);
> +
> + if (prog_linfo)
> + linfo = bpf_prog_linfo__lfind_addr_func(prog_linfo,
> + addr, sub_id,
> + nr_skip);
> +
> + if (linfo && btf) {
> + srcline = btf__name_by_offset(btf, linfo->line_off);
> + nr_skip++;
> + } else
> + srcline = NULL;
> +
> + fprintf(s, "\n");
> + prev_buf_size = buf_size;
> + fflush(s);
> +
> + if (!opts->hide_src_code && srcline) {
> + args->offset = -1;
why's the offset not needed in here?
jirka
> + args->line = strdup(srcline);
> + args->line_nr = 0;
> + args->ms.sym = sym;
> + dl = disasm_line__new(args);
> + if (dl) {
> + annotation_line__add(&dl->al,
> + ¬es->src->source);
> + }
> + }
SNIP