[fpc-pascal] Problems with valgrind

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Oct 15 15:06:58 CEST 2012


On 15 Oct 2012, at 14:08, Darius Blaszyk wrote:

> I'm trying to use valgrind for the first time seriously to profile my app. See output from console below;
> 
[snip]
> After googling I found some remark about adding a -m32 flag with GCC. Is this the same issue I have here?

No, because -m32 is a Linux-specific flag. And Valgrind for Mac OS X by default supports both 32 and 64 bit binaries.

> What is the remedy?

I don't know. It works fine here on Mac OS X 10.6 with Valgrind 3.8.0:

$ fpc -gv prog.pp
Free Pascal Compiler version 2.6.0 [2011/12/30] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling prog.pp
Compiling unit1.pp
Assembling (pipe) unit1.s
Assembling (pipe) prog.s
Linking prog
18 lines compiled, 1.2 sec 

$ valgrind --tool=cachegrind ./prog
==790== Cachegrind, a cache and branch-prediction profiler
==790== Copyright (C) 2002-2011, and GNU GPL'd, by Nicholas Nethercote et al.
==790== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info
==790== Command: ./prog
==790== 
--790-- ./prog:
--790-- dSYM directory is missing; consider using --dsymutil=yes
==790== 
==790== I   refs:      1,061,926
==790== I1  misses:        1,811
==790== LLi misses:        1,372
==790== I1  miss rate:      0.17%
==790== LLi miss rate:      0.12%
==790== 
==790== D   refs:        541,094  (384,427 rd   + 156,667 wr)
==790== D1  misses:        2,997  (  1,802 rd   +   1,195 wr)
==790== LLd misses:        2,156  (  1,326 rd   +     830 wr)
==790== D1  miss rate:       0.5% (    0.4%     +     0.7%  )
==790== LLd miss rate:       0.3% (    0.3%     +     0.5%  )
==790== 
==790== LL refs:           4,808  (  3,613 rd   +   1,195 wr)
==790== LL misses:         3,528  (  2,698 rd   +     830 wr)
==790== LL miss rate:        0.2% (    0.1%     +     0.5%  

You may want to look at the Instruments application that comes with Xcode though. That one offers a lot of different profiling options based on performance counters and sampling.


Jonas


More information about the fpc-pascal mailing list