unwind-dw2-fde-glibc.c (base_from_cb_data, [...]): Use gcc_assert and gcc_unreachable as appropriate.

* unwind-dw2-fde-glibc.c (base_from_cb_data,
	_Unwind_IteratePhdrCallback): Use gcc_assert and gcc_unreachable as
	appropriate.
	* unwind-dw2-fde.c (__deregister_frame_info_bases,
	base_from_object, fde_split, end_fde_sort): Likewise.
	* unwind-dw2.c (_Unwind_GetGR, _Unwind_SetGR, execute_stack_op,
	execute_cfa_program, _Unwind_SetSpColumn, uw_update_context_1,
	uw_init_context_1): Likewise.
	* unwind.inc (_Unwind_RaiseException_Phase2, _Unwind_Resume,
	_Unwind_Resume_or_Rethrow): Likewise.
	* unwind-pe.h (__gxx_abort): Do not define.
	(size_of_encoded_value, base_of_encoded_value,
	read_encoded_value_with_base): Use gcc_unreachable.
	* unwind.h (_Unwind_GetTextRelBase): Likewise.

From-SVN: r99835
This commit is contained in:
Nathan Sidwell 2005-05-17 15:37:47 +00:00 committed by Nathan Sidwell
parent d0f11b1653
commit 79d0dfa314
11 changed files with 93 additions and 88 deletions

View File

@ -1,3 +1,20 @@
2005-05-17 Nathan Sidwell <nathan@codesourcery.com>
* unwind-dw2-fde-glibc.c (base_from_cb_data,
_Unwind_IteratePhdrCallback): Use gcc_assert and gcc_unreachable as
appropriate.
* unwind-dw2-fde.c (__deregister_frame_info_bases,
base_from_object, fde_split, end_fde_sort): Likewise.
* unwind-dw2.c (_Unwind_GetGR, _Unwind_SetGR, execute_stack_op,
execute_cfa_program, _Unwind_SetSpColumn, uw_update_context_1,
uw_init_context_1): Likewise.
* unwind.inc (_Unwind_RaiseException_Phase2, _Unwind_Resume,
_Unwind_Resume_or_Rethrow): Likewise.
* unwind-pe.h (__gxx_abort): Do not define.
(size_of_encoded_value, base_of_encoded_value,
read_encoded_value_with_base): Use gcc_unreachable.
* unwind.h (_Unwind_GetTextRelBase): Likewise.
2005-05-17 Daniel Jacobowitz <dan@codesourcery.com>
* config/arm/lib1funcs.asm (cfi_pop, cfi_push, cfi_start)

View File

@ -118,8 +118,9 @@ base_from_cb_data (unsigned char encoding, struct unw_eh_callback_data *data)
return (_Unwind_Ptr) data->tbase;
case DW_EH_PE_datarel:
return (_Unwind_Ptr) data->dbase;
default:
gcc_unreachable ();
}
abort ();
}
static int
@ -358,8 +359,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
break;
}
if (lo >= hi)
__gxx_abort ();
gcc_assert (lo < hi);
}
f = (fde *) (table[mid].fde + data_base);

View File

@ -164,7 +164,7 @@ __register_frame_table (void *begin)
from crtbegin (wherein it is declared weak), and this object does
not get pulled from libgcc.a for other reasons, then the
invocation of __deregister_frame_info will be resolved from glibc.
Since the registration did not happen there, we'll abort.
Since the registration did not happen there, we'll die.
Therefore, declare a new deregistration entry point that does the
exact same thing, but will resolve to the same library as
@ -212,11 +212,9 @@ __deregister_frame_info_bases (const void *begin)
}
}
__gthread_mutex_unlock (&object_mutex);
abort ();
out:
__gthread_mutex_unlock (&object_mutex);
gcc_assert (ob);
return (void *) ob;
}
@ -255,8 +253,9 @@ base_from_object (unsigned char encoding, struct object *ob)
return (_Unwind_Ptr) ob->tbase;
case DW_EH_PE_datarel:
return (_Unwind_Ptr) ob->dbase;
default:
gcc_unreachable ();
}
abort ();
}
/* Return the FDE pointer encoding from the CIE. */
@ -441,8 +440,7 @@ fde_split (struct object *ob, fde_compare_t fde_compare,
/* This should optimize out, but it is wise to make sure this assumption
is correct. Should these have different sizes, we cannot cast between
them and the overlaying onto ERRATIC will not work. */
if (sizeof (const fde *) != sizeof (const fde **))
abort ();
gcc_assert (sizeof (const fde *) == sizeof (const fde **));
for (i = 0; i < count; i++)
{
@ -566,8 +564,7 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
{
fde_compare_t fde_compare;
if (accu->linear && accu->linear->count != count)
abort ();
gcc_assert (!accu->linear || accu->linear->count == count);
if (ob->s.b.mixed_encoding)
fde_compare = fde_mixed_encoding_compare;
@ -579,8 +576,7 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
if (accu->erratic)
{
fde_split (ob, fde_compare, accu->linear, accu->erratic);
if (accu->linear->count + accu->erratic->count != count)
abort ();
gcc_assert (accu->linear->count + accu->erratic->count == count);
frame_heapsort (ob, fde_compare, accu->erratic);
fde_merge (ob, fde_compare, accu->linear, accu->erratic);
free (accu->erratic);

View File

@ -131,19 +131,18 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index)
#endif
index = DWARF_REG_TO_UNWIND_COLUMN (index);
if (index >= (int) sizeof(dwarf_reg_size_table))
abort ();
gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
size = dwarf_reg_size_table[index];
ptr = context->reg[index];
/* This will segfault if the register hasn't been saved. */
if (size == sizeof(_Unwind_Ptr))
return * (_Unwind_Ptr *) ptr;
if (size == sizeof(_Unwind_Word))
return * (_Unwind_Word *) ptr;
abort ();
else
{
gcc_assert (size == sizeof(_Unwind_Word));
return * (_Unwind_Word *) ptr;
}
}
static inline void *
@ -169,17 +168,17 @@ _Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
void *ptr;
index = DWARF_REG_TO_UNWIND_COLUMN (index);
if (index >= (int) sizeof(dwarf_reg_size_table))
abort ();
gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
size = dwarf_reg_size_table[index];
ptr = context->reg[index];
if (size == sizeof(_Unwind_Ptr))
* (_Unwind_Ptr *) ptr = val;
else if (size == sizeof(_Unwind_Word))
* (_Unwind_Word *) ptr = val;
else
abort ();
{
gcc_assert (size == sizeof(_Unwind_Word));
* (_Unwind_Word *) ptr = val;
}
}
/* Get the pointer to a register INDEX as saved in CONTEXT. */
@ -518,26 +517,23 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
break;
case DW_OP_dup:
if (stack_elt < 1)
abort ();
gcc_assert (stack_elt);
result = stack[stack_elt - 1];
break;
case DW_OP_drop:
if (--stack_elt < 0)
abort ();
gcc_assert (stack_elt);
stack_elt -= 1;
goto no_push;
case DW_OP_pick:
offset = *op_ptr++;
if (offset >= stack_elt - 1)
abort ();
gcc_assert (offset < stack_elt - 1);
result = stack[stack_elt - 1 - offset];
break;
case DW_OP_over:
if (stack_elt < 2)
abort ();
gcc_assert (stack_elt >= 2);
result = stack[stack_elt - 2];
break;
@ -545,8 +541,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
{
_Unwind_Word t1, t2, t3;
if (stack_elt < 3)
abort ();
gcc_assert (stack_elt >= 3);
t1 = stack[stack_elt - 1];
t2 = stack[stack_elt - 2];
t3 = stack[stack_elt - 3];
@ -563,8 +558,9 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
case DW_OP_not:
case DW_OP_plus_uconst:
/* Unary operations. */
if (--stack_elt < 0)
abort ();
gcc_assert (stack_elt);
stack_elt -= 1;
result = stack[stack_elt];
switch (op)
@ -594,7 +590,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
result = read_8u (ptr);
break;
default:
abort ();
gcc_unreachable ();
}
}
break;
@ -615,7 +611,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
break;
default:
abort ();
gcc_unreachable ();
}
break;
@ -639,8 +635,9 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
{
/* Binary operations. */
_Unwind_Word first, second;
if ((stack_elt -= 2) < 0)
abort ();
gcc_assert (stack_elt >= 2);
stack_elt -= 2;
second = stack[stack_elt];
first = stack[stack_elt + 1];
@ -699,7 +696,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
break;
default:
abort ();
gcc_unreachable ();
}
}
break;
@ -711,8 +708,9 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
goto no_push;
case DW_OP_bra:
if (--stack_elt < 0)
abort ();
gcc_assert (stack_elt);
stack_elt -= 1;
offset = read_2s (op_ptr);
op_ptr += 2;
if (stack[stack_elt] != 0)
@ -723,20 +721,19 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
goto no_push;
default:
abort ();
gcc_unreachable ();
}
/* Most things push a result value. */
if ((size_t) stack_elt >= sizeof(stack)/sizeof(*stack))
abort ();
gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack));
stack[stack_elt++] = result;
no_push:;
}
/* We were executing this program to get a value. It should be
at top of stack. */
if (--stack_elt < 0)
abort ();
gcc_assert (stack_elt);
stack_elt -= 1;
return stack[stack_elt];
}
@ -944,7 +941,7 @@ execute_cfa_program (const unsigned char *insn_ptr,
break;
default:
abort ();
gcc_unreachable ();
}
}
}
@ -1088,10 +1085,11 @@ _Unwind_SetSpColumn (struct _Unwind_Context *context, void *cfa,
if (size == sizeof(_Unwind_Ptr))
tmp_sp->ptr = (_Unwind_Ptr) cfa;
else if (size == sizeof(_Unwind_Word))
tmp_sp->word = (_Unwind_Ptr) cfa;
else
abort ();
{
gcc_assert (size == sizeof(_Unwind_Word));
tmp_sp->word = (_Unwind_Ptr) cfa;
}
_Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp);
}
@ -1145,7 +1143,7 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
}
default:
abort ();
gcc_unreachable ();
}
context->cfa = cfa;
@ -1229,12 +1227,13 @@ uw_init_context_1 (struct _Unwind_Context *context,
void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
_Unwind_FrameState fs;
_Unwind_SpTmp sp_slot;
_Unwind_Reason_Code code;
memset (context, 0, sizeof (struct _Unwind_Context));
context->ra = ra;
if (uw_frame_state_for (context, &fs) != _URC_NO_REASON)
abort ();
code = uw_frame_state_for (context, &fs);
gcc_assert (code == _URC_NO_REASON);
#if __GTHREADS
{

View File

@ -34,13 +34,6 @@
#ifndef GCC_UNWIND_PE_H
#define GCC_UNWIND_PE_H
/* If using C++, references to abort have to be qualified with std::. */
#if __cplusplus
#define __gxx_abort std::abort
#else
#define __gxx_abort abort
#endif
/* Pointer encodings, from dwarf2.h. */
#define DW_EH_PE_absptr 0x00
#define DW_EH_PE_omit 0xff
@ -86,8 +79,9 @@ size_of_encoded_value (unsigned char encoding)
return 4;
case DW_EH_PE_udata8:
return 8;
default:
gcc_unreachable ();
}
__gxx_abort ();
}
#endif
@ -118,8 +112,9 @@ base_of_encoded_value (unsigned char encoding, struct _Unwind_Context *context)
return _Unwind_GetDataRelBase (context);
case DW_EH_PE_funcrel:
return _Unwind_GetRegionStart (context);
default:
gcc_unreachable ();
}
__gxx_abort ();
}
#endif
@ -256,7 +251,7 @@ read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
break;
default:
__gxx_abort ();
gcc_unreachable ();
}
if (result != 0)

View File

@ -214,8 +214,7 @@ _Unwind_GetDataRelBase (struct _Unwind_Context *_C)
static inline _Unwind_Ptr
_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__)))
{
abort ();
return 0;
gcc_unreachable ();
}
/* @@@ Retrieve the Backing Store Pointer of the given context. */

View File

@ -72,8 +72,7 @@ _Unwind_RaiseException_Phase2(struct _Unwind_Exception *exc,
}
/* Don't let us unwind past the handler context. */
if (match_handler)
abort ();
gcc_assert (!match_handler);
uw_update_context (context, &fs);
}
@ -144,8 +143,8 @@ _Unwind_RaiseException(struct _Unwind_Exception *exc)
/* Subroutine of _Unwind_ForcedUnwind also invoked from _Unwind_Resume. */
static _Unwind_Reason_Code
_Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc,
struct _Unwind_Context *context)
_Unwind_ForcedUnwind_Phase2 (struct _Unwind_Exception *exc,
struct _Unwind_Context *context)
{
_Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1;
void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2;
@ -235,8 +234,7 @@ _Unwind_Resume (struct _Unwind_Exception *exc)
else
code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
if (code != _URC_INSTALL_CONTEXT)
abort ();
gcc_assert (code == _URC_INSTALL_CONTEXT);
uw_install_context (&this_context, &cur_context);
}
@ -261,8 +259,7 @@ _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
if (code != _URC_INSTALL_CONTEXT)
abort ();
gcc_assert (code == _URC_INSTALL_CONTEXT);
uw_install_context (&this_context, &cur_context);
}

View File

@ -1,3 +1,8 @@
2005-05-17 Nathan Sidwell <nathan@codesourcery.com>
* exception.cc (abort): Remove std::abort hack.
(gcc_unreacheable): Define.
2005-05-17 Paolo Bonzini <bonzini@gnu.org>
* Makefile.am (Makefile.deps): Do not create native.list and

View File

@ -19,17 +19,9 @@ details. */
#include <gcj/cni.h>
#include <jvm.h>
// unwind-pe.h uses std::abort(), but sometimes we compile libjava
// without libstdc++-v3. The following hack forces it to use
// stdlib.h's abort().
namespace std
{
static __attribute__ ((__noreturn__)) void
abort ()
{
::abort ();
}
}
// Sometimes we compile libjava without libstdc++-v3. Therefore make
// sure we use stdlib.h's abort().
#define gcc_unreachable() ::abort ()
#include "unwind.h"
struct alignment_test_struct

View File

@ -1,3 +1,7 @@
2005-05-17 Nathan Sidwell <nathan@codesourcery.com>
* libsupc++/eh_personality.cc (gcc_unreachable): Define.
2005-05-16 Paolo Carlini <pcarlini@suse.de>
* docs/html/install.html: Update list of required named

View File

@ -35,6 +35,7 @@
using namespace __cxxabiv1;
#define gcc_unreachable() std::abort()
#include "unwind-pe.h"