Open ChrisTimperley opened 5 years ago
FYI @afsafzal
Interestingly, the signal handler below crashes once again (for certain kinds of seg. fault) when the call to __gcov_flush
is made.
extern void __gcov_flush(void);
void bugzoo_sighandler(int sig){
__gcov_flush();
fprintf(stderr, "no bueno");
exit(1);
}
What do you mean? Do you mean __gcov_flush
crashes?
What do you mean? Do you mean
__gcov_flush
crashes?
Exactly.
If the call to __gcov_flush
is removed, no bueno
is printed to the stderr
, as expected.
void gflush(){
fprintf(stderr, "flushing...\n");
// __gcov_flush();
fprintf(stderr, "flushed!\n");
}
void bugzoo_sighandler(int sig){
fprintf(stderr, "no bueno\n");
exit(1);
}
void bugzoo_ctor (void) __attribute__ ((constructor));
void bugzoo_ctor (void) {
if (atexit(gflush) != 0)
fprintf(stderr, "failed to register gflush\n");
The program above exits with code 1 and produces the following output:
no bueno
flushing...
flushed!
shell returned 1
When the call to __gcov_flush
is uncommented, the following output is produced:
no bueno
flushing...
Segmentation fault (core dumped)
shell returned 139
See: https://github.com/ChrisTimperley/genprog-tse-2012-bugs/pull/3
Related: https://stackoverflow.com/questions/20250400/how-can-i-use-gcov-even-when-a-segmentation-fault-happens
Also affects https://github.com/ChrisTimperley/genprog-tse-2012-bugs/pull/2 and https://github.com/ChrisTimperley/genprog-tse-2012-bugs/pull/1