Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gprof output is empty

Tags:

c

gcc

gprof

Using gprof 2.28 and gcc 6.3.0 in Ubuntu 17.04 on a variety of sample programs I get empty output for every category. If I run gprof -i on one example program I get:

1 histogram record
2 call-graph records
0 basic-block count records

My compilation looks something like this:

cc -g -c sem_test.c -pg
cc -o sem_test sem_test.o -lpthread -pg

Or this:

gcc -g3 -O0 -Wall -std=gnu99 -pg -fprofile-arcs -fno-inline -fno-reorder-functions sem_test.c -o sem_test -lpthread -pg

Both have the same results.

I notice that my gmon.out file is only 687 bytes which seems low.

like image 362
Paul Avatar asked Oct 20 '25 10:10

Paul


1 Answers

This is a glibc bug/limitation:

  • -pg -pie doesn't work

If you cannot install a fixed glibc, you can link with -no-pie to disable PIE. Your toolchain probably enables PIE automatically.

like image 185
Florian Weimer Avatar answered Oct 22 '25 01:10

Florian Weimer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!