Index: libjava/include/dwarf2-signal.h =================================================================== RCS file: /cvs/gcc/gcc/libjava/include/dwarf2-signal.h,v retrieving revision 1.14 diff -u -p -r1.14 dwarf2-signal.h --- libjava/include/dwarf2-signal.h 13 Jun 2003 12:20:45 -0000 1.14 +++ libjava/include/dwarf2-signal.h 17 Jun 2003 17:06:37 -0000 @@ -1,6 +1,6 @@ // dwarf2-signal.h - Catch runtime signals and turn them into exceptions. -/* Copyright (C) 2000, 2001 Free Software Foundation +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation This file is part of libgcj. @@ -12,15 +12,15 @@ Libgcj License. Please consult the file details. */ #ifndef JAVA_SIGNAL_H -#define JAVA_SIGNAL_H 1 +# define JAVA_SIGNAL_H 1 -#include -#include +# include +# include -#define HANDLE_SEGV 1 -#undef HANDLE_FPE +# define HANDLE_SEGV 1 +# undef HANDLE_FPE -#define SIGNAL_HANDLER(_name) \ +# define SIGNAL_HANDLER(_name) \ static void _Jv_##_name (int, siginfo_t *_sip, void *_p) class java::lang::Throwable; @@ -29,8 +29,8 @@ class java::lang::Throwable; // then throw an exception. With the dwarf2 unwinder we don't usually // need to do anything, with some minor exceptions. -#ifdef __alpha__ -#define MAKE_THROW_FRAME(_exception) \ +# ifdef __alpha__ +# define MAKE_THROW_FRAME(_exception) \ do \ { \ /* Alpha either leaves PC pointing at a faulting instruction or the \ @@ -42,9 +42,9 @@ do \ } \ while (0) -#elif defined(__ia64__) +# elif defined(__ia64__) -#define MAKE_THROW_FRAME(_exception) \ +# define MAKE_THROW_FRAME(_exception) \ do \ { \ /* IA-64 either leaves PC pointing at a faulting instruction or the \ @@ -58,12 +58,12 @@ do \ _sc->sc_ip++; \ } \ while (0) -#elif defined(__sparc__) +# elif defined(__sparc__) /* We could do the unwind of the signal frame quickly by hand here like sparc-signal.h does under Solaris, but that makes debugging unwind failures almost impossible. */ -#if !defined(__arch64__) -#define MAKE_THROW_FRAME(_exception) \ +# if !defined(__arch64__) +# define MAKE_THROW_FRAME(_exception) \ do \ { \ /* Sparc-32 leaves PC pointing at a faulting instruction \ @@ -90,8 +90,8 @@ do \ regp->pc = ((regp->pc + 4) - 8); \ } \ while (0) -#else -#define MAKE_THROW_FRAME(_exception) \ +# else +# define MAKE_THROW_FRAME(_exception) \ do \ { \ /* Sparc-64 leaves PC pointing at a faulting instruction \ @@ -112,18 +112,25 @@ do \ regp->tpc = ((regp->tpc + 4) - 8); \ } \ while (0) -#endif -#else -#define MAKE_THROW_FRAME(_exception) \ +# endif +# else +# define MAKE_THROW_FRAME(_exception) \ do \ { \ (void)_p; \ } \ while (0) -#endif +# endif -#if defined(__sparc__) -#if defined(__arch64__) +/* We use syscall(SYS_sigaction) in INIT_SEGV and INIT_FPE instead of + sigaction() because on some systems the pthreads wrappers for + signal handlers are not compiled with unwind information, so it's + not possible to unwind through them. This is a problem that will + go away once all systems have pthreads libraries that are + compiled with full unwind info. */ + +# if defined(__sparc__) +# if defined(__arch64__) extern "C" { static void __rt_sigreturn_stub(void) { @@ -140,7 +147,7 @@ extern "C" { sigset_t k_sa_mask; }; } -#define INIT_SEGV \ +# define INIT_SEGV \ do \ { \ struct kernel_sigaction act; \ @@ -154,7 +161,7 @@ do \ } \ while (0) -#define INIT_FPE \ +# define INIT_FPE \ do \ { \ struct kernel_sigaction act; \ @@ -167,7 +174,7 @@ do \ stub - 8, _NSIG / 8); \ } \ while (0) -#else /* __arch64__ */ +# else /* __arch64__ */ extern "C" { struct kernel_sigaction @@ -178,7 +185,7 @@ extern "C" { }; } -#define INIT_SEGV \ +# define INIT_SEGV \ do \ { \ struct kernel_sigaction act; \ @@ -190,7 +197,7 @@ do \ } \ while (0) -#define INIT_FPE \ +# define INIT_FPE \ do \ { \ struct kernel_sigaction act; \ @@ -201,63 +208,57 @@ do \ syscall (SYS_sigaction, -SIGFPE, &act, NULL); \ } \ while (0) -#endif -#elif !defined(__ia64__) -#define INIT_SEGV \ +# endif +# elif defined(__ia64__) + +// On IA64, unwind information is mandatory, so we can unwind +// correctly through glibc frames. Thus we call the ordinary +// sigaction. + +# define INIT_SEGV \ do \ { \ struct sigaction act; \ act.sa_sigaction = _Jv_catch_segv; \ sigemptyset (&act.sa_mask); \ act.sa_flags = SA_SIGINFO; \ - syscall (SYS_sigaction, SIGSEGV, &act, NULL); \ + sigaction (SIGSEGV, &act, NULL); \ } \ while (0) -#define INIT_FPE \ +# define INIT_FPE \ do \ { \ struct sigaction act; \ act.sa_sigaction = _Jv_catch_fpe; \ sigemptyset (&act.sa_mask); \ act.sa_flags = SA_SIGINFO; \ - syscall (SYS_sigaction, SIGFPE, &act, NULL); \ + sigaction (SIGFPE, &act, NULL); \ } \ while (0) -/* We use syscall(SYS_sigaction) in INIT_SEGV and INIT_FPE instead of - * sigaction() because on some systems the pthreads wrappers for - * signal handlers are not compiled with unwind information, so it's - * not possible to unwind through them. This is a problem that will - * go away once all systems have pthreads libraries that are - * compiled with full unwind info. */ - -#else /* __ia64__ */ - -// On IA64, unwind information is mandatory, so we can unwind -// correctly through glibc frames. Thus we call the ordinary -// sigaction. - -#define INIT_SEGV \ +# else +# define INIT_SEGV \ do \ { \ struct sigaction act; \ act.sa_sigaction = _Jv_catch_segv; \ sigemptyset (&act.sa_mask); \ act.sa_flags = SA_SIGINFO; \ - sigaction (SIGSEGV, &act, NULL); \ + syscall (SYS_sigaction, SIGSEGV, &act, NULL); \ } \ while (0) -#define INIT_FPE \ +# define INIT_FPE \ do \ { \ struct sigaction act; \ act.sa_sigaction = _Jv_catch_fpe; \ sigemptyset (&act.sa_mask); \ act.sa_flags = SA_SIGINFO; \ - sigaction (SIGFPE, &act, NULL); \ + syscall (SYS_sigaction, SIGFPE, &act, NULL); \ } \ while (0) -#endif /* __ia64__ || __sparc__ */ + +# endif #endif /* JAVA_SIGNAL_H */