Hello. Valgrind for Snow Leopard was broken and in the latest weeks got a patch that's just an initial support. Don't know if things improved in the last week or so, but last time checked it was not ready for prime time.
About -arch i386, sorry my English is poor, what I mean is, gprof is not working even with binaries compiled with -arch i386.
Edit: forgot to mention that there are things in Mac OS X that are missing on Linux and I like a lot. For instance dtrace and leaks. Leaks is really cool since it can check memory leaks at run-time with a standard executable, and works very well.
About -arch i386, sorry my English is poor, what I mean is, gprof is not working even with binaries compiled with -arch i386.
Thats still wrong:
247:~ Zach$ gcc -pg -arch i386 foo.c -o foo
247:~ Zach$ file foo
foo: Mach-O executable i386
247:~ Zach$ ./foo
hello
247:~ Zach$ gprof foo
call graph profile:
The sum of self and descendents is the major sort
for this listing.
function entries:
[rest of the output snipped, I can pastebin if you want.]
Though, you should really look at Shark (`man shark`, or Developer/Applications/Performance Tools/Shark.app), as an alternative to gprof.
However, you are right about Valgrind not working on Snow Leopard yet. I had thought it was working by now. Whoops, on my part. I edited my first post.
Yep with -arch i386 it appears to work but the profiling info it returns is all zeroed. There are the functions but mostly 0% everything. Don't know what's the problem. With 64 bit target it's worse than this (some error printed on screen at startup).
Thanks for the hint about Shark, I'm playing with it and it seems cool indeed.
> Yep with -arch i386 it appears to work but the profiling info it returns is all zeroed.
That's the story of OS X since from when it was first released. For example, you'd have some functionality advertised as being in the system libraries (like, oh, certain important pthread functions) so they'd pass the configure checks, but they would be in reality just stub functions that mean nothing. So your program would subtly fail.
That particular problem was fixed in 10.1, but it seems like every release has a few things like that: something from UNIX that looks like it's there, but actually amounts to no-ops. It's maddening.
About -arch i386, sorry my English is poor, what I mean is, gprof is not working even with binaries compiled with -arch i386.
Edit: forgot to mention that there are things in Mac OS X that are missing on Linux and I like a lot. For instance dtrace and leaks. Leaks is really cool since it can check memory leaks at run-time with a standard executable, and works very well.