[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <F363AFC6-A048-44C7-80DE-22C20ADE7CD8@fb.com>
Date: Mon, 4 Mar 2019 20:43:25 +0000
From: Song Liu <songliubraving@...com>
To: Jiri Olsa <jolsa@...hat.com>
CC: Networking <netdev@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
Kernel Team <Kernel-team@...com>,
"peterz@...radead.org" <peterz@...radead.org>,
"acme@...hat.com" <acme@...hat.com>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"namhyung@...nel.org" <namhyung@...nel.org>
Subject: Re: [PATCH v5 perf,bpf 12/15] perf, bpf: enable annotation of bpf
program
> On Mar 4, 2019, at 12:37 PM, Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Mon, Mar 04, 2019 at 07:45:00PM +0000, Song Liu wrote:
>>
>>
>>> On Mar 4, 2019, at 5:53 AM, Jiri Olsa <jolsa@...hat.com> wrote:
>>>
>>> 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?
>>
>> This is the source code line. Based on my understanding of annotation
>> code, we put -1 for source code line. Did I misunderstand something?
>
> please double check, IIRC annotation_line__print will print
> just more info if offset is present, together with the source,
> but I haven't checked that code for some time, so I might be wrong
>
> jirka
In symbol__parse_objdump_line(), default offset is -1. And it is only
updated if line_ip is not -1. And line_ip for src code line is -1, so
offset for the source line is -1.
It works fine in the tests when I toggle source code on/off with key
's'.
Thanks
Song
Powered by blists - more mailing lists