1
Fork 0

run rustfmt on libpanic_unwind

This commit is contained in:
Srinivas Reddy Thatiparthy 2016-10-18 23:09:47 +05:30
parent 16eeeac783
commit 1cc1dcce7d
No known key found for this signature in database
GPG key ID: 091C58F4BFC36571
4 changed files with 20 additions and 21 deletions

View file

@ -182,12 +182,8 @@ unsafe fn read_encoded_pointer(reader: &mut DwarfReader,
assert!(context.func_start != 0); assert!(context.func_start != 0);
context.func_start context.func_start
} }
DW_EH_PE_textrel => { DW_EH_PE_textrel => (*context.get_text_start)(),
(*context.get_text_start)() DW_EH_PE_datarel => (*context.get_data_start)(),
}
DW_EH_PE_datarel => {
(*context.get_data_start)()
}
_ => panic!(), _ => panic!(),
}; };

View file

@ -57,13 +57,10 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
exception_object: *mut uw::_Unwind_Exception, exception_object: *mut uw::_Unwind_Exception,
context: *mut uw::_Unwind_Context) context: *mut uw::_Unwind_Context)
-> uw::_Unwind_Reason_Code { -> uw::_Unwind_Reason_Code {
__gxx_personality_v0(version, actions, __gxx_personality_v0(version, actions, exception_class, exception_object, context)
exception_class,
exception_object,
context)
} }
extern { extern "C" {
fn __cxa_allocate_exception(thrown_size: libc::size_t) -> *mut libc::c_void; fn __cxa_allocate_exception(thrown_size: libc::size_t) -> *mut libc::c_void;
fn __cxa_free_exception(thrown_exception: *mut libc::c_void); fn __cxa_free_exception(thrown_exception: *mut libc::c_void);
fn __cxa_throw(thrown_exception: *mut libc::c_void, fn __cxa_throw(thrown_exception: *mut libc::c_void,

View file

@ -156,14 +156,16 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
let eh_action = find_eh_action(context); let eh_action = find_eh_action(context);
if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 { if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 {
match eh_action { match eh_action {
EHAction::None | EHAction::Cleanup(_) => return uw::_URC_CONTINUE_UNWIND, EHAction::None |
EHAction::Cleanup(_) => return uw::_URC_CONTINUE_UNWIND,
EHAction::Catch(_) => return uw::_URC_HANDLER_FOUND, EHAction::Catch(_) => return uw::_URC_HANDLER_FOUND,
EHAction::Terminate => return uw::_URC_FATAL_PHASE1_ERROR, EHAction::Terminate => return uw::_URC_FATAL_PHASE1_ERROR,
} }
} else { } else {
match eh_action { match eh_action {
EHAction::None => return uw::_URC_CONTINUE_UNWIND, EHAction::None => return uw::_URC_CONTINUE_UNWIND,
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => { EHAction::Cleanup(lpad) |
EHAction::Catch(lpad) => {
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t); uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t);
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0); uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0);
uw::_Unwind_SetIP(context, lpad); uw::_Unwind_SetIP(context, lpad);
@ -191,7 +193,7 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
// we want to continue unwinding the stack, otherwise all our backtraces // we want to continue unwinding the stack, otherwise all our backtraces
// would end at __rust_try // would end at __rust_try
if state & uw::_US_FORCE_UNWIND as c_int != 0 { if state & uw::_US_FORCE_UNWIND as c_int != 0 {
return continue_unwind(exception_object, context) return continue_unwind(exception_object, context);
} }
true true
} else if action == uw::_US_UNWIND_FRAME_STARTING as c_int { } else if action == uw::_US_UNWIND_FRAME_STARTING as c_int {
@ -207,7 +209,9 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
// To preserve signatures of functions like _Unwind_GetLanguageSpecificData(), which // To preserve signatures of functions like _Unwind_GetLanguageSpecificData(), which
// take only the context pointer, GCC personality routines stash a pointer to exception_object // take only the context pointer, GCC personality routines stash a pointer to exception_object
// in the context, using location reserved for ARM's "scratch register" (r12). // in the context, using location reserved for ARM's "scratch register" (r12).
uw::_Unwind_SetGR(context, uw::UNWIND_POINTER_REG, exception_object as uw::_Unwind_Ptr); uw::_Unwind_SetGR(context,
uw::UNWIND_POINTER_REG,
exception_object as uw::_Unwind_Ptr);
// ...A more principled approach would be to provide the full definition of ARM's // ...A more principled approach would be to provide the full definition of ARM's
// _Unwind_Context in our libunwind bindings and fetch the required data from there directly, // _Unwind_Context in our libunwind bindings and fetch the required data from there directly,
// bypassing DWARF compatibility functions. // bypassing DWARF compatibility functions.
@ -223,7 +227,8 @@ unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
} else { } else {
match eh_action { match eh_action {
EHAction::None => return continue_unwind(exception_object, context), EHAction::None => return continue_unwind(exception_object, context),
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => { EHAction::Cleanup(lpad) |
EHAction::Catch(lpad) => {
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t); uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t);
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0); uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0);
uw::_Unwind_SetIP(context, lpad); uw::_Unwind_SetIP(context, lpad);

View file

@ -129,7 +129,8 @@ unsafe fn find_landing_pad(dc: &c::DISPATCHER_CONTEXT) -> Option<usize> {
}; };
match find_eh_action(dc.HandlerData, &eh_ctx) { match find_eh_action(dc.HandlerData, &eh_ctx) {
EHAction::None => None, EHAction::None => None,
EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => Some(lpad), EHAction::Cleanup(lpad) |
EHAction::Catch(lpad) => Some(lpad),
EHAction::Terminate => intrinsics::abort(), EHAction::Terminate => intrinsics::abort(),
} }
} }