https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120916

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Here is variant for gcov tool:

jh@shroud:/tmp> cat tt.c
int s = 1023;
int a[1024];
__attribute__ ((weak))
void test()
{
        for (
             int i = 0;  /* Line 7, relative 3 */
             i < s;      /* Line 8, relative 4 */
             i++)        /* Line 9, relative 5 */
          a[i]++;        /* Line 10, relative 6 */
}
int
main()
{
        for (int i = 0; i < 100000000; i++)
          test ();
}
jh@shroud:/tmp> gcc -O3 tt.c -g
jh@shroud:/tmp> ~/trunk/gcc/config/i386/gcc-auto-profile ./a.out
+ perf record -e ex_ret_brn_tkn:Pu -b ./a.out
[ perf record: Woken up 12 times to write data ]
[ perf record: Captured and wrote 12.338 MB perf.data (29901 samples) ]
jh@shroud:/tmp> create_gcov --binary a.out --gcov a.gcov --gcov_version=2
[WARNING:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1322]
Skipping 4228 bytes of metadata: HEADER_CPU_TOPOLOGY
[WARNING:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1069]
Skipping unsupported event PERF_RECORD_ID_INDEX
[WARNING:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1069]
Skipping unsupported event PERF_RECORD_EVENT_UPDATE
[WARNING:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1069]
Skipping unsupported event PERF_RECORD_CPU_MAP
[WARNING:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1069]
Skipping unsupported event UNKNOWN_EVENT_82
[INFO:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1060]
Number of events stored: 29937
[INFO:/home/jh/autofdo/third_party/perf_data_converter/src/quipper/perf_parser.cc:272]
Parser processed: 4 MMAP/MMAP2 events, 2 COMM events, 0 FORK events, 1 EXIT
events, 29901 SAMPLE events, 29889 of these were mapped, 0 SAMPLE events with a
data address, 0 of these were mapped
WARNING: Logging before InitGoogleLogging() is written to STDERR
W20250701 14:41:45.439186 1096710 sample_reader.cc:345] Bogus LBR data (range
is negative): 1180->0 index=3
W20250701 14:41:45.439294 1096710 sample_reader.cc:345] Bogus LBR data (range
is negative): 1140->0 index=4
W20250701 14:41:45.439298 1096710 sample_reader.cc:345] Bogus LBR data (range
is negative): 1180->0 index=7
I20250701 14:41:45.442853 1096710 symbol_map.cc:477] Adding loadable exec
segment: offset=1000 vaddr=401000
jh@shroud:/tmp> dump_gcov a.gcov
test total:894233 head:1227
  3: 0
  4: 446280
  5: 838
  6: 446277
  7: 838
main total:2065 head:0
  1: 0
  2.1: 972
  3: 1093  test:1227
  4: 0


In the dump
  x: y
x is the relative line number (to start of function) and y is count
  5: 838 is wrong and should be approx 446280

Reply via email to