mips-signal.h (sys/syscall.h): Do not include.

2006-11-20  David Daney  <ddaney@avtrex.com>

	* include/mips-signal.h (sys/syscall.h): Do not include.
	(sig_ucontext_t): Removed.
	(MAKE_THROW_FRAME): Changed to be a nop.
	(_INIT_SIG_HANDLER): New macro.
	(INIT_SEGV): Rewrote to use _INIT_SIG_HANDLER.
	(INIT_FPE): Same.

2006-11-20  David Daney  <ddaney@avtrex.com>

	* config/mips/linux-unwind.h (mips_fallback_frame_state): Adjust
	PC to point to following instruction.

From-SVN: r119024
This commit is contained in:
David Daney 2006-11-20 19:49:08 +00:00 committed by David Daney
parent e9057fe4ee
commit 9e08816049
4 changed files with 28 additions and 43 deletions

View File

@ -1,3 +1,8 @@
2006-11-20 David Daney <ddaney@avtrex.com>
* config/mips/linux-unwind.h (mips_fallback_frame_state): Adjust
PC to point to following instruction.
2006-11-20 Anatoly Sokolov <aesok@post.ru> 2006-11-20 Anatoly Sokolov <aesok@post.ru>
PR target/18553 PR target/18553

View File

@ -1,5 +1,5 @@
/* DWARF2 EH unwinding support for MIPS Linux. /* DWARF2 EH unwinding support for MIPS Linux.
Copyright (C) 2004, 2005 Free Software Foundation, Inc. Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
@ -51,6 +51,7 @@ mips_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs) _Unwind_FrameState *fs)
{ {
u_int32_t *pc = (u_int32_t *) context->ra; u_int32_t *pc = (u_int32_t *) context->ra;
u_int32_t t;
struct sigcontext *sc; struct sigcontext *sc;
_Unwind_Ptr new_cfa; _Unwind_Ptr new_cfa;
int i; int i;
@ -102,9 +103,13 @@ mips_fallback_frame_state (struct _Unwind_Context *context,
fs->regs.reg[i].loc.offset fs->regs.reg[i].loc.offset
= (_Unwind_Ptr)&(sc->sc_regs[i]) - new_cfa; = (_Unwind_Ptr)&(sc->sc_regs[i]) - new_cfa;
} }
fs->regs.reg[SIGNAL_UNWIND_RETURN_COLUMN].how = REG_SAVED_OFFSET; /* The PC points to the faulting instruction, but the unwind tables
expect it point to the following instruction. We compensate by
reporting a return address at the next instruction. */
fs->regs.reg[SIGNAL_UNWIND_RETURN_COLUMN].how = REG_SAVED_VAL_OFFSET;
t = (*(u_int32_t *)(void *)&sc->sc_pc) + 4;
fs->regs.reg[SIGNAL_UNWIND_RETURN_COLUMN].loc.offset fs->regs.reg[SIGNAL_UNWIND_RETURN_COLUMN].loc.offset
= (_Unwind_Ptr)&(sc->sc_pc) - new_cfa; = (_Unwind_Ptr)t - new_cfa;
fs->retaddr_column = SIGNAL_UNWIND_RETURN_COLUMN; fs->retaddr_column = SIGNAL_UNWIND_RETURN_COLUMN;
return _URC_NO_REASON; return _URC_NO_REASON;

View File

@ -1,3 +1,12 @@
2006-11-20 David Daney <ddaney@avtrex.com>
* include/mips-signal.h (sys/syscall.h): Do not include.
(sig_ucontext_t): Removed.
(MAKE_THROW_FRAME): Changed to be a nop.
(_INIT_SIG_HANDLER): New macro.
(INIT_SEGV): Rewrote to use _INIT_SIG_HANDLER.
(INIT_FPE): Same.
2006-11-20 David Daney <ddaney@avtrex.com> 2006-11-20 David Daney <ddaney@avtrex.com>
* testsuite/libjava.lang/Throw_3.java: New Test. * testsuite/libjava.lang/Throw_3.java: New Test.

View File

@ -18,65 +18,31 @@ details. */
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <sys/syscall.h>
/* #include <asm/ucontext.h> structures we use are here but clash with
sys/ucontext.h included by java-signal.h from prims.cc */
#define HANDLE_SEGV 1 #define HANDLE_SEGV 1
#define HANDLE_FPE 1 #define HANDLE_FPE 1
/* The third parameter to the signal handler points to something with
* this structure defined in asm/ucontext.h, but the name clashes with
* struct ucontext from sys/ucontext.h so this private copy is used. */
typedef struct _sig_ucontext {
unsigned long uc_flags;
struct _sig_ucontext *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask;
} sig_ucontext_t;
#define SIGNAL_HANDLER(_name) \ #define SIGNAL_HANDLER(_name) \
static void _name (int _dummy __attribute__ ((__unused__)), \ static void _name (int _dummy __attribute__ ((__unused__)), \
siginfo_t *_info __attribute__ ((__unused__)), \ siginfo_t *_info __attribute__ ((__unused__)), \
void *_arg __attribute__ ((__unused__))) void *_arg __attribute__ ((__unused__)))
/* #define MAKE_THROW_FRAME(_exception)
* MIPS leaves pc pointing at the faulting instruction, but the
* unwinder expects it to point to the following instruction
*/
#define MAKE_THROW_FRAME(_exception) \ #define _INIT_SIG_HANDLER(_SIG, _ACTION) \
do \
{ \
((sig_ucontext_t *)_arg)->uc_mcontext.sc_pc += 4; \
(void)_dummy; \
(void)_info; \
} \
while (0)
#define INIT_SEGV \
do \ do \
{ \ { \
struct sigaction act; \ struct sigaction act; \
act.sa_sigaction = catch_segv; \ act.sa_sigaction = _ACTION; \
act.sa_flags = SA_SIGINFO | SA_NODEFER; \ act.sa_flags = SA_SIGINFO | SA_NODEFER; \
sigemptyset (&act.sa_mask); \ sigemptyset (&act.sa_mask); \
sigaction(SIGSEGV, &act, NULL); \ sigaction(_SIG, &act, NULL); \
} \ } \
while (0) while (0)
#define INIT_FPE \ #define INIT_SEGV _INIT_SIG_HANDLER (SIGSEGV, catch_segv)
do \
{ \
struct sigaction act; \
act.sa_sigaction = catch_fpe; \
act.sa_flags = SA_SIGINFO | SA_NODEFER; \
sigemptyset (&act.sa_mask); \
sigaction(SIGFPE, &act, NULL); \
} \
while (0)
#define INIT_FPE _INIT_SIG_HANDLER (SIGFPE, catch_fpe)
#undef HANDLE_DIVIDE_OVERFLOW #undef HANDLE_DIVIDE_OVERFLOW
#endif /* JAVA_SIGNAL_H */ #endif /* JAVA_SIGNAL_H */