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