From nobody Sat Dec 10 20:24:40 2022 X-Original-To: freebsd-dtrace@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NTzrs2G4Sz4kNCw for ; Sat, 10 Dec 2022 20:24:45 +0000 (UTC) (envelope-from longwitz@incore.de) Received: from dss.incore.de (dss.incore.de [195.145.1.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4NTzrq74gfz3tsk for ; Sat, 10 Dec 2022 20:24:43 +0000 (UTC) (envelope-from longwitz@incore.de) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=incore.de header.s=dkim header.b=UEitBJU0; spf=pass (mx1.freebsd.org: domain of longwitz@incore.de designates 195.145.1.138 as permitted sender) smtp.mailfrom=longwitz@incore.de; dmarc=none Received: from inetmail.dmz (inetmail.dmz [10.3.0.3]) by dss.incore.de (Postfix) with ESMTP id 213C76BC741 for ; Sat, 10 Dec 2022 21:24:42 +0100 (CET) X-Virus-Scanned: amavisd-new at incore.de Received: from dss.incore.de ([10.3.0.3]) by inetmail.dmz (inetmail.dmz [10.3.0.3]) (amavisd-new, port 10024) with LMTP id FDhWeaBIJ4Lb for ; Sat, 10 Dec 2022 21:24:41 +0100 (CET) Received: from mail.local.incore (fwintern.dmz [10.0.0.253]) by dss.incore.de (Postfix) with ESMTP id 60EA66BC73D for ; Sat, 10 Dec 2022 21:24:41 +0100 (CET) Received: from mail.incore (localhost [127.0.0.1]) by mail.local.incore (Postfix) with ESMTP id 5A6549CD27 for ; Sat, 10 Dec 2022 21:24:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=incore.de; h= content-transfer-encoding:content-type:content-type:subject :subject:mime-version:user-agent:from:from:date:date:message-id :received:received; s=dkim; t=1670703881; bh=wWf5d4N/xZ/N4v5Tmut HmZPrnTVfDNUcNxzdVX/MFb4=; b=UEitBJU0ZkOtMDf2Df9bnTYRPvc0R1746LW K6MbyC+eedrTz5NTISkxuhX1ie1uTZcdHlpOaLgdcxSxxDB6iCZteOQpJ9kgNuLN dVZTh1MHOBTeVB3BvCCdWJ0EMYkLxq6FA+OoRGIrxkAB1VLSgquc8vmwW0r8ozz7 sFokota8= Received: from mail.local.incore ([127.0.0.1]) by mail.incore (mail.incore [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Ofw1d0t_6FXD for ; Sat, 10 Dec 2022 21:24:41 +0100 (CET) Received: from bsdmhs.longwitz (unknown [192.168.99.6]) by mail.local.incore (Postfix) with ESMTP id 334ED9CC1C for ; Sat, 10 Dec 2022 21:24:41 +0100 (CET) Message-ID: <6394EB08.5060604@incore.de> Date: Sat, 10 Dec 2022 21:24:40 +0100 From: Andreas Longwitz User-Agent: Thunderbird 2.0.0.19 (X11/20090113) List-Id: A discussion list for developers working on DTrace in FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-dtrace List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-dtrace@freebsd.org MIME-Version: 1.0 To: "freebsd-dtrace@freebsd.org" Subject: Format problem in printa() for negative values Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; R_SPF_ALLOW(-0.20)[+ip4:195.145.1.138:c]; R_DKIM_ALLOW(-0.20)[incore.de:s=dkim]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-dtrace@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; TO_DN_EQ_ADDR_ALL(0.00)[]; ASN(0.00)[asn:3320, ipnet:195.145.0.0/16, country:DE]; ARC_NA(0.00)[]; RCVD_COUNT_SEVEN(0.00)[7]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[incore.de:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-dtrace@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[incore.de]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4NTzrq74gfz3tsk X-Spamd-Bar: --- X-ThisMailContainsUnwantedMimeParts: N On my laptop running FreeBSD 12.3-STABLE #3 r371380 a saw a problem with the printa() function of DTrace. To explain I use the C program printa: #include #include void fkt1() { printf( "fkt1() called\n" ); } void fkt2() { printf( "fkt2() called\n" ); } int main () { sleep( 10 ); fkt1(); fkt2(); fkt1(); fkt2(); fkt1(); } After start of printa I run the following DTrace script with "dtrace -p $(pgrep printa) -s printa.d" : dtrace:::BEGIN { printf("demo for printa\n"); } pid$target::fkt1:entry /execname == "printa"/ { @fkt1 = count(); @saldo1 = sum(1); @saldo2 = sum(-1); } pid$target::fkt2:entry /execname == "printa"/ { @fkt2 = count(); @saldo1 = sum(-1); @saldo2 = sum(1); } dtrace:::END { printf("demo for printa\n"); printa("fkt1=%@d, fkt2=%@d, saldo1=%@d\n", @fkt1, @fkt2, @saldo1); printa("fkt1=%@d, fkt2=%@d, saldo2=%@d\n", @fkt1, @fkt2, @saldo2); printa("saldo2=%@d, fkt1=%@d, fkt2=%@d\n", @saldo2, @fkt1, @fkt2); } The result is dtrace: script './printa.d' matched 4 probes CPU ID FUNCTION:NAME 3 1 :BEGIN demo for printa fkt1() called fkt2() called fkt1() called fkt2() called fkt1() called dtrace: pid 11387 has exited 2 2 :END demo for printa fkt1=3, fkt2=2, saldo1=1 fkt1=3, fkt2=2, saldo2=18446744073709551615 saldo2=-1, fkt1=3, fkt2=2 The negative value of @saldo2 is wrong, when it is not the first parameter in the printa() function.