Received: by 10.213.65.68 with SMTP id h4csp333790imn; Sat, 17 Mar 2018 05:42:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELuH9tQRxTYSHRQ1/YOaclRdQD7e/ovh7ckQFj2+uDO1qkE/AtYcqkrlo6M5v1wb8rAGx5dr X-Received: by 10.99.109.136 with SMTP id i130mr4349474pgc.380.1521290563867; Sat, 17 Mar 2018 05:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521290563; cv=none; d=google.com; s=arc-20160816; b=w1P/6Ewxi1Rtc4/7PuwDUSTaZ+5Dqf2ZpbvUEf+2iYCjq9O1U2q/Ic5ePcjjuUfTB1 D7sL1Oc5ZC8JdHsclsRA+Zvf3GlwS3A4l4tv1Dm3NNqPFL8CKpFSknALT6eGAtX5dojr kHGK7lzb3PsH4pLP8YKbBHjDTrr09Sv5a8//icZGHI+c2LouWUb8r9TS8iMgASmTp7EP 88eevqAXv3qIApK/lfqltc8aiqbkUWGXLBrBSOx6GuqY4rlovtmtIqporAz0lLcvqnbf K1+qf2Xi4je29JoTYGIJ4KqRxtA6m8F6tnNsNfGbqq9wZU+yXMFCte4UzWSDkz5x0mkU p1/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dmarc-filter:arc-authentication-results; bh=H/t+Yg7KPQ5+rvlZu0Lrrpp7Gqv8m+a1e85t/aWcvsY=; b=drwJsxiheTvu232mW2VWHuCHZGpKhIgJ1lTW5tUDta7+JinDpn8Pd6/7ycFLAU29h5 ybkcPqJXj80qYM8S7ujuSM14E1gm9OK0/BdzH/RC8DX2fDWgFl0QnLqoq98qqhkg1bTP lvJ4fXB47PcER4XGxdiFxR+py0az+ty4iG6q2vBMiZ8eQgfgJo4f5bkSE6nxeiEGu01t tAbGwe1iQqfszV8tCVm8HwNt33wrr0LJ9P9ix6htuhZtK+JSjarlAoEhB0Vkmuf3/55D 0r4eBA3XdAhvXYp/Z4G2Fj+nPtF80lLuhA2DY46Fs1pJ3Ma5mVcYzUoOKE8EBLW3CyoX XKaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15si7293029pfb.346.2018.03.17.05.42.29; Sat, 17 Mar 2018 05:42:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752913AbeCQMlN (ORCPT + 99 others); Sat, 17 Mar 2018 08:41:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:50468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752191AbeCQMlL (ORCPT ); Sat, 17 Mar 2018 08:41:11 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0A63921737; Sat, 17 Mar 2018 12:41:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A63921737 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Steven Rostedt , linux-kernel@vger.kernel.org Cc: mhiramat@kernel.org, Ingo Molnar , Namhyung Kim , Tom Zanussi , Arnaldo Carvalho de Melo , linux-trace-users@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, Ravi Bangoria Subject: [PATCH v6 04/21] selftests: ftrace: Add a testcase for probepoint Date: Sat, 17 Mar 2018 21:40:31 +0900 Message-Id: <152129043097.31874.14273580606301767394.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <152129024033.31874.15800253385376959274.stgit@devbox> References: <152129024033.31874.15800253385376959274.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a testcase for probe point definition. This tests symbol, address and symbol+offset syntax. The offset must be positive and smaller than UINT_MAX. Signed-off-by: Masami Hiramatsu --- .../selftests/ftrace/test.d/kprobe/probepoint.tc | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc b/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc new file mode 100644 index 000000000000..4fda01a08da4 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc @@ -0,0 +1,43 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe events - probe points + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +TARGET_FUNC=create_trace_kprobe + +dec_addr() { # hexaddr + printf "%d" "0x"`echo $1 | tail -c 8` +} + +set_offs() { # prev target next + A1=`dec_addr $1` + A2=`dec_addr $2` + A3=`dec_addr $3` + TARGET="0x$2" # an address + PREV=`expr $A1 - $A2` # offset to previous symbol + NEXT=+`expr $A3 - $A2` # offset to next symbol + OVERFLOW=+`printf "0x%x" ${PREV}` # overflow offset to previous symbol +} + +# We have to decode symbol addresses to get correct offsets. +# If the offset is not an instruction boundary, it cause -EILSEQ. +set_offs `grep -A1 -B1 ${TARGET_FUNC} /proc/kallsyms | cut -f 1 -d " " | xargs` + +UINT_TEST=no +# printf "%x" -1 returns (unsigned long)-1. +if [ `printf "%x" -1 | wc -c` != 9 ]; then + UINT_TEST=yes +fi + +echo 0 > events/enable +echo > kprobe_events +echo "p:testprobe ${TARGET_FUNC}" > kprobe_events +echo "p:testprobe ${TARGET}" > kprobe_events +echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events +! echo "p:testprobe ${TARGET_FUNC}${PREV}" > kprobe_events +if [ "${UINT_TEST}" = yes ]; then +! echo "p:testprobe ${TARGET_FUNC}${OVERFLOW}" > kprobe_events +fi +echo > kprobe_events +clear_trace