Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70880imm; Wed, 5 Sep 2018 15:10:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbGmnHsH0rYk8eJRo/QZ4dHR4VJE244BeEJ2kYQUI8fKAEiw1aCF+5k4TRn7axd8mrypG2p X-Received: by 2002:a62:8208:: with SMTP id w8-v6mr42201317pfd.215.1536185442091; Wed, 05 Sep 2018 15:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185442; cv=none; d=google.com; s=arc-20160816; b=b47nRf4TgJJvKcapuULRDiS3MvXGxXzJMBYgBprx2T9YHek9KqaG8jVa3rbdZN+ED+ wap6MUjv8D9/DeZx6fdnzYiZfAR/VjBg51H1lCIww4OpzUAPsNjL0iGWUeISqGIMqBhf J+ySrs1Jp9b9F27E1li/T9X28DhNTXuN+gYwT4VXW0MgCw0F38NJxS/GF4CI5tIAx86V u2zIrbzCJO+gFuy2YrX7H/RjGo+0yjVzCYu/FUPSX9NuDIKfoEYFjXXsrEDAx3YSL/Jt l0eJkZPtxYox91ZQC1OblRmJBV2zj8nuDUXj1q2ZqcISIR9A/p68okgHMXQYFiXqq/kA f+qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=rdG+EhMYS6EPBgndI7+DVyy3xJFjP2X9aB+4BOeyXyw=; b=0q7Gvod0CtCAOcjF51FwPnCKtPKoZURaxoamDK1wSptvVdTU9dwcOKgXDaaV1yAWIZ VF7YT/0JrIr/04gA3W/2p0II3J5fb3nTvTA0rNCXGfTIaXbZQmDSar+q8jbFxZ15+pxz GYHgFaTudFGpaWki+DUmKyvZPKMxzsRZ9rSUqn8vCStyu23zthCILBgxrKh9M1YKKZNN cHNNoEdAWIIY5xyM+7i6Spi8fmm2avODfFRwDUSvcsKmartiLva71ozRPFzY8/yi+noU UpzaXfVjR8jRcFsaeW0EDoYsPAXvR1aZ/BU9KvfCIYqssy1Z7Ewgls9NaNifBk0WqGZU VdbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=orPnofRl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si3302811pgl.635.2018.09.05.15.10.26; Wed, 05 Sep 2018 15:10:42 -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; dkim=pass header.i=@kernel.org header.s=default header.b=orPnofRl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728606AbeIFCk7 (ORCPT + 99 others); Wed, 5 Sep 2018 22:40:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:55606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728010AbeIFCk2 (ORCPT ); Wed, 5 Sep 2018 22:40:28 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 93B7420857; Wed, 5 Sep 2018 22:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185296; bh=z3CXMX21k8mfpJw5BCQrJBGAoSBI/K7e5Ya5G8gJ9SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orPnofRln8+OcIhlEZZqD5/9PMxAyRCNSVe+sORcLyySaQxSaymw7t+D1WJQHSb5g pkGLfLEDdgN47ZGgz9j8CTFysd1mePudWADXcqOEpLsU8rKUe/0/fCJMVkLt6L/Bp+ J7HYM1IhpemjxxlxI44m6pCS1lrHk2h0w3FwH1hg= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: [PATCH 73/77] perf trace: Introduce syscall__augmented_args() method Date: Wed, 5 Sep 2018 19:04:36 -0300 Message-Id: <20180905220440.20256-74-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180905220440.20256-1-acme@kernel.org> References: <20180905220440.20256-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo That will be used by trace__sys_enter when we start combining the augmented syscalls:sys_enter_FOO + syscalls:sys_exit_FOO. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-iiseo3s0qbf9i3rzn8k597bv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index c106189f4066..12356deb6046 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1677,6 +1677,17 @@ static int trace__fprintf_sample(struct trace *trace, struct perf_evsel *evsel, return printed; } +static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sample, int *augmented_args_size) +{ + void *augmented_args = NULL; + + *augmented_args_size = sample->raw_size - sc->args_size; + if (*augmented_args_size > 0) + augmented_args = sample->raw_data + sc->args_size; + + return augmented_args; +} + static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample) @@ -1762,10 +1773,7 @@ static int trace__fprintf_sys_enter(struct trace *trace, struct perf_evsel *evse goto out_put; args = perf_evsel__sc_tp_ptr(evsel, args, sample); - augmented_args_size = sample->raw_size - sc->args_size; - if (augmented_args_size > 0) - augmented_args = sample->raw_data + sc->args_size; - + augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size); syscall__scnprintf_args(sc, msg, sizeof(msg), args, augmented_args, augmented_args_size, trace, thread); fprintf(trace->output, "%s", msg); err = 0; -- 2.14.4