MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

musl libunwind

+44 -2
+10 -1
meson/deps/meson.build
··· 51 51 win_deps = [] 52 52 endif 53 53 54 + crash_deps = [] 55 + if host_machine.system() == 'linux' 56 + libunwind_dep = dependency('libunwind', required: false, static: is_static) 57 + if libunwind_dep.found() and cc.has_header('libunwind.h', dependencies: libunwind_dep) 58 + crash_deps += [libunwind_dep] 59 + add_project_arguments('-DANT_CRASH_HAVE_LIBUNWIND', language: 'c') 60 + endif 61 + endif 62 + 54 63 deps_info = { 55 64 'lmdb': { 56 65 'dir': 'openldap-LMDB_0.9.33', ··· 234 243 uriparser_dep, utf8proc_dep, ssl_dep, crypto_dep, 235 244 zlib_dep, brotli_common_dep, brotli_dec_dep, 236 245 brotli_enc_dep, uthash_dep, lmdb_dep, wamr_dep, 237 - ] + win_deps 246 + ] + win_deps + crash_deps 238 247 239 248 if get_option('jit') 240 249 mir_dep = subproject('mir').get_variable('mir_dep')
+34 -1
src/crash.c
··· 67 67 #include <sys/utsname.h> 68 68 #endif 69 69 70 - #if defined(__APPLE__) || defined(__linux__) || defined(__GLIBC__) 70 + #if defined(__APPLE__) || defined(__GLIBC__) 71 71 #define ANT_CRASH_HAVE_EXECINFO 1 72 72 #include <execinfo.h> 73 + #endif 74 + 75 + #ifdef ANT_CRASH_HAVE_LIBUNWIND 76 + #define UNW_LOCAL_ONLY 77 + #include <libunwind.h> 73 78 #endif 74 79 #endif 75 80 ··· 965 970 int skip = n > 1 ? 1 : 0; 966 971 for (int i = skip; i < n && frame_count < ANT_CRASH_FRAME_MAX; i++) 967 972 frames[frame_count++] = (uintptr_t)raw_frames[i]; 973 + #elif defined(ANT_CRASH_HAVE_LIBUNWIND) 974 + unw_cursor_t cursor; 975 + bool cursor_ready = false; 976 + bool include_current_frame = false; 977 + 978 + #ifdef UNW_INIT_SIGNAL_FRAME 979 + if (ucontext && unw_init_local2(&cursor, (unw_context_t *)ucontext, UNW_INIT_SIGNAL_FRAME) == 0) { 980 + cursor_ready = true; 981 + include_current_frame = true; 982 + } 983 + #endif 984 + 985 + unw_context_t context; 986 + if (!cursor_ready && unw_getcontext(&context) == 0 && unw_init_local(&cursor, &context) == 0) 987 + cursor_ready = true; 988 + 989 + if (cursor_ready) { 990 + if (include_current_frame) { 991 + unw_word_t ip = 0; 992 + if (unw_get_reg(&cursor, UNW_REG_IP, &ip) == 0 && ip) 993 + frames[frame_count++] = (uintptr_t)ip; 994 + } 995 + while (frame_count < ANT_CRASH_FRAME_MAX && unw_step(&cursor) > 0) { 996 + unw_word_t ip = 0; 997 + if (unw_get_reg(&cursor, UNW_REG_IP, &ip) == 0 && ip) 998 + frames[frame_count++] = (uintptr_t)ip; 999 + } 1000 + } 968 1001 #endif 969 1002 970 1003 uint64_t fault_addr = info ? (uint64_t)(uintptr_t)info->si_addr : 0;