From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756380AbbCFGgX (ORCPT ); Fri, 6 Mar 2015 01:36:23 -0500 Received: from mail7.hitachi.co.jp ([133.145.228.42]:48501 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbbCFGgV (ORCPT ); Fri, 6 Mar 2015 01:36:21 -0500 Message-ID: <54F94ADE.7010401@hitachi.com> Date: Fri, 06 Mar 2015 15:36:14 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Namhyung Kim CC: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML Subject: Re: [RFC/PATCH 2/2] perf probe: Allow weak symbols to be probed References: <1425477143-5310-1-git-send-email-namhyung@kernel.org> <1425477143-5310-2-git-send-email-namhyung@kernel.org> <54F72B61.5060809@hitachi.com> <20150306061530.GD7872@sejong> In-Reply-To: <20150306061530.GD7872@sejong> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (2015/03/06 15:15), Namhyung Kim wrote: > Hi Masami, > > On Thu, Mar 05, 2015 at 12:57:21AM +0900, Masami Hiramatsu wrote: >> (2015/03/04 22:52), Namhyung Kim wrote: >>> It currently prevents adding probes in weak symbols. But there're cases >>> that given name is an only weak symbol so that we cannot add probe. >>> >>> $ 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. >>> >>> $ nm /usr/lib/libc.so.6 | grep calloc >>> 000000000007b1f0 t __calloc >>> 000000000007b1f0 T __libc_calloc >>> 000000000007b1f0 W calloc >>> >>> This change will result in duplicate probes when strong and weak symbols >>> co-exist in a binary. But I think it's not a big problem since probes >>> at the weak symbol will never be hit anyway. >> >> Hmm, even on my previous series, I got an error with calloc and waitpid. >> >> $ ./perf probe -x /usr/lib64/libc-2.17.so -vvV calloc >> probe-definition(0): calloc >> symbol:calloc file:(null) line:0 offset:0 return:0 lazy:(null) >> 0 arguments >> Open Debuginfo file: /usr/lib/debug/usr/lib64/libc-2.17.so.debug >> Searching variables at calloc >> Failed to find the address of calloc >> Error: Failed to show vars. Reason: No such file or directory (Code: -2) >> >> However, it seems that calloc is loaded as a symbol. >> >> $ ./perf probe -x /usr/lib64/libc-2.17.so -vvvvV calloc >> ... >> symbol__new: __xstat64 0xe7340-0xe7385 >> symbol__new: calloc 0x80a90-0x80d2a >> symbol__new: msgget 0xf7940-0xf7961 >> ... >> >> FYI, without these patches, I see the same result (calloc is loaded) > > I'm bit confused with the English ;-). So you mean that now you *can* > probe calloc and waitpid with this patch, right? Ah, sorry for confusing you. I meant that I couldn't probe it even with your patch. I'm not sure why, since the calloc symbol is created as above message, but can't find in the map... Thank you, -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com