Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4624953ybc; Tue, 26 Nov 2019 11:54:10 -0800 (PST) X-Google-Smtp-Source: APXvYqy1o9myv5jwQOrOLsAnWD3bMMuAkmjlH8fgxN4HZbVLQE17M+dLZTciI7Rk4PQQchjeSyJN X-Received: by 2002:a63:fe06:: with SMTP id p6mr185695pgh.245.1574798050367; Tue, 26 Nov 2019 11:54:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574798050; cv=none; d=google.com; s=arc-20160816; b=L7vuOwlA2J2r+NnnY19zjIKV2Ir0kSj7THcRRZu1/G16sgCAfKfwxs5SQO9+6Fednh qBfzy9F+zasbk87N0Ip9r00UnGMa4uANJVMmqFhVfkgi88Us2NNwTbb/l2K/nh05j5NY KmHIm3Lg3mJMQtgkV/6dMKo1xvOYxI3gYsO2ODXCnz/3J5DQkEjYBZr1gGZXvRJbrXcb CQVM7ZBZR9UlT5hK8jPWiP5nr3jI7bzGV0T0fa1PKGhN/XL0c1H+ZCVb+8ey6qj4CGcF DdP3Xh/5XZPoe7d89+BwiGr90o2DdSlyA13bd6N1cc3J7iOI7qg2UpJPTP008nOtYKFi krYg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=k0PwMbvuuTx5dNpKKLvbN0AvBDZ4qqLDJilZe3pXePs=; b=mrtunVzrrN6B6qx4K17XVUqgMhZT7cGCrmeIzSEIwP0/ZFVyije1+oGW6ub0QUZQB6 B+5kfOk7YAEnvtYQiL0Vd0y8FOBUIPVAyUtWnuNXHxkM6J6J5Cmd0m+xMgZoLwgujLzX TQLc0t7CbcAofitvFP7ZHZ76K8swdfpvpvUiy5dSLSmk2XuKXoTtE2Ge1DvyDUB27Bea 1SUGeN7sEXiYg6TM80E3DXqZ4VFLuWR+RlgJeOrFymVL+KFo4fdF8s8Nx0dtFqS78VR/ +SBY5UJLamX6/bFrW44Lq20X/XB8Z64EN2E/Q5lk0Q111t56Jr6loDg+fksJa76nj1+C XcTA== 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 c8si12588903pfn.7.2019.11.26.11.53.54; Tue, 26 Nov 2019 11:54:10 -0800 (PST) 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 S1726947AbfKZTvE (ORCPT + 99 others); Tue, 26 Nov 2019 14:51:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:43220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbfKZTvE (ORCPT ); Tue, 26 Nov 2019 14:51:04 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 7244A207DD; Tue, 26 Nov 2019 19:51:03 +0000 (UTC) Date: Tue, 26 Nov 2019 14:51:01 -0500 From: Steven Rostedt To: Piotr Maziarz Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, andriy.shevchenko@intel.com, cezary.rojewski@intel.com, gustaw.lewandowski@intel.com Subject: Re: [PATCH v2 2/2] tracing: Use seq_buf_hex_dump() to dump buffers Message-ID: <20191126145101.1e6c4e43@gandalf.local.home> In-Reply-To: <61e34d88-bbf7-a2ff-e983-64dc9be1a482@linux.intel.com> References: <1573130738-29390-1-git-send-email-piotrx.maziarz@linux.intel.com> <1573130738-29390-2-git-send-email-piotrx.maziarz@linux.intel.com> <20191113160922.1b1f0fc0@gandalf.local.home> <61e34d88-bbf7-a2ff-e983-64dc9be1a482@linux.intel.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Nov 2019 15:53:26 +0100 Piotr Maziarz wrote: > Hello Steven, > > I'm writing handle in event-parse and I came across some technical > problems. I have an event which print function looks like that: > TP_printk("%s", > __print_hex_dump("", DUMP_PREFIX_OFFSET, 16, 4, > __get_dynamic_array(buf), > __get_dynamic_array_len(buf), false)) > It works properly when printing events to debugfs. > I'm testing my implementation with trace-cmd and it has problem with > parsing DUMP_PREFIX_OFFSET and false (I'm using > alloc_and_process_delim()). Instead of having numerical values > tep_print_args are of type TEP_PRINT_ATOM and have char array > "DUMP_PREFIX_OFFSET" or "true". > Am I doing something incorrect? Parsing it this way is problematic > because instead of false someone may use 0 or logic expression. And > writing it to support all possible scenarios may be tedious and prone to > errors. You can force the enum to be a number by including the following in the trace event header: TRACE_DEFINE_ENUM(DUMP_PREFIX_OFFSET); TRACE_DEFINE_ENUM(DUMP_PREFIX_ADDRESS); TRACE_DEFINE_ENUM(DUMP_PREFIX_NONE); and the format files will convert these to their actual numbers when displaying it to user space. -- Steve