/* DWARF2 exception handling and frame unwind runtime interface routines.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC.
#include "tsystem.h"
#include "coretypes.h"
#include "tm.h"
-#include "elf/dwarf2.h"
+#include "dwarf2.h"
#include "unwind.h"
#ifdef __USING_SJLJ_EXCEPTIONS__
# define NO_SIZE_OF_ENCODED_VALUE
else if (aug[0] == 'P')
{
_Unwind_Ptr personality;
-
+
p = read_encoded_value (context, *p, p + 1, &personality);
fs->personality = (_Unwind_Personality_Fn) personality;
aug += 1;
/* Unary operations. */
gcc_assert (stack_elt);
stack_elt -= 1;
-
+
result = stack[stack_elt];
switch (op)
_Unwind_Word first, second;
gcc_assert (stack_elt >= 2);
stack_elt -= 2;
-
+
second = stack[stack_elt];
first = stack[stack_elt + 1];
result = second - first;
break;
case DW_OP_mod:
- result = (_Unwind_Sword) second % (_Unwind_Sword) first;
+ result = second % first;
break;
case DW_OP_mul:
result = second * first;
result = second ^ first;
break;
case DW_OP_le:
- result = (_Unwind_Sword) first <= (_Unwind_Sword) second;
+ result = (_Unwind_Sword) second <= (_Unwind_Sword) first;
break;
case DW_OP_ge:
- result = (_Unwind_Sword) first >= (_Unwind_Sword) second;
+ result = (_Unwind_Sword) second >= (_Unwind_Sword) first;
break;
case DW_OP_eq:
- result = (_Unwind_Sword) first == (_Unwind_Sword) second;
+ result = (_Unwind_Sword) second == (_Unwind_Sword) first;
break;
case DW_OP_lt:
- result = (_Unwind_Sword) first < (_Unwind_Sword) second;
+ result = (_Unwind_Sword) second < (_Unwind_Sword) first;
break;
case DW_OP_gt:
- result = (_Unwind_Sword) first > (_Unwind_Sword) second;
+ result = (_Unwind_Sword) second > (_Unwind_Sword) first;
break;
case DW_OP_ne:
- result = (_Unwind_Sword) first != (_Unwind_Sword) second;
+ result = (_Unwind_Sword) second != (_Unwind_Sword) first;
break;
default:
case DW_OP_bra:
gcc_assert (stack_elt);
stack_elt -= 1;
-
+
offset = read_2s (op_ptr);
op_ptr += 2;
if (stack[stack_elt] != 0)
case DW_CFA_set_loc:
{
_Unwind_Ptr pc;
-
+
insn_ptr = read_encoded_value (context, fs->fde_encoding,
insn_ptr, &pc);
fs->pc = (void *) pc;
if (fs->lsda_encoding != DW_EH_PE_omit)
{
_Unwind_Ptr lsda;
-
+
aug = read_encoded_value (context, fs->lsda_encoding, aug, &lsda);
context->lsda = (void *) lsda;
}
_Unwind_SpTmp *tmp_sp)
{
int size = dwarf_reg_size_table[__builtin_dwarf_sp_column ()];
-
+
if (size == sizeof(_Unwind_Ptr))
tmp_sp->ptr = (_Unwind_Ptr) cfa;
else
__builtin_init_dwarf_reg_size_table (dwarf_reg_size_table);
}
-static void
+static void __attribute__((noinline))
uw_init_context_1 (struct _Unwind_Context *context,
void *outer_cfa, void *outer_ra)
{
static inline _Unwind_Ptr
uw_identify_context (struct _Unwind_Context *context)
{
- return _Unwind_GetCFA (context);
+ /* The CFA is not sufficient to disambiguate the context of a function
+ interrupted by a signal before establishing its frame and the context
+ of the signal itself. */
+ if (STACK_GROWS_DOWNWARD)
+ return _Unwind_GetCFA (context) - _Unwind_IsSignalFrame (context);
+ else
+ return _Unwind_GetCFA (context) + _Unwind_IsSignalFrame (context);
}