Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6804289ybl; Mon, 23 Dec 2019 12:14:38 -0800 (PST) X-Google-Smtp-Source: APXvYqyy3F/MxHK96r7Rglyd93ZPdhmVjIdxLiFqnUpMjdjb3qh1+DI021YYKMuUZCjC3MEhFrrf X-Received: by 2002:a9d:10b:: with SMTP id 11mr27761504otu.222.1577132078605; Mon, 23 Dec 2019 12:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577132078; cv=none; d=google.com; s=arc-20160816; b=BxKgWpOUmj5yCgZlW6TC9u4vLqMaI4H3o0P79M2wq7g65f3ZF6bEF9x0m07Mjpj8Hd dL+fsMg2AssDuKxgx5emoP3+IrogEIRiZhAVdJNXhC7z1d9bZCMYCWRWeTncZZfMzl9C esn8zG5VymYNNeaIbQ8BSQ+npab0oLizwBO6mhuXSJSDxotWg/8Gsj95ZBaUIispEF9e ++DkudsXAwcr6yiwacYucC2JGDS10a6c4ScMvH9A3sFoIFTFj3DfBMeloqtA0Z2KyDiT ug2cjSYJO6/3e8hXkqYwlvGtIWspPlqqsSgwq/vifs+qOUMMKGLrBtzli1h+Pl+hZ/sg 0YeA== 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=+rLkUgGHGF944fuu6KzSpDWFtBQ6uQ2OZ5heupaey6U=; b=eoCpilMyOhMW7uMpsrRp4wmo0OJivefsUpCI38awKE7H+8fwH6OV43fhb+pQG0e68r 9nWycbEQ8kabpCvkogn+055HMCnrjQkfxNN5Clnzc6qgLw8++T6vISOy2GENMjeaMHHs IftXbb4hqkMygK5C4aBoExWkTO1WECHHhjYTgfypXCU4yfUExexEZkkzzYhd7o7Dxzl5 JyQEca7h8fYAX2DnPCGcpwZtN5AvdlfV3Tsu7DL/CPFurl3KL/68lhpIHklhRGHosIUr d2Phu0mRflsNG7CZuYyykYB1/hNlkkKmvou8zaOpIr52h58e3JVfndNYuiL9+YTRtuX1 s/2g== 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 z12si8431569otm.189.2019.12.23.12.14.25; Mon, 23 Dec 2019 12:14:38 -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 S1727014AbfLWUNF (ORCPT + 99 others); Mon, 23 Dec 2019 15:13:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:49122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbfLWUND (ORCPT ); Mon, 23 Dec 2019 15:13:03 -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 BD5C2206D3; Mon, 23 Dec 2019 20:13:02 +0000 (UTC) Date: Mon, 23 Dec 2019 15:13:01 -0500 From: Steven Rostedt To: Joel Fernandes Cc: Antonio Borneo , Ingo Molnar , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: Re: [PATCH] tracing: Fix printing ptrs in preempt/irq enable/disable events Message-ID: <20191223151301.20be63f7@gandalf.local.home> In-Reply-To: <20191221234741.GA116648@google.com> References: <20191127154428.191095-1-antonio.borneo@st.com> <20191204092115.30ef75c9@gandalf.local.home> <20191221234741.GA116648@google.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 Sat, 21 Dec 2019 18:47:41 -0500 Joel Fernandes wrote: > On Wed, Dec 04, 2019 at 09:21:15AM -0500, Steven Rostedt wrote: > > > > Joel, > > > > Any comments on this patch? > > Steve, it looks like this issue happens with trace-cmd not knowing what > _stext is. If I do cat trace_pipe , then I don't see the issue as _stext is > looked up correctly but the reporter of the bug is using trace-cmd. Is there > a way to solve this within trace-cmd? Not knowing much about trace-cmd > internals, I will have to defer to you on this though.. > > Other than this, I need to make the offset to _stext as s32 instead of u32 > type so that the problem of the symbol location being before _stext does not > cause overflow. > > Lastly, I am not super convinced that we need to store the full pointer just > to handle a case where the offset of the symbol might be more than +-2G from > _stext. Once we see such issue, then we can handle it. But right now the size > of the trace buffer is utilized better by just storing the offset IMHO. > Does this fix it for you? -- Steve diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c index 4fd3907e..dc705dd2 100644 --- a/lib/traceevent/event-parse.c +++ b/lib/traceevent/event-parse.c @@ -3595,6 +3595,45 @@ tep_find_event_by_name(struct tep_handle *tep, return event; } +static unsigned long long test_for_symbol(struct tep_handle *tep, + struct tep_print_arg *arg) +{ + unsigned long long val = 0; + struct func_list *item = tep->funclist; + char *func; + int i; + + if (isdigit(arg->atom.atom[0])) + return 0; + + for (i = 0; i < (int)tep->func_count; i++) { + unsigned long long addr; + const char *name; + + if (tep->func_map) { + addr = tep->func_map[i].addr; + name = tep->func_map[i].func; + } else if (item) { + addr = item->addr; + name = item->func; + item = item->next; + } else + break; + + if (strcmp(arg->atom.atom, name) == 0) { + val = addr; + break; + } + } + + func = realloc(arg->atom.atom, 32); + if (func) { + snprintf(func, 32, "%lld", val); + arg->atom.atom = func; + } + return val; +} + static unsigned long long eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg *arg) { @@ -3611,7 +3650,10 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg /* ?? */ return 0; case TEP_PRINT_ATOM: - return strtoull(arg->atom.atom, NULL, 0); + val = strtoull(arg->atom.atom, NULL, 0); + if (!val) + val = test_for_symbol(tep, arg); + return val; case TEP_PRINT_FIELD: if (!arg->field.field) { arg->field.field = tep_find_any_field(event, arg->field.name);