This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: What is a good profiling tool ? - problem with gprof



-----Original Message-----
Subject: Re: What is a good profiling tool ? - problem with gprof

On Jun 18 12:11, Corinna Vinschen wrote:
> On Jun 17 12:52, Larry Hall (Cygwin) wrote:
> > On 6/17/2013 12:19 PM, J.B.W.Webber wrote:
> > >Hi, I am trying to find in which function call the most time is being spent.
> > >
> > >I am using gcc and trying to compile and link with -g and -pg.
> > >i.e. for a trivial test :
> > >
> > >$ cat helloworld.c
> > >/* Hello World program */
> > >#include<stdio.h>
> > >main()
> > >{
> > >     printf("Hello World\n");
> > >}
> > >
> > >$ gcc -g -pg -c helloworld.c
> > >$ gcc -pg helloworld.o
> > >helloworld.o: In function `main':
> > >helloworld.c:6: undefined reference to `_mcount'
> > >collect2: ld returned 1 exit status
> > >
> > >Any ideas ? Am I missing a .h call ? Or do I need to link to something ?
> > 
> > Worked for me.  Perhaps your Strawberry gcc installation is interfering.
> 
> I don't know how you succeeed to build that, Larry.  I could easily 
> reproduce the problem.  It was a build problem in Cygwin.  I fixed 
> that now and at the same time made the 64 bit profiling workable, 
> curtesy the
> Mingw-w64 project, which already did the required work.  The original 
> profiling code was created within the Cygwin project ages ago, so I 
> could included the latest Mingw-w64 profiling code (almost) verbatim 
> into Cygwin and now it seems to work fine again for 32 and 64 bit.
> 
> I'm just about to create a 2013-06-18 32 bit snapshot on 
> http://cygwin.com/snapshots/ and a 64 bit test release 1.7.12-5, which 
> both should be ready in an hour.

Uploaded.  Please note that it's *not* enough to install the snapshot Cygwin DLL.  The important items here are gcrt0.o and libgmon.a.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

_____________________________________________

Really thanks to all. That now works.

Sorry for the slow reply, I did the install with the snapshot as suggested 
- no difference, at first, but I had been given the clues I needed.

I used find to track all libgmon.a  on my laptop :

C:/Altera/12.0sp2/quartus/bin/cygwin/lib/libgmon.a
C:/Altera/12.0sp2/quartus/bin/cygwin/lib/mingw/libgmon.a
C:/Altera/12.0sp2/quartus/bin/cygwin/usr/i686-pc-mingw32/lib/libgmon.a
C:/Applications/Strawberry/c/x86_64-w64-mingw32/lib/libgmon.a
C:/cygwin/lib/libgmon.a
C:/cygwin/usr/i686-pc-mingw32/sys-root/mingw/lib/libgmon.a
C:/cygwin/usr/lib/libgmon.a

I blocked access to the Altera and Strawberry Cygwins, which made no difference, (no, XMOS does not use Cygwin)
But the answer was the version C:/cygwin/lib/libgmon.a
I copied the new gcrt0.o and libgmon.a into C:/cygwin/lib/
and all now works fine. I have the answer I needed.

I do thank you all,
Cheers,
	Beau 
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]