1
0
Fork 0

runtime/kernel/core1: allows getting backtrace when kernel is not loaded

This commit is contained in:
pca006132 2020-08-24 16:19:25 +08:00
parent fa187fb37a
commit 0fb278f7cb
1 changed files with 3 additions and 6 deletions

View File

@ -222,12 +222,6 @@ pub fn terminate(exception: &'static eh_artiq::Exception<'static>, backtrace: &'
/// Called by llvm_libunwind /// Called by llvm_libunwind
#[no_mangle] #[no_mangle]
extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32 { extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32 {
let exidx = unsafe {
KERNEL_IMAGE.as_ref()
.expect("dl_unwind_find_exidx kernel image")
.library.get().as_ref().unwrap().exidx()
};
let length; let length;
let start: *const u32; let start: *const u32;
unsafe { unsafe {
@ -235,6 +229,9 @@ extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32
length = (&__exidx_end as *const u32).offset_from(&__exidx_start) as u32; length = (&__exidx_end as *const u32).offset_from(&__exidx_start) as u32;
start = &__exidx_start; start = &__exidx_start;
} else { } else {
let exidx = KERNEL_IMAGE.as_ref()
.expect("dl_unwind_find_exidx kernel image")
.library.get().as_ref().unwrap().exidx();
length = exidx.len() as u32; length = exidx.len() as u32;
start = exidx.as_ptr(); start = exidx.as_ptr();
} }