From owner-freebsd-current@FreeBSD.ORG Fri Nov 30 01:39:06 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C6EF16A417; Fri, 30 Nov 2007 01:39:06 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id EF2C013C447; Fri, 30 Nov 2007 01:39:05 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (dialup136.ach.sch.gr [81.186.70.136]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id lAU1cVJQ000476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 30 Nov 2007 03:38:48 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id lAU1cSLp087172; Fri, 30 Nov 2007 03:38:28 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id lAU1cRAE087123; Fri, 30 Nov 2007 03:38:27 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Fri, 30 Nov 2007 03:38:27 +0200 From: Giorgos Keramidas To: Luoqi Chen , freebsd-current@freebsd.org, youshi10@u.washington.edu Message-ID: <20071130013826.GA66484@kobe.laptop> References: <200711292024.lATKOq5R000769@freefall.freebsd.org> <20071129233842.GA57951@ace.netcins.ceid.upatras.gr> <200711292024.lATKOq5R000769@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <20071129233842.GA57951@ace.netcins.ceid.upatras.gr> <200711292024.lATKOq5R000769@freefall.freebsd.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.135, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.26, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: Alexander Kabaev , FreeBSD Release Engineers , Bruce Evans Subject: [PATCH] gprof's broken in 7-CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2007 01:39:06 -0000 --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Fantastic news :-) Please pass this through the release engineering team, Bruce Evans (who has the largest number of commits to the file), and our gcc folks (David O'Brien, and Alexander Kabaev). If it is considered safe for RELENG_7 (what will become 7.0-RELEASE), then it's probably a good idea to commit it. It looks `harmless' to me, but it certainly won't harm to get a proper review from much more experienced people (added to the Cc: list). It would be marvellous to have non-broken profiling in 7.0. - Giorgos On 2007-11-30 01:38, Nikos Ntarmos wrote: > I couldn't wait for Garrett :) so I went on and tested your patch and > gprof seems to work fine for me (at least for the executables I was > interested in profiling anyway). This is i386 on a 7.0-BETA3 kernel and > 7.0-BETA1 world. What are the chances for this to be committed in time > for 7.0R? On 2007-11-29 20:24, Luoqi Chen wrote: > Garrett, would you like to try out my fix? It's actually quite simple, > > Index: profile.h > =================================================================== > RCS file: /home/ncvs/src/sys/i386/include/profile.h,v > retrieving revision 1.42 > diff -u -r1.42 profile.h > --- profile.h 28 Oct 2006 11:03:03 -0000 1.42 > +++ profile.h 29 Nov 2007 20:07:15 -0000 > @@ -115,7 +115,17 @@ > void \ > mcount() \ > { \ > - uintfptr_t selfpc, frompc; \ > + uintfptr_t selfpc, frompc, ecx; \ > + /* \ > + * In gcc 4.2, ecx could be used in the caller as arg pointer \ > + * if stack realignment option is set (-mstackrealign) or \ > + * if the caller has the force_align_arg_pointer atrribute \ > + * (stack realignment is ALWAYS on for main). Preserve ecx \ > + * here. Use volatile to prevent this statement from being \ > + * rescheduled with the next two, just in case the compiler \ > + * decides to use ecx for either selfpc or frompc. \ > + */ \ > + __asm __volatile("movl %%ecx,%0" : "=m" (ecx)); \ > /* \ > * Find the return address for mcount, \ > * and the return address for mcount's caller. \ > @@ -132,6 +142,7 @@ > __asm("movl (%%ebp),%0" : "=r" (frompc)); \ > frompc = ((uintfptr_t *)frompc)[1]; \ > _mcount(frompc, selfpc); \ > + __asm __volatile("movl %0,%%ecx" : : "m" (ecx)); \ > } > #else /* !__GNUCLIKE_ASM */ > #define MCOUNT > > This file is in the kernel tree, but the change only affects libc > build. If you don't want to redo a world build, you may copy the > patched profile.h to /usr/include/machine and "make all install" > inside /usr/src/lib/libc. Then re-link -pg compiled code and try > it out. --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHT2mS1g+UGjGGA7YRAlyEAJ0ZIW+qieke/lI/fxyw7isNwS/uMgCguDyc GFGSP3aCSrmIHejEFNWAcTc= =S4uZ -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--