From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753941AbcIUEnh (ORCPT ); Wed, 21 Sep 2016 00:43:37 -0400 Received: from mail.kernel.org ([198.145.29.136]:57270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750749AbcIUEnf (ORCPT ); Wed, 21 Sep 2016 00:43:35 -0400 Date: Wed, 21 Sep 2016 13:43:24 +0900 From: Masami Hiramatsu To: Masami Hiramatsu Cc: Thomas Gleixner , Jiri Olsa , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Namhyung Kim , David Ahern Subject: Re: failed to add c++ probe Message-Id: <20160921134324.996aae22bead9dbf34a7a41d@kernel.org> In-Reply-To: <20160921123759.5c3f1f5db5f298a20ea784b0@kernel.org> References: <20160919095402.GA2306@krava> <20160920080557.5db69ddd16524ca6abcb3d83@kernel.org> <20160921123759.5c3f1f5db5f298a20ea784b0@kernel.org> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Sep 2016 12:37:59 +0900 Masami Hiramatsu wrote: > On Tue, 20 Sep 2016 01:32:04 +0200 (CEST) > Thomas Gleixner wrote: > > > Masami, > > > > On Tue, 20 Sep 2016, Masami Hiramatsu wrote: > > > Hmm, could you try to find mangled symbol from the library as below? > > > > > > ./perf probe -x /usr/lib64/libstdc++.so.6 -F \* > > > > > > And also try to do adding probe with -v option again? > > > > > > In my case, I could find the mangled symbol, but failed to setup the probe... > > > > ./perf probe -x /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -v _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv > > probe-definition(0): _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv > > symbol:_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv file:(null) line:0 offset:0 return:0 lazy:(null) > > 0 arguments > > symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null) > > symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null) > > symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null) > > Open Debuginfo file: /usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 > > Try to find probe point from debuginfo. > > Symbol _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv address found : 8c620 > > Matched function: is_open > > found inline addr: 0x8cad0 > > Probe point found: is_open+0 > > found inline addr: 0x8cac0 > > Probe point found: is_open+0 > > found inline addr: 0x8cab0 > > Probe point found: is_open+0 > > Matched function: is_open > > An error occurred in debuginfo analysis (-2). > > Trying to use symbols. > > Opening /sys/kernel/tracing//uprobe_events write=1 > > Writing event: p:probe_libstdc++/_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22:0x8c620 > > Failed to write event: Invalid argument > > Error: Failed to add events. Reason: Invalid argument (Code: -22) > > > > [16568.176464] Failed to allocate trace_uprobe.(-22) > > [16568.176468] Failed to parse address or file. > > > > Aside of that mangled symbols with a @plt suffix do not work at all. > > Oh, OK. I could reproduce it. I'll investigate it. :) > Hmm, I found there are 3 issues in perf-probe to define event on C++ libs. 1) No mangle/demangle symbol support. This needs a) fix option parser to accept C++ method name correctly, b) mangle that method, and c) demangle it when we show the probe point. 2) @plt symbol should be skipped since the real function will be called(jumped) from plt, when searching probe point. 3) Event group name is including some characters which can not be used (e.g. "++"). Thus we have to remove it or replace it with '_' or other alphabet.("PP"?) Thank you, -- Masami Hiramatsu