Sign in Join

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

Mailing lists / fpc-pascal / 2012-10

Problems with valgrind

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Darius Blaszyk

Hi,

I'm trying to use valgrind for the first time seriously to profile my app. See output from console below;

Darius-Blaszyks-Mac-mini:fileio dariusblaszyk$ fpc -gv fileio.pp Free Pascal Compiler version 2.7.1 [2012/05/18] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Darwin for i386
Compiling fileio.pp
Assembling (pipe) fileio.s
Linking fileio
55 lines compiled, 1.9 sec
Darius-Blaszyks-Mac-mini:fileio dariusblaszyk$ valgrind --tool=callgrind ./fileio valgrind: ./fileio: cannot execute binary file

After googling I found some remark about adding a -m32 flag with GCC. Is this the same issue I have here? What is the remedy?

Regards, Darius

Reply by email

Jonas Maebe
to Darius Blaszyk
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

Reply by email

Darius Blaszyk
to Jonas Maebe
Jonas Maebe wrote 14 lines
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:

I found out that my valgrind (from MacPorts) does not support 32bit applications. The solution was to add -Px86_64 to commandline. I have added this tip to the wiki BTW, so it won't get forgotten.

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.

Thanks! I will have a look. I already found Shark, but that was a bit confusing to me.

Regards, Darius

Reply by email