Hello, I am working on a basic block coverage counter which mimics -fsanitize-coverage=trace-pc but has more features. My problem is that when instrumenting multiple C files (e.g., test1.c test2.c test3.c), I want to generate correspondingly three coverage logs (test1.log, test2.log, test3.log), so on and so forth.
Therefore, my question is 1) how to figure out the instrumented source code file name in GIMPLE plugins (my plugins is after the "optimized" pass), and 2) I want to keep all covered basic block info in memory and write log file *only once* right before finish the profiling (i.e., the instrumented program finish executing the program and is about to exit). Can I somehow set a callback at that point and then flush the coverage record into files? I don't know how/where to "set a callback" like that, if possible at all. Thank you very much. Best, Shuai