[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54F69C8D.9030207@hitachi.com>
Date: Wed, 04 Mar 2015 14:47:57 +0900
From: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To: Namhyung Kim <namhyung@...nel.org>
CC: Arnaldo Carvalho de Melo <acme@...nel.org>,
Naohiro Aota <naota@...sp.net>,
Peter Zijlstra <peterz@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>, Jiri Olsa <jolsa@...hat.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: Re: [PATCH perf/core 2/4] perf-probe: Fix to handle aliased
symbols in glibc
(2015/03/03 22:31), Namhyung Kim wrote:
> Hi Masami,
>
> On Mon, Mar 02, 2015 at 09:49:53PM +0900, Masami Hiramatsu wrote:
>> Fix perf probe to handle aliased symbols correctly in glibc.
>> In the glibc, several symbols are defined as an alias of
>> __libc_XXX, e.g. malloc is an alias of __libc_malloc.
>> In such cases, dwarf has no subroutine instances of the
>> alias functions (e.g. no "malloc" instance), but the map
>> has that symbol and its address.
>> Thus, if we search the alieased symbol in debuginfo, we
>> always fail to find it, but it is in the map.
>>
>> To solve this problem, this fails back to address-based
>> alternative search, which searches the symbol in the map,
>> translates its address to alternative (correct) function
>> name by using debuginfo, and retry to find the alternative
>> function point from debuginfo.
>>
>> This adds fail-back process to --vars, --lines and --add
>> options. So, now you can use those on malloc@...c :)
>
> So this is only for binaries that have debuginfo, right?
>
> I have a similar issue with no debuginfo.
>
> $ perf probe -x /usr/lib/libc.so.6 -V calloc
> The /usr/lib/libc-2.21.so file has no debug information.
> Rebuild with -g, or install an appropriate debuginfo package.
> Error: Failed to show vars.
>
>
> But it also failed to add a probe to calloc:
>
> $ perf probe -x /usr/lib/libc.so.6 -a calloc
> Failed to find symbol calloc in /usr/lib/libc-2.21.so
> Error: Failed to add events.
>
>
> Of course there's calloc in the libc binary.
>
> $ nm /usr/lib/libc.so.6 | grep calloc
> 000000000007b1f0 t __calloc
> 000000000007b1f0 T __libc_calloc
> 000000000007b1f0 W calloc
>
>
> I think the problem is that calloc is a weak symbol so it'll be
> discarded during the symbol loading.
Right, I also hit same problem on waitpid, which is also an weak symbol.
> It's because to avoid multiple
> symbols (or aliases) at a same address so we choose a better symbol
> using heuristics. But for this case I think we can allow aliases
> since it's used only for finding probe points.
I'm just using struct map and dso, so those should be improved.
Thank you,
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@...achi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists