Subject: Cannot enable C source code profiling on amd64
To: NetBSD amd64 <>
From: Nicolas Joly <>
List: port-amd64
Date: 11/27/2003 13:19:49

I just wanted to enable profiling on a some programs and noticed some
strange results while trying to run generated binaries : endless
loops, crash, ...

Here follow a sample test case :

njoly@calimero [tmp/profile]> cat x.c 
#include <stdio.h>

int main(int argc, char **argv) {

  printf("Hello World\n");

  exit(0); }

This small program works fine without profiling :

njoly@calimero [tmp/profile]> cc x.c 
njoly@calimero [tmp/profile]> time ./a.out 
Hello World
./a.out  0.00s user 0.00s system 0% cpu 0.000 total

But with profiling enabled, it seems to loop :

njoly@calimero [tmp/profile]> cc -pg x.c 
njoly@calimero [tmp/profile]> time ./a.out
./a.out  58.45s user 0.00s system 99% cpu 58.451 total

njoly@calimero [tmp/profile]> uname -a
NetBSD 1.6ZF NetBSD 1.6ZF (GENERIC.MP) #17: Thu Nov 27 11:37:50 CET 2003 amd64
njoly@calimero [tmp/profile]> gcc -v
Using built-in specs.
Configured with: /work/trees/current/tools/gcc/../../gnu/dist/gcc/configure --enable-long-long --disable-multilib --enable-threads --build=x86_64-unknown-netbsd --host=x86_64--netbsd --target=x86_64--netbsd
Thread model: posix
gcc version 3.3.2 (NetBSD nb1 20031026)

Thanks in advance,

Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.