From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752781AbbKQCnj (ORCPT ); Mon, 16 Nov 2015 21:43:39 -0500 Received: from smtprelay0027.hostedemail.com ([216.40.44.27]:46975 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751784AbbKQCni (ORCPT ); Mon, 16 Nov 2015 21:43:38 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3871:3872:4362:5007:6261:7875:7903:8603:9040:10004:10400:10848:10967:11232:11658:11914:12043:12296:12517:12519:12555:12740:13069:13255:13311:13357:14093:14096:14097:14659:21080:21088:30012:30041:30054:30056:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: town08_1fa2a3f661b47 X-Filterd-Recvd-Size: 2617 Date: Mon, 16 Nov 2015 21:43:35 -0500 From: Steven Rostedt To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , LKML , Ingo Molnar Subject: Re: [PATCH v2] tools lib traceevents: Fix output of %llu for 64 bit values read on 32 bit machines Message-ID: <20151116214335.4f4b565d@grimm.local.home> In-Reply-To: <20151117002027.GC1865@sejong> References: <20151116153310.326c1558@gandalf.local.home> <20151116172302.0a9326b5@gandalf.local.home> <20151116172516.4b79b109@gandalf.local.home> <20151117002027.GC1865@sejong> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Nov 2015 09:20:27 +0900 Namhyung Kim wrote: > On Mon, Nov 16, 2015 at 05:25:16PM -0500, Steven Rostedt wrote: > > > > When a long value is read on 32 bit machines for 64 bit output, the parsing > > needs to change "%lu" into "%llu", as the value is read natively. > > > > Unfortunately, if "%llu" is already there, the code will add another "l" to > > it and fail to parse it properly. > > > > Cc: stable@vger.kernel.org > > Signed-off-by: Steven Rostedt > > Acked-by: Namhyung Kim > > > What about the opposite case? Maybe we need something like this? Hmm, good question. I'll need to play with this. Thanks! -- Steve > > Thanks, > Namhyung > > > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c > index 4d885934b919..afc32fb17d1e 100644 > --- a/tools/lib/traceevent/event-parse.c > +++ b/tools/lib/traceevent/event-parse.c > @@ -4906,6 +4906,17 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event > memmove(p+1, p, strlen(p)+1); > else if (strcmp(format, "%p") == 0) > strcpy(format, "0x%llx"); > + } else if (pevent->long_size == 4 && ls == 1 && > + sizeof(long) != 4) { > + char *p; > + > + ls = 0; > + /* make %l into % */ > + p = strchr(format, 'l'); > + if (p) > + memmove(p, p+1, strlen(p)); > + else if (strcmp(format, "%p") == 0) > + strcpy(foramt, "0x%x"); > } > switch (ls) { > case -2: