Re: perf: relative path to source for perf probe?

Chase Douglas
2010-05-13T22:10:13Z

On Thu, May 13, 2010 at 11:46 PM, Arnaldo Carvalho de Melo
<acme@ghostprotocols.net> wrote:
> IOW:
>
> real_path = user_provided_path + (DW_AT_name - DW_AT_comp_dir)
>
> + == concat
>
> - remove initial string
>
> if the project is build in place, i.e. in the kernel case, when one
> doesn't use 'make O='
>
> But then, given user_provided_path what we can do is to find a match
> from the end of DW_AT_name, thus infering the missing (non-existent in
> DWARF) DW_AT_source_dir tag :-)
>
>> In this case (after compiling kernel, user moved its source into another
>> directory), we have to find the top directory of this source code.
>>
>> Imagine that, if user compiled code under /home/user/git-ksrc/, and
>> it was moved under  /usr/src/2.6.x/, perf probe will be given an option
>> '-s /usr/src/2.6.x/'.
>
> So, for the DW_AT_name example above, we would have these files:
>
> At build time (DW_AT_name):
>
> /home/acme_unencrypted/git/linux-2.6-tip/arch/x86/kernel/head_64.S
>
> And at analysis time (using the path where the user moved all the source
> tree):
>
> /usr/src/2.6.x/arch/x86/kernel/head_64.S
>
> Putting then side by side:
>
> /home/acme_unencrypted/git/linux-2.6-tip/arch/x86/kernel/head_64.S
>                          /usr/src/2.6.x/arch/x86/kernel/head_64.S
>
> So know we know what DW_AT_source_dir is.
>
> Implementation is left to the reader 8-)

Thank you both for this discussion! I think I have enough information
to try to create an implementation. Now I just need to find the time
to do it :).

-- Chase