Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-01

profiling on win32

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Giulio Bernardi

Hi everybody.
Did someone manage to enable profiling on win32?
I linked with libc.a, libgmon.a, libgcc.a and libkernel32.a from cygwin but it fails on startup.
If I start the -pg compiled program I see:

monstartup: out of memory

Then program runs without problems, and at the end I see a couple of access violations from gprof libraries code:

2 [main] testprogram 1316 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
242 [main] testprogram 1316 open_stackdumpfile: Dumping stack trace to testprogram.exe.stackdump

I couldn't find anything on fpc website: faqs read "Profiling is supported". I had it working on linux but I'm not able to have it working under win32

bye,
Giulio

Reply by email

Peter Vreman
to Giulio Bernardi
you wrote 18 lines
Hi everybody. Did someone manage to enable profiling on win32? I linked with libc.a, libgmon.a, libgcc.a and libkernel32.a from cygwin but it fails on startup. If I start the -pg compiled program I see: monstartup: out of memory Then program runs without problems, and at the end I see a couple of access violations from gprof libraries code: 2 [main] testprogram 1316 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION 242 [main] testprogram 1316 open_stackdumpfile: Dumping stack trace to testprogram.exe.stackdump I couldn't find anything on fpc website: faqs read "Profiling is supported". I had it working on linux but I'm not able to have it working under win32

Fixed.

Note: gprof is only supported for cygwin

Peter

Reply by email

Marco van de Voort
to Giulio Bernardi: Hi everybody. Did someone manage to enable profiling on win32? I linked with libc.a,…
Show quoted text 17 lines
Did someone manage to enable profiling on win32? I linked with libc.a, libgmon.a, libgcc.a and libkernel32.a from cygwin but it fails on startup. If I start the -pg compiled program I see: monstartup: out of memory Then program runs without problems, and at the end I see a couple of access violations from gprof libraries code: 2 [main] testprogram 1316 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION 242 [main] testprogram 1316 open_stackdumpfile: Dumping stack trace to testprogram.exe.stackdump I couldn't find anything on fpc website: faqs read "Profiling is supported". I had it working on linux but I'm not able to have it working under win32

FPC can link to gcc under Windows, but doesn't use the runtime of gcc under win32 (mingw or cygwin), but directly accesses kernel32 and user32.

Usually this is a blessing, but probably the profiler is very tied to this.

What probably should be done is to properly initialise libc and reroute memory handling to libc's mmalloc. This could impact the profiling result maybe though.

Note that on windows there are at least three "c" frameworks to link to (Microsofts msvcrt, mingw, cygwin), so any solution will always be windows specific.

Reply by email

Giulio Bernardi
Show quoted text 35 lines
> Did someone manage to enable profiling on win32? > I linked with libc.a, libgmon.a, libgcc.a and libkernel32.a from cygwin > but > it fails on startup. > If I start the -pg compiled program I see: > > monstartup: out of memory > > Then program runs without problems, and at the end I see a couple of > access > violations from gprof libraries code: > > 2 [main] testprogram 1316 handle_exceptions: Exception: > STATUS_ACCESS_VIOLATION > 242 [main] testprogram 1316 open_stackdumpfile: Dumping stack trace > to > testprogram.exe.stackdump > > I couldn't find anything on fpc website: faqs read "Profiling is > supported". > I had it working on linux but I'm not able to have it working under win32 FPC can link to gcc under Windows, but doesn't use the runtime of gcc under win32 (mingw or cygwin), but directly accesses kernel32 and user32. Usually this is a blessing, but probably the profiler is very tied to this. What probably should be done is to properly initialise libc and reroute memory handling to libc's mmalloc. This could impact the profiling result maybe though. Note that on windows there are at least three "c" frameworks to link to (Microsofts msvcrt, mingw, cygwin), so any solution will always be windows specific.

Everything is all right now with Peter fix (it was Peter, wasn't he? I can't
remember now).
I sent a mail to the ML saying it worked but I think it didn't arrive :) I only needed to add libgmon.a, libgcc.a, libc.a and libkernel32.a from cygwin to fpc bin directory.
In the mail that didn't arrive I wrote:
Why don't add gprof.exe, libgmon.a, libgcc.a, libc.a and libkernel32.a from cygwin to win32 distribution of fpc?

So, everything works and everyone is happy now (at least I am :P)

bye
Giulio

Reply by email

Peter Vreman
to Giulio Bernardi
Show quoted text 50 lines
>> Did someone manage to enable profiling on win32? >> I linked with libc.a, libgmon.a, libgcc.a and libkernel32.a from cygwin >> but >> it fails on startup. >> If I start the -pg compiled program I see: >> >> monstartup: out of memory >> >> Then program runs without problems, and at the end I see a couple of >> access >> violations from gprof libraries code: >> >> 2 [main] testprogram 1316 handle_exceptions: Exception: >> STATUS_ACCESS_VIOLATION >> 242 [main] testprogram 1316 open_stackdumpfile: Dumping stack trace >> to >> testprogram.exe.stackdump >> >> I couldn't find anything on fpc website: faqs read "Profiling is >> supported". >> I had it working on linux but I'm not able to have it working under >> win32 > > FPC can link to gcc under Windows, but doesn't use the runtime of gcc > under win32 (mingw or cygwin), but directly accesses kernel32 and > user32. > > Usually this is a blessing, but probably the profiler is very tied to > this. > > What probably should be done is to properly initialise libc and reroute > memory handling to libc's mmalloc. This could impact the profiling > result > maybe though. > > Note that on windows there are at least three "c" frameworks to link to > (Microsofts msvcrt, mingw, cygwin), so any solution will always be > windows > specific. Everything is all right now with Peter fix (it was Peter, wasn't he? I can't remember now). I sent a mail to the ML saying it worked but I think it didn't arrive :) I only needed to add libgmon.a, libgcc.a, libc.a and libkernel32.a from cygwin to fpc bin directory. In the mail that didn't arrive I wrote: Why don't add gprof.exe, libgmon.a, libgcc.a, libc.a and libkernel32.a from cygwin to win32 distribution of fpc?

That will make the distribution even bigger. It is already large enough. Also it creates versioning problems that already sometimes happen with the cygwin1.dll we distribute.

Reply by email

Lee, John

Guilio

Why not zip all the files needed, add a short readme with your name & email address, and I'll then put it onto ftp.freepascal.org /contribs in a directory called win32_prof or something similar? Email me directly () if you can do this & I'll give you an upload ftp address for the zip.

Regards John

Show quoted text 78 lines
-----Original Message----- From: Behalf Of Giulio Bernardi Sent: 15 February 2006 10:29 To: FPC developers' list Subject: Re: [fpc-devel] profiling on win32 >> Did someone manage to enable profiling on win32? >> I linked with libc.a, libgmon.a, libgcc.a and libkernel32.a from cygwin >> but >> it fails on startup. >> If I start the -pg compiled program I see: >> >> monstartup: out of memory >> >> Then program runs without problems, and at the end I see a couple of >> access >> violations from gprof libraries code: >> >> 2 [main] testprogram 1316 handle_exceptions: Exception: >> STATUS_ACCESS_VIOLATION >> 242 [main] testprogram 1316 open_stackdumpfile: Dumping stack trace >> to >> testprogram.exe.stackdump >> >> I couldn't find anything on fpc website: faqs read "Profiling is >> supported". >> I had it working on linux but I'm not able to have it working under win32 > > FPC can link to gcc under Windows, but doesn't use the runtime of gcc > under win32 (mingw or cygwin), but directly accesses kernel32 and user32. > > Usually this is a blessing, but probably the profiler is very tied to > this. > > What probably should be done is to properly initialise libc and reroute > memory handling to libc's mmalloc. This could impact the profiling result > maybe though. > > Note that on windows there are at least three "c" frameworks to link to > (Microsofts msvcrt, mingw, cygwin), so any solution will always be windows > specific. Everything is all right now with Peter fix (it was Peter, wasn't he? I can't remember now). I sent a mail to the ML saying it worked but I think it didn't arrive :) I only needed to add libgmon.a, libgcc.a, libc.a and libkernel32.a from cygwin to fpc bin directory. In the mail that didn't arrive I wrote: Why don't add gprof.exe, libgmon.a, libgcc.a, libc.a and libkernel32.a from cygwin to win32 distribution of fpc? So, everything works and everyone is happy now (at least I am :P) bye Giulio _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Reply by email