Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jul 2008 19:23:33 +0400 (MSD)
From:      Dmitry Morozovsky <marck@rinet.ru>
To:        Bruce Cran <bruce@cran.org.uk>
Cc:        kan@freebsd.org, freebsd-hackers@freebsd.org, oleg@rinet.ru
Subject:   Re: profiling broken on RELENG_7/i386
Message-ID:  <20080713191804.F58331@woozle.rinet.ru>
In-Reply-To: <20080713153235.73eb34fd@tau>
References:  <20080704121833.J35668@woozle.rinet.ru> <20080713105548.GA55221@server.vk2pj.dyndns.org> <20080713175927.R58331@woozle.rinet.ru> <20080713153235.73eb34fd@tau>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 13 Jul 2008, Bruce Cran wrote:

BC> > PJ> On 2008-Jul-04 13:01:11 +0400, Dmitry Morozovsky <marck@rinet.ru>
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 <stdio.h>

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 ***
------------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080713191804.F58331>