From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754982AbdLGQy3 (ORCPT ); Thu, 7 Dec 2017 11:54:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:47888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932492AbdLGPxq (ORCPT ); Thu, 7 Dec 2017 10:53:46 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCBF6218DC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Date: Thu, 7 Dec 2017 12:53:43 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: bhargavb , linux-kernel@vger.kernel.org, Paul Clarke , Ravi Bangoria , linux-rt-users@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH v2 1/5] perf-probe: Add warning message if there is unexpected event name Message-ID: <20171207155343.GC3173@kernel.org> References: <151263115609.13843.6362262297053841418.stgit@devbox> <151263118520.13843.9962959734014217698.stgit@devbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151263118520.13843.9962959734014217698.stgit@devbox> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Dec 07, 2017 at 04:19:45PM +0900, Masami Hiramatsu escreveu: > This improve the error message so that user can know > event-name error before writing new events to > kprobe-events interface. > > E.g. > ====== > #./perf probe -x /lib64/libc-2.25.so malloc_get_state* > Internal error: "malloc_get_state@GLIBC_2" is wrong event name. I'm changing this to: Internal error: "malloc_get_state@GLIBC_2" is an invalid event name for the /sys/kernel/debug/tracing/kprobe_events interface. Ok? - Arnaldo > Error: Failed to add events. > ====== > > Signed-off-by: Masami Hiramatsu > --- > tools/perf/util/probe-event.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > index b7aaf9b2294d..c0067950e56f 100644 > --- a/tools/perf/util/probe-event.c > +++ b/tools/perf/util/probe-event.c > @@ -2625,6 +2625,14 @@ static int get_new_event_name(char *buf, size_t len, const char *base, > > out: > free(nbase); > + > + /* Final validation */ > + if (ret >= 0 && !is_c_func_name(buf)) { > + pr_warning("Internal error: \"%s\" is wrong event name.\n", > + buf); > + ret = -EINVAL; > + } > + > return ret; > } >