|
|
4e62ec |
2006-02-27 Jakub Jelinek <jakub@redhat.com>
|
|
|
4e62ec |
|
|
|
4e62ec |
PR other/26208
|
|
|
4e62ec |
* unwind-dw2.c (struct _Unwind_Context): Add signal_frame field.
|
|
|
4e62ec |
(_Unwind_FrameState): Add signal_frame field.
|
|
|
4e62ec |
(extract_cie_info): Handle S flag in augmentation string.
|
|
|
4e62ec |
(execute_cfa_program): If context->signal_frame, execute also
|
|
|
4e62ec |
fs->pc == context->ra instructions.
|
|
|
4e62ec |
(uw_frame_state_for): If context->signal_frame, don't subtract one
|
|
|
4e62ec |
from context->ra to find FDE.
|
|
|
4e62ec |
(uw_update_context_1): Set context->signal_frame to
|
|
|
4e62ec |
fs->signal_frame.
|
|
|
4e62ec |
(_Unwind_GetIPInfo): New function.
|
|
|
4e62ec |
* unwind-c.c (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
|
|
|
4e62ec |
of _Unwind_GetIP.
|
|
|
4e62ec |
* unwind-sjlj.c (_Unwind_GetIPInfo): New function.
|
|
|
4e62ec |
* unwind.h (_Unwind_GetIPInfo): New prototype.
|
|
|
4e62ec |
* unwind-compat.c (_Unwind_GetIPInfo): New function.
|
|
|
4e62ec |
* libgcc-std.ver (_Unwind_GetIPInfo): Export @@GCC_4.2.0.
|
|
|
4e62ec |
* config/ia64/unwind-ia64.c (_Unwind_GetIPInfo): New function.
|
|
|
4e62ec |
* config/i386/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Set
|
|
|
4e62ec |
(FS)->signal_frame.
|
|
|
4e62ec |
* config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
|
|
|
4e62ec |
* config/rs6000/linux-unwind.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
|
|
|
4e62ec |
* config/s390/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
|
|
|
4e62ec |
|
|
|
4e62ec |
* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Use
|
|
|
4e62ec |
_Unwind_GetIPInfo instead of _Unwind_GetIP.
|
|
|
4e62ec |
|
|
|
4e62ec |
* exception.cc (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
|
|
|
4e62ec |
of _Unwind_GetIP.
|
|
|
4e62ec |
* include/i386-signal.h (MAKE_THROW_FRAME): Change into empty macro.
|
|
|
4e62ec |
(HANDLE_DIVIDE_OVERFLOW): Don't adjust _res->eip if falling through
|
|
|
4e62ec |
to throw.
|
|
|
4e62ec |
* include/x86_64-signal.h (MAKE_THROW_FRAME): Change into empty
|
|
|
4e62ec |
macro.
|
|
|
4e62ec |
* include/powerpc-signal.h (MAKE_THROW_FRAME): Change into empty
|
|
|
4e62ec |
macro.
|
|
|
4e62ec |
|
|
|
4e62ec |
--- libjava/exception.cc.jj 2005-11-21 14:47:25.000000000 +0100
|
|
|
4e62ec |
+++ libjava/exception.cc 2006-04-21 14:00:19.000000000 +0200
|
|
|
4e62ec |
@@ -199,6 +199,7 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
int handler_switch_value;
|
|
|
4e62ec |
bool saw_cleanup;
|
|
|
4e62ec |
bool saw_handler;
|
|
|
4e62ec |
+ int ip_before_insn = 0;
|
|
|
4e62ec |
|
|
|
4e62ec |
|
|
|
4e62ec |
// Interface version check.
|
|
|
4e62ec |
@@ -214,10 +215,10 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
goto install_context;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
- // FIXME: In Phase 1, record _Unwind_GetIP in xh->obj as a part of
|
|
|
4e62ec |
+ // FIXME: In Phase 1, record _Unwind_GetIPInfo in xh->obj as a part of
|
|
|
4e62ec |
// the stack trace for this exception. This will only collect Java
|
|
|
4e62ec |
// frames, but perhaps that is acceptable.
|
|
|
4e62ec |
- // FIXME2: _Unwind_GetIP is nonsensical for SJLJ, being a call-site
|
|
|
4e62ec |
+ // FIXME2: _Unwind_GetIPInfo is nonsensical for SJLJ, being a call-site
|
|
|
4e62ec |
// index instead of a PC value. We could perhaps arrange for
|
|
|
4e62ec |
// _Unwind_GetRegionStart to return context->fc->jbuf[1], which
|
|
|
4e62ec |
// is the address of the handler label for __builtin_longjmp, but
|
|
|
4e62ec |
@@ -232,7 +233,9 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
|
|
|
4e62ec |
// Parse the LSDA header.
|
|
|
4e62ec |
p = parse_lsda_header (context, language_specific_data, &info;;
|
|
|
4e62ec |
- ip = _Unwind_GetIP (context) - 1;
|
|
|
4e62ec |
+ ip = _Unwind_GetIPInfo (context, &ip_before_insn);
|
|
|
4e62ec |
+ if (! ip_before_insn)
|
|
|
4e62ec |
+ --ip;
|
|
|
4e62ec |
landing_pad = 0;
|
|
|
4e62ec |
action_record = 0;
|
|
|
4e62ec |
handler_switch_value = 0;
|
|
|
4e62ec |
--- libjava/include/i386-signal.h.jj 2005-11-21 14:47:15.000000000 +0100
|
|
|
4e62ec |
+++ libjava/include/i386-signal.h 2006-04-21 14:57:55.000000000 +0200
|
|
|
4e62ec |
@@ -22,19 +22,7 @@ details. */
|
|
|
4e62ec |
#define SIGNAL_HANDLER(_name) \
|
|
|
4e62ec |
static void _name (int _dummy)
|
|
|
4e62ec |
|
|
|
4e62ec |
-#define MAKE_THROW_FRAME(_exception) \
|
|
|
4e62ec |
-do \
|
|
|
4e62ec |
-{ \
|
|
|
4e62ec |
- void **_p = (void **)&_dummy; \
|
|
|
4e62ec |
- struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p; \
|
|
|
4e62ec |
- \
|
|
|
4e62ec |
- /* Advance the program counter so that it is after the start of the \
|
|
|
4e62ec |
- instruction: the x86 exception handler expects \
|
|
|
4e62ec |
- the PC to point to the instruction after a call. */ \
|
|
|
4e62ec |
- _regs->eip += 2; \
|
|
|
4e62ec |
- \
|
|
|
4e62ec |
-} \
|
|
|
4e62ec |
-while (0)
|
|
|
4e62ec |
+#define MAKE_THROW_FRAME(_exception)
|
|
|
4e62ec |
|
|
|
4e62ec |
#define HANDLE_DIVIDE_OVERFLOW \
|
|
|
4e62ec |
do \
|
|
|
4e62ec |
@@ -84,14 +72,6 @@ do \
|
|
|
4e62ec |
_regs->eip = (unsigned long)_eip; \
|
|
|
4e62ec |
return; \
|
|
|
4e62ec |
} \
|
|
|
4e62ec |
- else \
|
|
|
4e62ec |
- { \
|
|
|
4e62ec |
- /* Advance the program counter so that it is after the start \
|
|
|
4e62ec |
- of the instruction: this is because the x86 exception \
|
|
|
4e62ec |
- handler expects the PC to point to the instruction after a \
|
|
|
4e62ec |
- call. */ \
|
|
|
4e62ec |
- _regs->eip += 2; \
|
|
|
4e62ec |
- } \
|
|
|
4e62ec |
} \
|
|
|
4e62ec |
} \
|
|
|
4e62ec |
while (0)
|
|
|
4e62ec |
--- libjava/include/x86_64-signal.h.jj 2006-04-20 17:02:27.000000000 +0200
|
|
|
4e62ec |
+++ libjava/include/x86_64-signal.h 2006-04-21 14:00:19.000000000 +0200
|
|
|
4e62ec |
@@ -34,17 +34,7 @@ extern "C"
|
|
|
4e62ec |
};
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
-#define MAKE_THROW_FRAME(_exception) \
|
|
|
4e62ec |
-do \
|
|
|
4e62ec |
-{ \
|
|
|
4e62ec |
- /* Advance the program counter so that it is after the start of the \
|
|
|
4e62ec |
- instruction: the x86_64 exception handler expects \
|
|
|
4e62ec |
- the PC to point to the instruction after a call. */ \
|
|
|
4e62ec |
- struct ucontext *_uc = (struct ucontext *)_p; \
|
|
|
4e62ec |
- volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
|
|
|
4e62ec |
- _sc->rip += 2; \
|
|
|
4e62ec |
-} \
|
|
|
4e62ec |
-while (0)
|
|
|
4e62ec |
+#define MAKE_THROW_FRAME(_exception)
|
|
|
4e62ec |
|
|
|
4e62ec |
#define RESTORE(name, syscall) RESTORE2 (name, syscall)
|
|
|
4e62ec |
#define RESTORE2(name, syscall) \
|
|
|
4e62ec |
--- libjava/include/powerpc-signal.h.jj 2005-11-21 14:47:15.000000000 +0100
|
|
|
4e62ec |
+++ libjava/include/powerpc-signal.h 2006-04-21 14:00:19.000000000 +0200
|
|
|
4e62ec |
@@ -22,18 +22,12 @@ details. */
|
|
|
4e62ec |
#define SIGNAL_HANDLER(_name) \
|
|
|
4e62ec |
static void _name (int /* _signal */, struct sigcontext *_sc)
|
|
|
4e62ec |
|
|
|
4e62ec |
-/* PPC either leaves PC pointing at a faulting instruction or the
|
|
|
4e62ec |
- following instruction, depending on the signal. SEGV always does
|
|
|
4e62ec |
- the former, so we adjust the saved PC to point to the following
|
|
|
4e62ec |
- instruction. This is what the handler in libgcc expects. */
|
|
|
4e62ec |
+/* MD_FALBACK_FRAME_STATE_FOR takes care of special casing PC
|
|
|
4e62ec |
+ before the faulting instruction, so we don't need to do anything
|
|
|
4e62ec |
+ here. */
|
|
|
4e62ec |
+
|
|
|
4e62ec |
+#define MAKE_THROW_FRAME(_exception)
|
|
|
4e62ec |
|
|
|
4e62ec |
-#define MAKE_THROW_FRAME(_exception) \
|
|
|
4e62ec |
-do \
|
|
|
4e62ec |
- { \
|
|
|
4e62ec |
- _sc->regs->nip += 4; \
|
|
|
4e62ec |
- } \
|
|
|
4e62ec |
-while (0)
|
|
|
4e62ec |
-
|
|
|
4e62ec |
/* For an explanation why we cannot simply use sigaction to
|
|
|
4e62ec |
install the handlers, see i386-signal.h. */
|
|
|
4e62ec |
|
|
|
4e62ec |
--- libstdc++-v3/libsupc++/eh_personality.cc.jj 2005-11-21 14:43:32.000000000 +0100
|
|
|
4e62ec |
+++ libstdc++-v3/libsupc++/eh_personality.cc 2006-04-21 14:24:34.000000000 +0200
|
|
|
4e62ec |
@@ -201,6 +201,7 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
_Unwind_Ptr landing_pad, ip;
|
|
|
4e62ec |
int handler_switch_value;
|
|
|
4e62ec |
void *thrown_ptr = xh + 1;
|
|
|
4e62ec |
+ int ip_before_insn = 0;
|
|
|
4e62ec |
|
|
|
4e62ec |
// Interface version check.
|
|
|
4e62ec |
if (version != 1)
|
|
|
4e62ec |
@@ -227,7 +228,9 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
// Parse the LSDA header.
|
|
|
4e62ec |
p = parse_lsda_header (context, language_specific_data, &info;;
|
|
|
4e62ec |
info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
|
|
|
4e62ec |
- ip = _Unwind_GetIP (context) - 1;
|
|
|
4e62ec |
+ ip = _Unwind_GetIPInfo (context, &ip_before_insn);
|
|
|
4e62ec |
+ if (! ip_before_insn)
|
|
|
4e62ec |
+ --ip;
|
|
|
4e62ec |
landing_pad = 0;
|
|
|
4e62ec |
action_record = 0;
|
|
|
4e62ec |
handler_switch_value = 0;
|
|
|
4e62ec |
--- gcc/libgcc-std.ver.jj 2005-11-21 14:43:21.000000000 +0100
|
|
|
4e62ec |
+++ gcc/libgcc-std.ver 2006-04-21 14:02:13.000000000 +0200
|
|
|
4e62ec |
@@ -234,3 +234,8 @@ GCC_3.4.4 {
|
|
|
4e62ec |
__negvti2
|
|
|
4e62ec |
__subvti3
|
|
|
4e62ec |
}
|
|
|
4e62ec |
+
|
|
|
4e62ec |
+%inherit GCC_4.2.0 GCC_3.4.4
|
|
|
4e62ec |
+GCC_4.2.0 {
|
|
|
4e62ec |
+ _Unwind_GetIPInfo
|
|
|
4e62ec |
+}
|
|
|
4e62ec |
--- gcc/unwind-c.c.jj 2005-11-21 14:43:20.000000000 +0100
|
|
|
4e62ec |
+++ gcc/unwind-c.c 2006-04-21 14:00:08.000000000 +0200
|
|
|
4e62ec |
@@ -102,6 +102,7 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
lsda_header_info info;
|
|
|
4e62ec |
const unsigned char *language_specific_data, *p, *action_record;
|
|
|
4e62ec |
_Unwind_Ptr landing_pad, ip;
|
|
|
4e62ec |
+ int ip_before_insn = 0;
|
|
|
4e62ec |
|
|
|
4e62ec |
if (version != 1)
|
|
|
4e62ec |
return _URC_FATAL_PHASE1_ERROR;
|
|
|
4e62ec |
@@ -119,7 +120,9 @@ PERSONALITY_FUNCTION (int version,
|
|
|
4e62ec |
|
|
|
4e62ec |
/* Parse the LSDA header. */
|
|
|
4e62ec |
p = parse_lsda_header (context, language_specific_data, &info;;
|
|
|
4e62ec |
- ip = _Unwind_GetIP (context) - 1;
|
|
|
4e62ec |
+ ip = _Unwind_GetIPInfo (context, &ip_before_insn);
|
|
|
4e62ec |
+ if (! ip_before_insn)
|
|
|
4e62ec |
+ --ip;
|
|
|
4e62ec |
landing_pad = 0;
|
|
|
4e62ec |
|
|
|
4e62ec |
#ifdef __USING_SJLJ_EXCEPTIONS__
|
|
|
4e62ec |
--- gcc/config/rs6000/linux-unwind.h.jj 2005-11-21 14:41:11.000000000 +0100
|
|
|
4e62ec |
+++ gcc/config/rs6000/linux-unwind.h 2006-04-21 14:23:09.000000000 +0200
|
|
|
4e62ec |
@@ -247,6 +247,7 @@ enum { SIGNAL_FRAMESIZE = 64 };
|
|
|
4e62ec |
(FS)->regs.reg[ARG_POINTER_REGNUM].loc.offset \
|
|
|
4e62ec |
= (long) ®s->nip - new_cfa; \
|
|
|
4e62ec |
(FS)->retaddr_column = ARG_POINTER_REGNUM; \
|
|
|
4e62ec |
+ (FS)->signal_frame = 1; \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
if (hwcap == 0) \
|
|
|
4e62ec |
{ \
|
|
|
4e62ec |
--- gcc/config/s390/linux.h.jj 2005-11-21 14:40:55.000000000 +0100
|
|
|
4e62ec |
+++ gcc/config/s390/linux.h 2006-04-21 14:15:46.000000000 +0200
|
|
|
4e62ec |
@@ -113,6 +113,7 @@ Software Foundation, 59 Temple Place - S
|
|
|
4e62ec |
} __attribute__ ((__aligned__ (8))) sigregs_; \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
sigregs_ *regs_; \
|
|
|
4e62ec |
+ int *signo_ = NULL; \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
/* svc $__NR_sigreturn or svc $__NR_rt_sigreturn */ \
|
|
|
4e62ec |
if (pc_[0] != 0x0a || (pc_[1] != 119 && pc_[1] != 173)) \
|
|
|
4e62ec |
@@ -133,6 +134,7 @@ Software Foundation, 59 Temple Place - S
|
|
|
4e62ec |
} *uc_ = (CONTEXT)->cfa + 8 + 128; \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
regs_ = &uc_->uc_mcontext; \
|
|
|
4e62ec |
+ signo_ = (CONTEXT)->cfa + sizeof(long); \
|
|
|
4e62ec |
} \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
/* Old-style RT frame and all non-RT frames: \
|
|
|
4e62ec |
@@ -141,6 +143,11 @@ Software Foundation, 59 Temple Place - S
|
|
|
4e62ec |
else \
|
|
|
4e62ec |
{ \
|
|
|
4e62ec |
regs_ = *(sigregs_ **)((CONTEXT)->cfa + 8); \
|
|
|
4e62ec |
+ /* Recent kernels store the signal number immediately after \
|
|
|
4e62ec |
+ the sigregs; old kernels have the return trampoline at \
|
|
|
4e62ec |
+ this location. */ \
|
|
|
4e62ec |
+ if ((void *)(regs_ + 1) != (CONTEXT)->ra) \
|
|
|
4e62ec |
+ signo_ = (int *)(regs_ + 1); \
|
|
|
4e62ec |
} \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
new_cfa_ = regs_->gprs[15] + 16*sizeof(long) + 32; \
|
|
|
4e62ec |
@@ -167,6 +174,12 @@ Software Foundation, 59 Temple Place - S
|
|
|
4e62ec |
(FS)->regs.reg[32].loc.offset = (long)®s_->psw_addr - new_cfa_; \
|
|
|
4e62ec |
(FS)->retaddr_column = 32; \
|
|
|
4e62ec |
\
|
|
|
4e62ec |
+ /* SIGILL, SIGFPE and SIGTRAP are delivered with psw_addr \
|
|
|
4e62ec |
+ after the faulting instruction rather than before it. \
|
|
|
4e62ec |
+ Don't set FS->signal_frame in that case. */ \
|
|
|
4e62ec |
+ if (!signo_ || (*signo_ != 4 && *signo_ != 5 && *signo_ != 8)) \
|
|
|
4e62ec |
+ (FS)->signal_frame = 1; \
|
|
|
4e62ec |
+ \
|
|
|
4e62ec |
goto SUCCESS; \
|
|
|
4e62ec |
} while (0)
|
|
|
4e62ec |
|
|
|
4e62ec |
--- gcc/config/i386/linux.h.jj 2005-11-21 14:41:07.000000000 +0100
|
|
|
4e62ec |
+++ gcc/config/i386/linux.h 2006-04-21 14:18:05.000000000 +0200
|
|
|
4e62ec |
@@ -268,6 +268,7 @@ Boston, MA 02111-1307, USA. */
|
|
|
4e62ec |
(FS)->regs.reg[8].how = REG_SAVED_OFFSET; \
|
|
|
4e62ec |
(FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_; \
|
|
|
4e62ec |
(FS)->retaddr_column = 8; \
|
|
|
4e62ec |
+ (FS)->signal_frame = 1; \
|
|
|
4e62ec |
goto SUCCESS; \
|
|
|
4e62ec |
} while (0)
|
|
|
4e62ec |
#endif /* not USE_GNULIBC_1 */
|
|
|
4e62ec |
--- gcc/config/i386/linux64.h.jj 2005-11-21 14:41:07.000000000 +0100
|
|
|
4e62ec |
+++ gcc/config/i386/linux64.h 2006-04-21 14:18:45.000000000 +0200
|
|
|
4e62ec |
@@ -136,6 +136,7 @@ Boston, MA 02111-1307, USA. */
|
|
|
4e62ec |
(FS)->regs.reg[16].how = REG_SAVED_OFFSET; \
|
|
|
4e62ec |
(FS)->regs.reg[16].loc.offset = (long)&sc_->rip - new_cfa_; \
|
|
|
4e62ec |
(FS)->retaddr_column = 16; \
|
|
|
4e62ec |
+ (FS)->signal_frame = 1; \
|
|
|
4e62ec |
goto SUCCESS; \
|
|
|
4e62ec |
} while (0)
|
|
|
4e62ec |
#else /* ifdef __x86_64__ */
|
|
|
4e62ec |
@@ -190,6 +191,7 @@ Boston, MA 02111-1307, USA. */
|
|
|
4e62ec |
(FS)->regs.reg[8].how = REG_SAVED_OFFSET; \
|
|
|
4e62ec |
(FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_; \
|
|
|
4e62ec |
(FS)->retaddr_column = 8; \
|
|
|
4e62ec |
+ (FS)->signal_frame = 1; \
|
|
|
4e62ec |
goto SUCCESS; \
|
|
|
4e62ec |
} while (0)
|
|
|
4e62ec |
#endif /* ifdef __x86_64__ */
|
|
|
4e62ec |
--- gcc/config/ia64/unwind-ia64.c.jj 2005-11-21 14:40:57.000000000 +0100
|
|
|
4e62ec |
+++ gcc/config/ia64/unwind-ia64.c 2006-04-21 14:00:11.000000000 +0200
|
|
|
4e62ec |
@@ -1748,6 +1748,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
|
|
|
4e62ec |
return context->rp;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
+inline _Unwind_Ptr
|
|
|
4e62ec |
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
|
|
4e62ec |
+{
|
|
|
4e62ec |
+ *ip_before_insn = 0;
|
|
|
4e62ec |
+ return context->rp;
|
|
|
4e62ec |
+}
|
|
|
4e62ec |
+
|
|
|
4e62ec |
/* Overwrite the return address for CONTEXT with VAL. */
|
|
|
4e62ec |
|
|
|
4e62ec |
inline void
|
|
|
4e62ec |
--- gcc/unwind-compat.c.jj 2005-11-21 14:43:20.000000000 +0100
|
|
|
4e62ec |
+++ gcc/unwind-compat.c 2006-04-21 13:59:59.000000000 +0200
|
|
|
4e62ec |
@@ -134,6 +134,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
|
|
|
4e62ec |
}
|
|
|
4e62ec |
symver (_Unwind_GetIP, GCC_3.0);
|
|
|
4e62ec |
|
|
|
4e62ec |
+_Unwind_Ptr
|
|
|
4e62ec |
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
|
|
4e62ec |
+{
|
|
|
4e62ec |
+ *ip_before_insn = 0;
|
|
|
4e62ec |
+ return __libunwind_Unwind_GetIP (context);
|
|
|
4e62ec |
+}
|
|
|
4e62ec |
+
|
|
|
4e62ec |
extern void *__libunwind_Unwind_GetLanguageSpecificData
|
|
|
4e62ec |
(struct _Unwind_Context *);
|
|
|
4e62ec |
|
|
|
4e62ec |
--- gcc/unwind-sjlj.c.jj 2005-11-21 14:43:21.000000000 +0100
|
|
|
4e62ec |
+++ gcc/unwind-sjlj.c 2006-04-21 14:00:08.000000000 +0200
|
|
|
4e62ec |
@@ -202,6 +202,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
|
|
|
4e62ec |
return context->fc->call_site + 1;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
+_Unwind_Ptr
|
|
|
4e62ec |
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
|
|
4e62ec |
+{
|
|
|
4e62ec |
+ *ip_before_insn = 0;
|
|
|
4e62ec |
+ return context->fc->call_site + 1;
|
|
|
4e62ec |
+}
|
|
|
4e62ec |
+
|
|
|
4e62ec |
/* Set the return landing pad index in CONTEXT. */
|
|
|
4e62ec |
|
|
|
4e62ec |
void
|
|
|
4e62ec |
--- gcc/unwind.h.jj 2005-11-21 14:43:20.000000000 +0100
|
|
|
4e62ec |
+++ gcc/unwind.h 2006-04-21 14:08:51.000000000 +0200
|
|
|
4e62ec |
@@ -151,6 +151,7 @@ extern _Unwind_Word _Unwind_GetGR (struc
|
|
|
4e62ec |
extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
|
|
|
4e62ec |
|
|
|
4e62ec |
extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
|
|
|
4e62ec |
+extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
|
|
|
4e62ec |
extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
|
|
|
4e62ec |
|
|
|
4e62ec |
/* @@@ Retrieve the CFA of the given context. */
|
|
|
4e62ec |
--- gcc/unwind-dw2.c.jj 2005-11-21 14:43:21.000000000 +0100
|
|
|
4e62ec |
+++ gcc/unwind-dw2.c 2006-04-21 14:05:32.000000000 +0200
|
|
|
4e62ec |
@@ -82,6 +82,7 @@ struct _Unwind_Context
|
|
|
4e62ec |
void *lsda;
|
|
|
4e62ec |
struct dwarf_eh_bases bases;
|
|
|
4e62ec |
_Unwind_Word args_size;
|
|
|
4e62ec |
+ char signal_frame;
|
|
|
4e62ec |
};
|
|
|
4e62ec |
|
|
|
4e62ec |
/* Byte size of every register managed by these routines. */
|
|
|
4e62ec |
@@ -137,6 +138,7 @@ typedef struct
|
|
|
4e62ec |
unsigned char fde_encoding;
|
|
|
4e62ec |
unsigned char lsda_encoding;
|
|
|
4e62ec |
unsigned char saw_z;
|
|
|
4e62ec |
+ unsigned char signal_frame;
|
|
|
4e62ec |
void *eh_ptr;
|
|
|
4e62ec |
} _Unwind_FrameState;
|
|
|
4e62ec |
|
|
|
4e62ec |
@@ -271,6 +273,16 @@ _Unwind_GetIP (struct _Unwind_Context *c
|
|
|
4e62ec |
return (_Unwind_Ptr) context->ra;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
+/* Retrieve the return address and flag whether that IP is before
|
|
|
4e62ec |
+ or after first not yet fully executed instruction. */
|
|
|
4e62ec |
+
|
|
|
4e62ec |
+inline _Unwind_Ptr
|
|
|
4e62ec |
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
|
|
4e62ec |
+{
|
|
|
4e62ec |
+ *ip_before_insn = context->signal_frame != 0;
|
|
|
4e62ec |
+ return (_Unwind_Ptr) context->ra;
|
|
|
4e62ec |
+}
|
|
|
4e62ec |
+
|
|
|
4e62ec |
/* Overwrite the return address for CONTEXT with VAL. */
|
|
|
4e62ec |
|
|
|
4e62ec |
inline void
|
|
|
4e62ec |
@@ -382,6 +394,13 @@ extract_cie_info (const struct dwarf_cie
|
|
|
4e62ec |
aug += 1;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
+ /* "S" indicates a signal frame. */
|
|
|
4e62ec |
+ else if (aug[0] == 'S')
|
|
|
4e62ec |
+ {
|
|
|
4e62ec |
+ fs->signal_frame = 1;
|
|
|
4e62ec |
+ aug += 1;
|
|
|
4e62ec |
+ }
|
|
|
4e62ec |
+
|
|
|
4e62ec |
/* Otherwise we have an unknown augmentation string.
|
|
|
4e62ec |
Bail unless we saw a 'z' prefix. */
|
|
|
4e62ec |
else
|
|
|
4e62ec |
@@ -818,8 +837,10 @@ execute_cfa_program (const unsigned char
|
|
|
4e62ec |
a different stack configuration that we are not interested in. We
|
|
|
4e62ec |
assume that the call itself is unwind info-neutral; if not, or if
|
|
|
4e62ec |
there are delay instructions that adjust the stack, these must be
|
|
|
4e62ec |
- reflected at the point immediately before the call insn. */
|
|
|
4e62ec |
- while (insn_ptr < insn_end && fs->pc < context->ra)
|
|
|
4e62ec |
+ reflected at the point immediately before the call insn.
|
|
|
4e62ec |
+ In signal frames, return address is after last completed instruction,
|
|
|
4e62ec |
+ so we add 1 to return address to make the comparison <=. */
|
|
|
4e62ec |
+ while (insn_ptr < insn_end && fs->pc < context->ra + context->signal_frame)
|
|
|
4e62ec |
{
|
|
|
4e62ec |
unsigned char insn = *insn_ptr++;
|
|
|
4e62ec |
_Unwind_Word reg, utmp;
|
|
|
4e62ec |
@@ -1021,7 +1042,8 @@ uw_frame_state_for (struct _Unwind_Conte
|
|
|
4e62ec |
if (context->ra == 0)
|
|
|
4e62ec |
return _URC_END_OF_STACK;
|
|
|
4e62ec |
|
|
|
4e62ec |
- fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
|
|
|
4e62ec |
+ fde = _Unwind_Find_FDE (context->ra + context->signal_frame - 1,
|
|
|
4e62ec |
+ &context->bases);
|
|
|
4e62ec |
if (fde == NULL)
|
|
|
4e62ec |
{
|
|
|
4e62ec |
/* Couldn't find frame unwind info for this function. Try a
|
|
|
4e62ec |
@@ -1376,6 +1398,8 @@ uw_update_context_1 (struct _Unwind_Cont
|
|
|
4e62ec |
break;
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|
|
|
4e62ec |
+ context->signal_frame = fs->signal_frame;
|
|
|
4e62ec |
+
|
|
|
4e62ec |
MD_FROB_UPDATE_CONTEXT (context, fs);
|
|
|
4e62ec |
}
|
|
|
4e62ec |
|