diff --git a/bin/symbols-check.py b/bin/symbols-check.py index dd36470d768..12c63812c9a 100644 --- a/bin/symbols-check.py +++ b/bin/symbols-check.py @@ -13,6 +13,34 @@ PLATFORM_SYMBOLS = [ '__cxa_guard_abort', '__cxa_guard_acquire', '__cxa_guard_release', + '__cxa_allocate_dependent_exception', + '__cxa_allocate_exception', + '__cxa_begin_catch', + '__cxa_call_unexpected', + '__cxa_current_exception_type', + '__cxa_current_primary_exception', + '__cxa_decrement_exception_refcount', + '__cxa_deleted_virtual', + '__cxa_demangle', + '__cxa_end_catch', + '__cxa_free_dependent_exception', + '__cxa_free_exception', + '__cxa_get_exception_ptr', + '__cxa_get_globals', + '__cxa_get_globals_fast', + '__cxa_increment_exception_refcount', + '__cxa_new_handler', + '__cxa_pure_virtual', + '__cxa_rethrow', + '__cxa_rethrow_primary_exception', + '__cxa_terminate_handler', + '__cxa_throw', + '__cxa_uncaught_exception', + '__cxa_uncaught_exceptions', + '__cxa_unexpected_handler', + '__dynamic_cast', + '__emutls_get_address', + '__gxx_personality_v0', '__end__', '__odr_asan._glapi_Context', '__odr_asan._glapi_Dispatch', diff --git a/meson.build b/meson.build index e1bedff9be6..43e90c210a9 100644 --- a/meson.build +++ b/meson.build @@ -823,6 +823,19 @@ if with_android_stub and not with_platform_android error('`-D android-stub=true` makes no sense without `-D platforms=android`') endif +if get_option('android-libbacktrace') == 'auto' + with_libbacktrace = with_platform_android +else + with_libbacktrace = get_option('android-libbacktrace') == 'true' + if with_libbacktrace and not with_platform_android + error('`-D android-libbacktrace=true` makes no sense without `-D platforms=android`') + endif +endif + +if with_libbacktrace + cpp_args += '-DWITH_LIBBACKTRACE' +endif + if with_platform_android dep_android_mapper4 = null_dep if not with_android_stub @@ -830,8 +843,10 @@ if with_platform_android dependency('cutils'), dependency('hardware'), dependency('sync'), - dependency('backtrace') ] + if with_libbacktrace + dep_android += dependency('backtrace') + endif if get_option('platform-sdk-version') >= 26 dep_android += dependency('nativewindow') endif diff --git a/meson_options.txt b/meson_options.txt index 483e05a0e45..3a1490f97bc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -43,7 +43,13 @@ option( value : false, description : 'Build against android-stub', ) - +option( + 'android-libbacktrace', + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], + description : 'Use Android\'s libbacktrace', +) option( 'dri3', type : 'feature', diff --git a/src/android_stub/meson.build b/src/android_stub/meson.build index 86f88caea34..6097ae8ef07 100644 --- a/src/android_stub/meson.build +++ b/src/android_stub/meson.build @@ -1,7 +1,12 @@ if with_android_stub stub_libs = [] + lib_names = ['cutils', 'hardware', 'log', 'nativewindow', 'sync'] - foreach lib : ['backtrace', 'cutils', 'hardware', 'log', 'nativewindow', 'sync'] + if with_libbacktrace + lib_names += ['backtrace'] + endif + + foreach lib : lib_names stub_libs += shared_library( lib, files(lib + '_stub.cpp'), diff --git a/src/util/u_debug_stack_android.cpp b/src/util/u_debug_stack_android.cpp index 2c7b2d53676..4481771baf9 100644 --- a/src/util/u_debug_stack_android.cpp +++ b/src/util/u_debug_stack_android.cpp @@ -21,11 +21,14 @@ * IN THE SOFTWARE. */ +#include "u_debug_stack.h" + +#if WITH_LIBBACKTRACE + #include #include "util/simple_mtx.h" #include "util/u_debug.h" -#include "u_debug_stack.h" #include "util/hash_table.h" #include "util/u_thread.h" @@ -120,3 +123,27 @@ debug_backtrace_print(FILE *f, backtrace[i].off); } } + +#else + +void +debug_backtrace_capture(debug_stack_frame *backtrace, + unsigned start_frame, + unsigned nr_frames) +{ +} + +void +debug_backtrace_dump(const debug_stack_frame *backtrace, + unsigned nr_frames) +{ +} + +void +debug_backtrace_print(FILE *f, + const debug_stack_frame *backtrace, + unsigned nr_frames) +{ +} + +#endif // WITH_LIBBACKTRACE \ No newline at end of file