title: No function names when using gperftools/pprof
body: <p>I've been trying to get gperftools CPU profiling working on my program. </p>
  
  <p>I'm running into an issue where all the function names in my program are pointer addresses when reported by pprof. Annoyingly, most of the function names from libraries I've linked are readable, but none from my program files are. Example below.</p>
  
  <pre><code>s979258ca% pprof --text ./hmiss hmiss.prof                                        
  Using local file ./hmiss.
  Using local file hmiss.prof.
  Total: 469 samples
       152  32.4%  32.4%      152  32.4% 0x000000010ba6dd45
        47  10.0%  42.4%       47  10.0% 0x000000010ba6d365
        46   9.8%  52.2%       46   9.8% 0x000000010ba6d371
        34   7.2%  59.5%       34   7.2% 0x000000010ba8a04a
        32   6.8%  66.3%       32   6.8% 0x000000010ba6d35a
        10   2.1%  68.4%       10   2.1% 0x000000010ba8873c
         9   1.9%  70.4%        9   1.9% 0x00007fff63f409da
         6   1.3%  71.6%        6   1.3% 0x000000010ba7feca
         6   1.3%  72.9%        6   1.3% 0x00007fff63f40116
         6   1.3%  74.2%        6   1.3% 0x00007fff63f409f2
         5   1.1%  75.3%        5   1.1% 0x000000010ba6dd4c
         ...
  </code></pre>
  
  <p>What do I need to do to get my functions names included in the pprof output?</p>
  
  <p>Here's what the process to get to the above point looks like for me, if it helps.
  I build my program with the options below</p>
  
  <pre><code>clang++
  "-std=c++17",
  "-g",
  "-O2",
  "...cpp files..."
  "-o",
  "~/cpp/hmiss/hmiss",
  "/usr/local/Cellar/gperftools/2.7/lib/libprofiler.dylib",
  </code></pre>
  
  <p>I enable CPU profiling with gprof by running </p>
  
  <p><code>DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib CPUPROFILE=hmiss.prof ./hmiss</code></p>
  
  <p>I then run <code>pprof --text ./hmiss hmiss.prof</code></p>
  
  <p>From an answer to a <a href="https://stackoverflow.com/questions/46007988/gperftools-and-pprof-do-not-print-my-function-names-need-advice-on-how-to-fix-t">similar question</a> I thought possibly including debugging symbols might get the names in there, but just building my program with -g didn't seem to help. Also, removing the -O2 flag did not help either.</p>