Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1724445pxb; Thu, 7 Oct 2021 13:48:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFeHilF8ZzN8OhzwMXssnBHk7Ee5+FaYtkUKMRNAPGjAHhngaeVaLxfbtYedUpFlCnYPxg X-Received: by 2002:a50:d94c:: with SMTP id u12mr9137591edj.371.1633639738381; Thu, 07 Oct 2021 13:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633639738; cv=none; d=google.com; s=arc-20160816; b=gF6y2fdqrPi+ik5JMrkJ+SFZSApXWY36mAyUAUnjs9x8XRdBMz+aES2g2P2+neMy4J xPpO10Hto+/JJOJqEbtzpFHIumw3rIG1jmH2r5p5B7mhKbPpSph1jvJXRo9AzQ3ylHa6 twOx9rdaL8vu02J+pk6V9TSQBt4mNiYeMQzI20rd/PS2E2KUwZgLkZBYX6SH+hCPENZ/ IdeC3FV2liz8gVaVlUs/tfvvN/FPKpFJvZ7lEHzWPs3qYgSFX3s5W1xAQZyYjDxKdExF XJy78Fv1h/vujODrbpaT8jaVxpZDK1x0kahhST+YHND/rhHPgHVyarfk3kzEPSm/8lly /uQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=A5ojQafQUWecZV0zK32YyWS1qatBb2iruuAkEA0ocTI=; b=uCEKzStPixPwezAmfFZ1nyk0INCliIno5nFTbBOo+7w3+sgj42VAnDxaIaYZyTaUCg uAwb5LhBvZ4XZqCfHZdiCLvYIBcd0b8Au3TnBKQzA4oaY0MueWVbTeQqHwREl1zMCmS1 WdXR3Hwy+HRfRUYBdrZr4hcly+SL3KJUqtgKiHefN9CHJUBTnIq4+r+3ZE0sbJ/SDp1J eQm/Ry+FI4eJySgT0sO0OD2PJW1s383glwo8Qc0t9CQK+RjbP87Y6uXNCqDIRjHDGjlh VzKTuj7XOavdfelNDzIlRA6W+BeICdiXHL/QSadH0qUv5r7350cYG09XFArp334qaMRc KacA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="q+/hm3pd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si415388edt.193.2021.10.07.13.48.34; Thu, 07 Oct 2021 13:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="q+/hm3pd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243083AbhJGRBD (ORCPT + 99 others); Thu, 7 Oct 2021 13:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243036AbhJGRAd (ORCPT ); Thu, 7 Oct 2021 13:00:33 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD0B4C061777 for ; Thu, 7 Oct 2021 09:58:18 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 81-20020a251254000000b005b6220d81efso8645504ybs.12 for ; Thu, 07 Oct 2021 09:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=A5ojQafQUWecZV0zK32YyWS1qatBb2iruuAkEA0ocTI=; b=q+/hm3pda9jEyneBmerZYc7HQ14ZVMTGDuuUdAIAB7X1oCq4dGJSDzzmdKoYTDOWRM i26WMxyQLvs6Zha3iDR6u1uTv90ljKuyHJCFPa9jJDZT7hcwZEaT4t8iQgDQTnXR8DZ3 wkABLzT3FW0y1n3U+SRZsO+Mq1zjNVJd9wRunNyaBtlj8BGGqQaLrhxIJi2Z23zriabP fm/Jnl8OkT5t35JKMzYecsugrH+1bqeV3fhhJdIWsUxd3Ek4L37to4oJX/NcC9TmrI8S JJ83u1q2vUkEXrHW0Ob+KfEQXN6w9fmn8B+nI2ywdQPMJecZUn6qieIn4Vy/pz9abdBi QRmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=A5ojQafQUWecZV0zK32YyWS1qatBb2iruuAkEA0ocTI=; b=ENfjXqgMAwQbthM2mq5iJYCL0zZn2T8PhdB1lKOhRLInl4h9StBsHhc+maCAUU2fpR wJoO1dTydaV+Fdr1W+wHYa6UK+WQIwETHTGtHIpBHvMx9vtyFvVbMrbD95O/YDAGrlp4 TJRYKrpD+hpNqAhr4ZMnDTpV1oZGxgVRedzUe2jT/BvM+4w/mgVgHAviLkY7z799LPvk mfvDJYIFABQBi/ANqf1PYKyqqGtYLK5YdqYHYdLVg8D8j0fGWIwCHlcnz1bDQcPg1f94 paxnwpeHbJK4ULs6eLmvCfioDhlZCrNhdH6yzqc7gNWLJn7SqDhlRqKhMhfxXVftM5Pd UTMQ== X-Gm-Message-State: AOAM530N+y/ZBkNg2qAQ4mIwNA8yXL/G4jVUNwwmudd0qsGLrBLiOios GxJ1VUR6+NGFBBL2UzTgfI6uqPnzShJB X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:fe85:5e36:cb6f:76bc]) (user=irogers job=sendgmr) by 2002:a25:bd7:: with SMTP id 206mr6347937ybl.408.1633625897889; Thu, 07 Oct 2021 09:58:17 -0700 (PDT) Date: Thu, 7 Oct 2021 09:56:46 -0700 In-Reply-To: <20211007165647.3514803-1-irogers@google.com> Message-Id: <20211007165647.3514803-21-irogers@google.com> Mime-Version: 1.0 References: <20211007165647.3514803-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.882.g93a45727a2-goog Subject: [PATCH 20/21] perf parse-events: Identify broken modifiers. From: Ian Rogers To: Andi Kleen , Jiri Olsa , Jin Yao , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Kees Cook , Sami Tolvanen , Nick Desaulniers , Andrew Morton , Jacob Keller , Zhen Lei , ToastC , Joakim Zhang , Felix Fietkau , Jiapeng Chong , Song Liu , Fabian Hemmer , Alexander Antonov , Nicholas Fraser , Adrian Hunter , Denys Zagorui , Wan Jiabing , Thomas Richter , Sumanth Korikkar , Heiko Carstens , Changbin Du , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Stephane Eranian , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously the broken modifier causes a usage message to printed but nothing else. After: $ perf stat -e 'cycles:kk' -a sleep 2 event syntax error: 'cycles:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list available events $ perf stat -e '{instructions,cycles}:kk' -a sleep 2 event syntax error: '..ns,cycles}:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list available events Signed-off-by: Ian Rogers --- tools/perf/util/parse-events.y | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 17c8c66f3f51..2d60f3cbe42b 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -183,6 +183,11 @@ group_def ':' PE_MODIFIER_EVENT err = parse_events__modifier_group(list, $3); free($3); if (err) { + struct parse_events_state *parse_state = _parse_state; + struct parse_events_error *error = parse_state->error; + + parse_events__handle_error(error, @3.first_column, + strdup("Bad modifier"), NULL); free_list_evsel(list); YYABORT; } @@ -240,6 +245,11 @@ event_name PE_MODIFIER_EVENT err = parse_events__modifier_event(list, $2, false); free($2); if (err) { + struct parse_events_state *parse_state = _parse_state; + struct parse_events_error *error = parse_state->error; + + parse_events__handle_error(error, @2.first_column, + strdup("Bad modifier"), NULL); free_list_evsel(list); YYABORT; } -- 2.33.0.882.g93a45727a2-goog