builtin: do not use backtrace with musl

pull/2543/head^2
Alexander Medvednikov 2019-10-25 18:38:47 +03:00
parent c7e6d379da
commit be0830b24f
1 changed files with 3 additions and 2 deletions

View File

@ -39,8 +39,9 @@ pub fn print_backtrace_skipping_top_frames(skipframes int) {
} }
$if linux { $if linux {
$if !android { $if !android {
$if glibc {
// backtrace is not available on Android. // backtrace is not available on Android.
if C.backtrace_symbols_fd != 0 { //if C.backtrace_symbols_fd != 0 {
buffer := [100]byteptr buffer := [100]byteptr
nr_ptrs := C.backtrace(*voidptr(buffer), 100) nr_ptrs := C.backtrace(*voidptr(buffer), 100)
nr_actual_frames := nr_ptrs-skipframes nr_actual_frames := nr_ptrs-skipframes
@ -70,7 +71,7 @@ pub fn print_backtrace_skipping_top_frames(skipframes int) {
} }
//C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_actual_frames, 1) //C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_actual_frames, 1)
return return
}else{ }$else{
C.printf('backtrace_symbols_fd is missing, so printing backtraces is not available.\n') C.printf('backtrace_symbols_fd is missing, so printing backtraces is not available.\n')
C.printf('Some libc implementations like musl simply do not provide it.\n') C.printf('Some libc implementations like musl simply do not provide it.\n')
} }