diff options
author | Rob Savoye <rob@welcomehome.org> | 2002-04-02 23:01:18 +0000 |
---|---|---|
committer | Rob Savoye <rob@welcomehome.org> | 2002-04-02 23:01:18 +0000 |
commit | a23e19e7e8a2e229505928829facc71ff29c99c1 (patch) | |
tree | 4f51cbef992ec79ad454579e1cc77e8fc2cb92d1 /testglue.c | |
parent | b0bc8a8f894091f990d90dfa0ab1e46a48d4cfa0 (diff) | |
download | dejagnu-a23e19e7e8a2e229505928829facc71ff29c99c1.tar.gz dejagnu-a23e19e7e8a2e229505928829facc71ff29c99c1.tar.bz2 dejagnu-a23e19e7e8a2e229505928829facc71ff29c99c1.zip |
Trying yet again to check this in.
Diffstat (limited to 'testglue.c')
-rw-r--r-- | testglue.c | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -12,7 +12,8 @@ because currently GNU ld doesn't deal well with a.out targets and the -wrap option. When GNU ld is fixed, this should definitely be removed. Note that we actually wrap __exit, not _exit on a target - that has UNDERSCORES defined. */ + that has UNDERSCORES defined. On non-UNDERSCORE targets, we + wrap _exit separately; it's actually a different function. */ #ifdef WRAP_M68K_AOUT #define REAL_EXIT(code) asm ( "trap %0" : : "i" (0) ); @@ -29,9 +30,13 @@ #define ORIG_MAIN _wrap__main #else #define REAL_EXIT __real_exit +#ifndef VXWORKS +#define REAL__EXIT __real__exit +#endif #define REAL_MAIN __real_main #define REAL_ABORT __real_abort #define ORIG_EXIT __wrap_exit +#define ORIG__EXIT __wrap__exit #define ORIG_ABORT __wrap_abort #define ORIG_MAIN __wrap_main #endif @@ -42,7 +47,11 @@ extern void REAL_EXIT (); extern void REAL_ABORT (); extern int REAL_MAIN (int argc, char **argv, char **envp); #endif +#ifdef REAL__EXIT +extern void REAL__EXIT (); +#endif +static int done_exit_message = 0; int ___constval = 1; #ifdef VXWORKS @@ -81,10 +90,33 @@ ORIG_EXIT (code) ptr = write_int (code, buf + strlen(buf)); *(ptr++) = '\n'; write (1, buf, ptr-buf); + done_exit_message = 1; REAL_EXIT (code); while (___constval); } +#ifdef ORIG__EXIT +void +ORIG__EXIT (code) + int code; +{ + char buf[30]; + char *ptr; + + /* Since exit may call _exit, we need to avoid a second message. */ + if (! done_exit_message) + { + strcpy (buf, "\n*** EXIT code "); + ptr = write_int (code, buf + strlen(buf)); + *(ptr++) = '\n'; + write (1, buf, ptr-buf); + } + + REAL__EXIT (code); + while (___constval); +} +#endif + void ORIG_ABORT () { |