Skip to content

perf record doesn't work on -g3 binary

If we build GHC with debug information:

$ cat ./_build/hadrian.settings 
stage1.*.ghc.*.opts += -g3
stage2.*.ghc.*.opts += -g3
$ hadrian/build.cabal.sh

and then build and run a test:

$ _build/stage1/bin/ghc -O -g3 nofib/shootout/n-body/Main.hs
$ perf record nofib/shootout/n-body/Main 100000000

perf report only seems to report (quite non-sensical) addresses, not proper symbol names:

Samples: 45K of event 'cycles:u', Event count (approx.): 42707199057                                                                                                        
Overhead  Command  Shared Object     Symbol                                       
  20.10%  Main     Main              [.] 0x000000000000ad78                                                                                                                 
  16.30%  Main     Main              [.] 0x000000000000ad8b                                                                                                                 
   8.11%  Main     Main              [.] 0x000000000000ad95                                                                                                                 
   7.55%  Main     Main              [.] 0x000000000000ad9e                                                                                                                 
   5.96%  Main     Main              [.] 0x000000000000ada8                                   
...
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information