Re: [PATCH 2/2] perf probe: Fix the incorrect line number display in 'perf probe -l'
From: Google
Date: Wed Nov 13 2024 - 11:34:23 EST
Hi Li,
On Wed, 13 Nov 2024 16:39:54 +0800
Li Huafei <lihuafei1@xxxxxxxxxx> wrote:
>
>
> On 2024/11/12 11:09, Li Huafei wrote:
> > Hi Masami,
> >
> > On 2024/11/11 20:05, Masami Hiramatsu (Google) wrote:
> >> Hi Li,
> >>
> >> On Mon, 11 Nov 2024 17:05:49 +0900
> >> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
> >>
> >>> Currently debuginfo__find_probe_point() does
> >>>
> >>> (1) Get the line and file from CU's lineinfo
> >>> (2) Get the real function(function instance) of the address
> >>> (use this function's decl_line/decl_file as basement)
> >>> (2-1) Search the inlined function scope in the real function
> >>> for the given address.
> >>> (2-2) if there is inlined function, update basement line/file.
> >>> (2-3) verify the filename is same as basement filename.
> >>> (3) calculate the relative line number from basement.
> >>>
> >>> The problem is in (1). Since we have no basement file/line info,
> >>> we can not verify that the file/line info from CU's lineinfo.
> >>> As Li shown above, the lineinfo may have several different lines
> >>> for one address. We need to find most appropriate one based on
> >>> the basement file/line.
> >>>
> >>> Thus what we need are
> >>>
> >>> - Introduce cu_find_lineinfo_at() which gives basement file/line
> >>> information so that it can choose correct one. (hopefully)
> >>> - Swap the order of (1) and (2*) so that we can pass the basement
> >>> file/line when searching lineinfo. (Also, (2-3) should be right
> >>> before (3))
> >>>
> >>
> >> Can you check below change fixes your issue?
> >>
> >
> > Thank you for the detailed explanation in your previous email. I tested
> > your patch, and the results are as follows:
> >
> > # perf probe -l
> > probe:schedule (on schedule:5@kernel/sched/core.c)
> >
>
> Sorry, I made a mistake. 5 is the offset from the function entry, not
> the line number. So your patch is ok.
Thanks for testing! OK, let me cleanup the patch.
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>