diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-01-29 20:35:37 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-01-29 20:35:37 +0100 |
commit | dd804ce80852aa583308b02330dd93a94d5fc423 (patch) | |
tree | 42a5fc4d533c9ba12b170dc6274a8dd6673586a4 /testsuite/gna/issue1623/main.c | |
parent | 45dc90330d619d6445d178483a36fef7673b51fe (diff) | |
download | ghdl-dd804ce80852aa583308b02330dd93a94d5fc423.tar.gz ghdl-dd804ce80852aa583308b02330dd93a94d5fc423.tar.bz2 ghdl-dd804ce80852aa583308b02330dd93a94d5fc423.zip |
testsuite/gna: file testcase for #1623
Diffstat (limited to 'testsuite/gna/issue1623/main.c')
-rw-r--r-- | testsuite/gna/issue1623/main.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/gna/issue1623/main.c b/testsuite/gna/issue1623/main.c new file mode 100644 index 000000000..9ab757316 --- /dev/null +++ b/testsuite/gna/issue1623/main.c @@ -0,0 +1,27 @@ +#include <stdlib.h> +#include <stdio.h> +#include <signal.h> + +extern int ghdl_main(int argc, void** argv); + +void sigabrtHandler(int sig_num) { + // Reset handler to catch SIGABRT next time. Refer http://en.cppreference.com/w/c/program/signal + signal(SIGABRT, sigabrtHandler); + printf("SIGABRT caught %d!\n", sig_num); + fflush(stdout); +} + +static void exit_handler(void) { + printf("This is the exit handler.\n"); +} + +int entry(int argc, void** argv) { + signal(SIGABRT, sigabrtHandler); + atexit(exit_handler); + + printf("Hello entry!\n"); + int ecode = ghdl_main(argc, argv); + printf("Bye entry <%d>!\n", ecode); + + return ecode; +} |