Problem description =================== Function names are mangled in gprof output. Such name mangling in gprof output only occurs when compiling with g++ under 64 bit modes Compiler output =============== The name HelloWorld is mangled. Flat profile: Each sample counts as 0.01 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 7 0.00 0.00 ._Z10HelloWorldv 0.00 0.00 0.00 1 0.00 0.00 .__gmon_start__ ^L Call graph granularity: each sample hit covers 4 byte(s) no time propagated index % time self children called name 0.00 0.00 7/7 .main [9] [1] 0.0 0.00 0.00 7 ._Z10HelloWorldv [1] ----------------------------------------------- 1 .__gmon_start__ [2] 0.00 0.00 1/1 .atexit [8] [2] 0.0 0.00 0.00 1+1 .__gmon_start__ [2] 1 .__gmon_start__ [2] ----------------------------------------------- ^L Index by function name [1] ._Z10HelloWorldv [2] .__gmon_start__Expected output =============== Flat profile: Each sample counts as 0.01 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 7 0.00 0.00 HelloWorld() 0.00 0.00 0.00 1 0.00 0.00 global constructors keyed to _Z10HelloWorldv 0.00 0.00 0.00 1 0.00 0.00 __static_initialization_and_destruction_0(int, int) ^L Call graph granularity: each sample hit covers 4 byte(s) no time propagated index % time self children called name 0.00 0.00 7/7 main [10] [11] 0.0 0.00 0.00 7 HelloWorld() [11] ----------------------------------------------- 0.00 0.00 1/1 __do_global_ctors_aux [14] [12] 0.0 0.00 0.00 1 global constructors keyed to _Z10HelloWorldv [12] 0.00 0.00 1/1 __static_initialization_and_destruction_0(int, int) [13] ----------------------------------------------- 0.00 0.00 1/1 global constructors keyed to _Z10HelloWorldv [12] [13] 0.0 0.00 0.00 1 __static_initialization_and_destruction_0(int, int) [13] ----------------------------------------------- ^L Index by function name [12] global constructors keyed to _Z10HelloWorldv [11] HelloWorld() [13] __static_initialization_and_destruction_0(int, int) Steps to reproduce the problem ============================== # /usr/bin/g++ -m64 -pg -o hello hello.C >STEP1.out 2>&1 # ./hello >hello.out 2>STEP2.out # /usr/bin/gprof -b hello gmon.out >gprof.out 2>STEP6.out /* Listing of hello.C */ #include <stream.h> void HelloWorld() { cout << "Hello, World\n"; } int main() { for(int i=0; i<7; i++) HelloWorld(); return(0); }
gprof is not part of GCC, it is part of binutils. The problem is that gprof is not stripping out the dot part of the symbol. Report this to the binutils folks.