Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hpfcso!sjo From: sjo@hpfcso.HP.COM (Scott Omdahl) Newsgroups: comp.sys.hp Subject: Re: Problems with prof(1) and gprof(1) Message-ID: <7370018@hpfcso.HP.COM> Date: 17 Oct 89 14:48:40 GMT References: <364@node17.mecazh.UUCP> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 26 >I have tried profiling a number of C and Pascal programs with prof(1) >and gprof(1) under HP-UX6.5 on a 9000/340. > ... >For prof, I compile as:- > cc -p -o foo foo.c > >For gprof:- > cc -G -o foo foo.c > >Then both > prof foo >and > gprof foo >crash with a Floating exception. > >What am I (or someone else) doing wrong? You're simply re-doing some work the compiler does for you. The monitor() calls in your main program are duplicates of the ones in gcrt0.o (gprof) and mcrt0.o (prof). The C compiler links in gcrt0.o or mcrt0.o instead of crt0.o when you specify -G or -p. The duplicate calls in your main program cause a corrupted gmon.out (gprof) or mon.out (prof) data file, which [g]prof chokes on. Simply remove the monitor calls and data declarations from your program and it works fine. Scott Omdahl