gprof gives Dwarf Error

3.2k Views Asked by At

I have compiled my apache2 on different server with gcc options,

-pg -DGPROF -g -DNO_USE_SIGACTION

I copied this apache2 binary to different server and executed it once and got gmon.out.

But when creating the analysis file using command,

gprof /usr/sbin/apache2 /gmon.out > /tmp/apa.txt

I get following lines of error,

BFD: Dwarf Error: found dwarf version '4', this reader only handles version 2 and 3 information.
BFD: Dwarf Error: found dwarf version '0', this reader only handles version 2 and 3 information.
BFD: Dwarf Error: found dwarf version '715', this reader only handles version 2 and 3 information.
BFD: Dwarf Error: found dwarf version '59393', this reader only handles version 2 and 3 information.

Around 100 lines of similar error. How can get rid of this to generate the gprof analysis file?

Compilation OS:

cat /etc/debian_version
6.0.7

gcc version 4.8.1 (crosstool-NG 1.19.0)

Execution OS:

cat /etc/debian_version
6.0.8
1

There are 1 best solutions below

0
On

You have a newer version of GCC, but it sounds like you have a somewhat older version of gprof.

One fix would be to build and install your own gprof. This isn't too hard.

Another fix would be to rebuild with "-gdwarf-3", which will tell GCC to use DWARF 3.