From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 13 15:23:36 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDDC3106567A; Sun, 13 Jul 2008 15:23:36 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 4F2118FC26; Sun, 13 Jul 2008 15:23:35 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.2/8.14.2) with ESMTP id m6DFNXwn068555; Sun, 13 Jul 2008 19:23:33 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Sun, 13 Jul 2008 19:23:33 +0400 (MSD) From: Dmitry Morozovsky To: Bruce Cran In-Reply-To: <20080713153235.73eb34fd@tau> Message-ID: <20080713191804.F58331@woozle.rinet.ru> References: <20080704121833.J35668@woozle.rinet.ru> <20080713105548.GA55221@server.vk2pj.dyndns.org> <20080713175927.R58331@woozle.rinet.ru> <20080713153235.73eb34fd@tau> X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (woozle.rinet.ru [0.0.0.0]); Sun, 13 Jul 2008 19:23:33 +0400 (MSD) Cc: kan@freebsd.org, freebsd-hackers@freebsd.org, oleg@rinet.ru Subject: Re: profiling broken on RELENG_7/i386 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jul 2008 15:23:36 -0000 On Sun, 13 Jul 2008, Bruce Cran wrote: BC> > PJ> On 2008-Jul-04 13:01:11 +0400, Dmitry Morozovsky BC> > PJ> wrote: BC> > PJ> >It seems we step on a bug in gcc in RELENG_7/i386 BC> > PJ> > BC> > PJ> >It is triggered at least by profiling program which uses BC> > PJ> >getopt(3): BC> > PJ> BC> > PJ> I think it's actually in the profiling initialisation code. If BC> > PJ> you try to run sample code under gdb, you can see that .mcount() BC> > PJ> is not preserving %ecx, though main() assumes it does. BC> > BC> > I see. However, I'm afraid we need knowledge of some gcc guru to BC> > bring the fix in. BC> > BC> BC> This is a known bug in 7.x and has apparently been fixed in -CURRENT. BC> See http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/119709 for more BC> details. It seems it is not, at least on cluster reference -CURRENT i386 machine: Thu Jul 3 21:52:15 UTC 2008 marck@ref8-i386:~/tmp/gprof> ./test Segmentation fault (core dumped) Profiling program does not always dump core, but .mcount definitely clobbers one of the registers: marck@ref8-i386:~/tmp/gprof> cat test-x.c #include int main(int argc, char *argv[]) { printf("Hello, world!\n"); printf("argc=%d, argv=%p\n", argc, argv); return (0); } w/o -pg: marck@ref8-i386:~/tmp/gprof> ./test Hello, world! argc=1, argv=0xbf7febf8 with -pg: marck@ref8-i386:~/tmp/gprof> ./test Hello, world! argc=0, argv=0x0 Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------