From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965733AbdKQI73 (ORCPT ); Fri, 17 Nov 2017 03:59:29 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45157 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933796AbdKQI7U (ORCPT ); Fri, 17 Nov 2017 03:59:20 -0500 X-Google-Smtp-Source: AGs4zMYnFjAAQ2nJWiVueDISS9cep06u9p+zcpf68T8z9SE+kglL3Dw+NO+HmGpZ6NSkZWtrXVjJcA== From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org, linux-kernel@vger.kernel.org Cc: y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH] trace-cmd: Fix err msg for record w/o the -e option Date: Fri, 17 Nov 2017 10:58:18 +0200 Message-Id: <20171117085818.23939-1-vladislav.valtchev@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, running just `trace-cmd record` without telling which events have to be traced (-e) nor which tracer to use (-p), trace-cmd dies with the message: No instances reference?? Which might not be helpful to new users of the tool. This small patch removes an early check in trace_record() allowing, in the same case, the execution to continue a few more statements and fail more gracefully in the function check_doing_something() with the following message: no event or plugin was specified... aborting Signed-off-by: Vladislav Valtchev (VMware) --- trace-record.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/trace-record.c b/trace-record.c index 06fc0e6..e2fb731 100644 --- a/trace-record.c +++ b/trace-record.c @@ -4722,11 +4722,9 @@ void trace_record (int argc, char **argv) * If top_instance doesn't have any plugins or events, then * remove it from being processed. */ - if (!extract && !__check_doing_something(&top_instance)) { - if (!buffer_instances) - die("No instances reference??"); + if (!extract && !__check_doing_something(&top_instance)) first_instance = buffer_instances; - } else + else topt = 1; update_first_instance(instance, topt); -- 2.14.1