[PATCH] D48538: Make __gcov_flush flush counters for all shared libraries

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 12:30:39 PDT 2018


davidxl added inline comments.


================
Comment at: test/profile/Inputs/instrprof-shared-main-gcov-flush-before-shared-call.c:9
+
+  return 0;
+}
----------------
Make test case more complete:

1) add a non shared call after flush as well

2) test the case when normal exit is not invoked -- in this case, the profile counts accumulated after the flush should not be recorded.


================
Comment at: test/profile/Inputs/instrprof-shared-main-gcov-flush-no-writeout.c:9
+
+  int *ciao = 0;
+  *ciao = 42;
----------------
perhaps call 'abort' or '_exit'  instead.


================
Comment at: test/profile/Inputs/instrprof-shared-main-gcov-flush.c:9
+
+  return 0;
+}
----------------
share the same source with the flush-no-writeout case by using a guarding macro: use using exit, and the other uses _exit.

More suggestion on the test case:

Define another function, say 'bar' in the main source file and call it before and after the __gcov_flush() call.

Add another call to 'foo' after the gcov_flush call.

The 'gcov' outputs between the normal write out at exit vs flushed output (when _exit is used) should be different.

(Just noticed that you have a flush-before-call test case -- can consider merge it into one source with macros).





https://reviews.llvm.org/D48538





More information about the llvm-commits mailing list