summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Chisnall <dchisnall@pathscale.com>2011-11-25 12:16:58 +0000
committerDavid Chisnall <dchisnall@pathscale.com>2011-11-25 12:16:58 +0000
commitc106344e1ff40b3dc46304a05f1518150b07aa53 (patch)
treead735427cc163dadf685d502c16bed4ee7481cec /src
parentc996267251a83097aa4bac0b350801e92d6fc20a (diff)
downloadlibcxxrt-c106344e1ff40b3dc46304a05f1518150b07aa53.tar.gz
libcxxrt-c106344e1ff40b3dc46304a05f1518150b07aa53.tar.bz2
libcxxrt-c106344e1ff40b3dc46304a05f1518150b07aa53.tar.xz
Finished ARM EH enough that it passes the test suite. Still to do:
properly handle nested cleanups.
Diffstat (limited to 'src')
-rw-r--r--src/dwarf_eh.h4
-rw-r--r--src/exception.cc45
2 files changed, 15 insertions, 34 deletions
diff --git a/src/dwarf_eh.h b/src/dwarf_eh.h
index 02d8a11..52e6369 100644
--- a/src/dwarf_eh.h
+++ b/src/dwarf_eh.h
@@ -193,7 +193,6 @@ static int64_t read_sleb128(dw_eh_ptr_t *data)
static uint64_t read_value(char encoding, dw_eh_ptr_t *data)
{
enum dwarf_data_encoding type = get_encoding(encoding);
- //fprintf(stderr, "Loading (encoding %x) from %p\n", (int)encoding, *data);
uint64_t v;
switch (type)
{
@@ -236,7 +235,6 @@ static uint64_t resolve_indirect_value(_Unwind_Context *c,
int64_t v,
dw_eh_ptr_t start)
{
- //fprintf(stderr, "resolving(encoding %x) from %p\n", (int)get_base(encoding), (void*)(intptr_t)v);
switch (get_base(encoding))
{
case DW_EH_PE_pcrel:
@@ -253,7 +251,6 @@ static uint64_t resolve_indirect_value(_Unwind_Context *c,
default:
break;
}
- //fprintf(stderr, "is indirect %p\n", is_indirect(encoding));
// If this is an indirect value, then it is really the address of the real
// value
// TODO: Check whether this should really always be a pointer - it seems to
@@ -335,7 +332,6 @@ static inline struct dwarf_eh_lsda parse_lsda(_Unwind_Context *context,
// spec says, but does seem to be how G++ indicates this.
lsda.type_table = 0;
lsda.type_table_encoding = *data++;
- //fprintf(stderr, "Type table Encoding: %x\n", (int)lsda.type_table_encoding);
if (lsda.type_table_encoding != DW_EH_PE_omit)
{
v = read_uleb128(&data);
diff --git a/src/exception.cc b/src/exception.cc
index 3b99735..64e78a7 100644
--- a/src/exception.cc
+++ b/src/exception.cc
@@ -656,7 +656,6 @@ extern "C" void __cxa_throw(void *thrown_exception,
std::type_info *tinfo,
void(*dest)(void*))
{
- fprintf(stderr, "Thrown exception: %p\n", thrown_exception);
__cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1;
ex->referenceCount = 1;
@@ -899,19 +898,25 @@ static handler_type check_action_record(_Unwind_Context *context,
}
else if (filter < 0 && 0 != ex)
{
- unsigned char *type_index = ((unsigned char*)lsda->type_table - filter - 1);
bool matched = false;
*selector = filter;
- while (*type_index)
- {
#ifdef __arm__
- //fprintf(stderr, "Filter: %d\n", filter);
- std::type_info *handler_type = handler_type = get_type_info_entry(context, lsda, -filter - 1);
- //fprintf(stderr, "Handler: %p\n", handler_type);
- type_index++;
+ filter++;
+ std::type_info *handler_type = get_type_info_entry(context, lsda, filter--);
+ while (handler_type)
+ {
+ if (check_type_signature(ex, handler_type, adjustedPtr))
+ {
+ matched = true;
+ break;
+ }
+ handler_type = get_type_info_entry(context, lsda, filter--);
+ }
#else
+ unsigned char *type_index = ((unsigned char*)lsda->type_table - filter - 1);
+ while (*type_index)
+ {
std::type_info *handler_type = get_type_info_entry(context, lsda, *(type_index++));
-#endif
// If the exception spec matches a permitted throw type for
// this function, don't report a handler - we are allowed to
// propagate this exception out.
@@ -921,6 +926,7 @@ static handler_type check_action_record(_Unwind_Context *context,
break;
}
}
+#endif
if (matched) { continue; }
// If we don't find an allowed exception spec, we need to install
// the context for this action. The landing pad will then call the
@@ -1084,7 +1090,6 @@ extern "C" void *__cxa_begin_catch(void *e) throw()
extern "C" void *__cxa_begin_catch(void *e)
#endif
{
- fprintf(stderr, "Entering catch\n");
// Decrement the uncaught exceptions count
__cxa_eh_globals *globals = __cxa_get_globals();
globals->uncaughtExceptions--;
@@ -1130,13 +1135,8 @@ extern "C" void *__cxa_begin_catch(void *e)
ex->handlerCount++;
}
- fprintf(stderr, "Exception base pointer: %p\n", ((char*)exceptionObject + sizeof(_Unwind_Exception)));
- fprintf(stderr, "Exception edjusted pointer: %p\n", ex->adjustedPtr);
- fprintf(stderr, "Exception as int: %d\n", *(int*)((char*)exceptionObject + sizeof(_Unwind_Exception)));
-
return ex->adjustedPtr;
}
- fprintf(stderr, "Exception as int: %d\n", *(int*)((char*)exceptionObject + sizeof(_Unwind_Exception)));
// exceptionObject is the pointer to the _Unwind_Exception within the
// __cxa_exception. The throw object is after this
return ((char*)exceptionObject + sizeof(_Unwind_Exception));
@@ -1150,7 +1150,6 @@ extern "C" void *__cxa_begin_catch(void *e)
*/
extern "C" void __cxa_end_catch()
{
- fprintf(stderr, "Leaving catch\n");
// We can call the fast version here because the slow version is called in
// __cxa_throw(), which must have been called before we end a catch block
__cxa_eh_globals *globals = __cxa_get_globals_fast();
@@ -1196,20 +1195,6 @@ extern "C" void __cxa_end_catch()
}
}
-/*
-extern "C" void __cxa_end_cleanup(_Unwind_Exception* exceptionObject)
-{
- _Unwind_Resume(0);
-// fprintf(stderr, "Leaving cleanup\n");
-}
-
-extern "C" bool __cxa_begin_cleanup(_Unwind_Exception* exceptionObject)
-{
- fprintf(stderr, "Entering cleanup\n");
- return true;
-}
-*/
-
/**
* ABI function. Returns the type of the current exception.
*/