https://sourceware.org/bugzilla/show_bug.cgi?id=32892
Bug ID: 32892 Summary: source line level informatiion not available with "-g -O2" Product: binutils Version: 2.44 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gprofng Assignee: vladimir.mezentsev at oracle dot com Reporter: bruno at clisp dot org Target Milestone: --- The documentation of gprofng https://sourceware.org/binutils/docs/gprofng.html#Main-Features says: "This tool works with unmodified production level executables. There is no need to recompile the code, but if the ā-gā option has been used when building the application, source line level information is available." So, it sounds like binaries built with the options '-g -O2' should be usable with source line level information. This is true for valgrind (see https://gitlab.com/ghwiki/gnow-how/-/wikis/Profiling/with_sampling ), but not for gprofng. How to reproduce: 1. wget https://ftp.gnu.org/gnu/gperf/gperf-3.3.tar.gz 2. tar xfz gperf-3.3.tar.gz 3. cd gperf-3.3 4. export CC=gcc; export CXX=g++; unset CFLAGS; unset CXXFLAGS; export CPPFLAGS=-Wall 5. ./configure 6. make Observe that the C++ source code gets compiler with "g++ -g -O2". 7. cd src 8. gp-collect-app -o test.1.er -p on -S on ./gperf -m 10 ../tests/5000.gperf > /dev/null 9. gprofng-display-text test.1.er (gprofng-display-text) lines ... 13.259 91.63 14.210 98.20 <Function: Search::find_asso_values(), instructions without line numbers> ... (gprofng-display-text) source search.cc Expected: Lines search.cc 1396..1402 are highlighted as CPU-intensive. Actual: Lines search.cc 1396..1402 are not marked in any way. This is on Linux/x86_64, with g++ 13.3.0. -- You are receiving this mail because: You are on the CC list for the bug.