summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview/src/asan/resources
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /mobile/android/geckoview/src/asan/resources
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/geckoview/src/asan/resources')
-rw-r--r--mobile/android/geckoview/src/asan/resources/lib/arm64-v8a/wrap.sh52
-rw-r--r--mobile/android/geckoview/src/asan/resources/lib/armeabi-v7a/wrap.sh52
-rw-r--r--mobile/android/geckoview/src/asan/resources/lib/x86/wrap.sh52
-rw-r--r--mobile/android/geckoview/src/asan/resources/lib/x86_64/wrap.sh52
4 files changed, 208 insertions, 0 deletions
diff --git a/mobile/android/geckoview/src/asan/resources/lib/arm64-v8a/wrap.sh b/mobile/android/geckoview/src/asan/resources/lib/arm64-v8a/wrap.sh
new file mode 100644
index 0000000000..65a466973b
--- /dev/null
+++ b/mobile/android/geckoview/src/asan/resources/lib/arm64-v8a/wrap.sh
@@ -0,0 +1,52 @@
+#!/system/bin/sh
+# shellcheck shell=ksh
+
+# call getprop before setting LD_PRELOAD
+os_version=$(getprop ro.build.version.sdk)
+
+# These options mirror those in mozglue/build/AsanOptions.cpp
+# except for fast_unwind_* which are only needed on Android
+options=(
+ allow_user_segv_handler=1
+ alloc_dealloc_mismatch=0
+ detect_leaks=0
+ fast_unwind_on_check=1
+ fast_unwind_on_fatal=1
+ max_free_fill_size=268435456
+ max_malloc_fill_size=268435456
+ malloc_fill_byte=228
+ free_fill_byte=229
+ handle_sigill=1
+ allocator_may_return_null=1
+)
+if [ -e "/data/local/tmp/asan.options.gecko" ]; then
+ options+=("$(tr -d '\n' < /data/local/tmp/asan.options.gecko)")
+fi
+
+# : is the usual separator for ASAN options
+# save and reset IFS so it doesn't interfere with later commands
+old_ifs="$IFS"
+IFS=:
+ASAN_OPTIONS="${options[*]}"
+export ASAN_OPTIONS
+IFS="$old_ifs"
+
+LIB_PATH="$(cd "$(dirname "$0")" && pwd)"
+LD_PRELOAD="$(ls "$LIB_PATH"/libclang_rt.asan-*-android.so)"
+export LD_PRELOAD
+
+cmd="$1"
+shift
+
+# enable debugging
+# https://developer.android.com/ndk/guides/wrap-script#debugging_when_using_wrapsh
+# note that wrap.sh is not supported before android 8.1 (API 27)
+if [ "$os_version" -eq "27" ]; then
+ args=("-Xrunjdwp:transport=dt_android_adb,suspend=n,server=y" -Xcompiler-option --debuggable)
+elif [ "$os_version" -eq "28" ]; then
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y" -Xcompiler-option --debuggable)
+else
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y")
+fi
+
+exec "$cmd" "${args[@]}" "$@"
diff --git a/mobile/android/geckoview/src/asan/resources/lib/armeabi-v7a/wrap.sh b/mobile/android/geckoview/src/asan/resources/lib/armeabi-v7a/wrap.sh
new file mode 100644
index 0000000000..65a466973b
--- /dev/null
+++ b/mobile/android/geckoview/src/asan/resources/lib/armeabi-v7a/wrap.sh
@@ -0,0 +1,52 @@
+#!/system/bin/sh
+# shellcheck shell=ksh
+
+# call getprop before setting LD_PRELOAD
+os_version=$(getprop ro.build.version.sdk)
+
+# These options mirror those in mozglue/build/AsanOptions.cpp
+# except for fast_unwind_* which are only needed on Android
+options=(
+ allow_user_segv_handler=1
+ alloc_dealloc_mismatch=0
+ detect_leaks=0
+ fast_unwind_on_check=1
+ fast_unwind_on_fatal=1
+ max_free_fill_size=268435456
+ max_malloc_fill_size=268435456
+ malloc_fill_byte=228
+ free_fill_byte=229
+ handle_sigill=1
+ allocator_may_return_null=1
+)
+if [ -e "/data/local/tmp/asan.options.gecko" ]; then
+ options+=("$(tr -d '\n' < /data/local/tmp/asan.options.gecko)")
+fi
+
+# : is the usual separator for ASAN options
+# save and reset IFS so it doesn't interfere with later commands
+old_ifs="$IFS"
+IFS=:
+ASAN_OPTIONS="${options[*]}"
+export ASAN_OPTIONS
+IFS="$old_ifs"
+
+LIB_PATH="$(cd "$(dirname "$0")" && pwd)"
+LD_PRELOAD="$(ls "$LIB_PATH"/libclang_rt.asan-*-android.so)"
+export LD_PRELOAD
+
+cmd="$1"
+shift
+
+# enable debugging
+# https://developer.android.com/ndk/guides/wrap-script#debugging_when_using_wrapsh
+# note that wrap.sh is not supported before android 8.1 (API 27)
+if [ "$os_version" -eq "27" ]; then
+ args=("-Xrunjdwp:transport=dt_android_adb,suspend=n,server=y" -Xcompiler-option --debuggable)
+elif [ "$os_version" -eq "28" ]; then
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y" -Xcompiler-option --debuggable)
+else
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y")
+fi
+
+exec "$cmd" "${args[@]}" "$@"
diff --git a/mobile/android/geckoview/src/asan/resources/lib/x86/wrap.sh b/mobile/android/geckoview/src/asan/resources/lib/x86/wrap.sh
new file mode 100644
index 0000000000..65a466973b
--- /dev/null
+++ b/mobile/android/geckoview/src/asan/resources/lib/x86/wrap.sh
@@ -0,0 +1,52 @@
+#!/system/bin/sh
+# shellcheck shell=ksh
+
+# call getprop before setting LD_PRELOAD
+os_version=$(getprop ro.build.version.sdk)
+
+# These options mirror those in mozglue/build/AsanOptions.cpp
+# except for fast_unwind_* which are only needed on Android
+options=(
+ allow_user_segv_handler=1
+ alloc_dealloc_mismatch=0
+ detect_leaks=0
+ fast_unwind_on_check=1
+ fast_unwind_on_fatal=1
+ max_free_fill_size=268435456
+ max_malloc_fill_size=268435456
+ malloc_fill_byte=228
+ free_fill_byte=229
+ handle_sigill=1
+ allocator_may_return_null=1
+)
+if [ -e "/data/local/tmp/asan.options.gecko" ]; then
+ options+=("$(tr -d '\n' < /data/local/tmp/asan.options.gecko)")
+fi
+
+# : is the usual separator for ASAN options
+# save and reset IFS so it doesn't interfere with later commands
+old_ifs="$IFS"
+IFS=:
+ASAN_OPTIONS="${options[*]}"
+export ASAN_OPTIONS
+IFS="$old_ifs"
+
+LIB_PATH="$(cd "$(dirname "$0")" && pwd)"
+LD_PRELOAD="$(ls "$LIB_PATH"/libclang_rt.asan-*-android.so)"
+export LD_PRELOAD
+
+cmd="$1"
+shift
+
+# enable debugging
+# https://developer.android.com/ndk/guides/wrap-script#debugging_when_using_wrapsh
+# note that wrap.sh is not supported before android 8.1 (API 27)
+if [ "$os_version" -eq "27" ]; then
+ args=("-Xrunjdwp:transport=dt_android_adb,suspend=n,server=y" -Xcompiler-option --debuggable)
+elif [ "$os_version" -eq "28" ]; then
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y" -Xcompiler-option --debuggable)
+else
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y")
+fi
+
+exec "$cmd" "${args[@]}" "$@"
diff --git a/mobile/android/geckoview/src/asan/resources/lib/x86_64/wrap.sh b/mobile/android/geckoview/src/asan/resources/lib/x86_64/wrap.sh
new file mode 100644
index 0000000000..65a466973b
--- /dev/null
+++ b/mobile/android/geckoview/src/asan/resources/lib/x86_64/wrap.sh
@@ -0,0 +1,52 @@
+#!/system/bin/sh
+# shellcheck shell=ksh
+
+# call getprop before setting LD_PRELOAD
+os_version=$(getprop ro.build.version.sdk)
+
+# These options mirror those in mozglue/build/AsanOptions.cpp
+# except for fast_unwind_* which are only needed on Android
+options=(
+ allow_user_segv_handler=1
+ alloc_dealloc_mismatch=0
+ detect_leaks=0
+ fast_unwind_on_check=1
+ fast_unwind_on_fatal=1
+ max_free_fill_size=268435456
+ max_malloc_fill_size=268435456
+ malloc_fill_byte=228
+ free_fill_byte=229
+ handle_sigill=1
+ allocator_may_return_null=1
+)
+if [ -e "/data/local/tmp/asan.options.gecko" ]; then
+ options+=("$(tr -d '\n' < /data/local/tmp/asan.options.gecko)")
+fi
+
+# : is the usual separator for ASAN options
+# save and reset IFS so it doesn't interfere with later commands
+old_ifs="$IFS"
+IFS=:
+ASAN_OPTIONS="${options[*]}"
+export ASAN_OPTIONS
+IFS="$old_ifs"
+
+LIB_PATH="$(cd "$(dirname "$0")" && pwd)"
+LD_PRELOAD="$(ls "$LIB_PATH"/libclang_rt.asan-*-android.so)"
+export LD_PRELOAD
+
+cmd="$1"
+shift
+
+# enable debugging
+# https://developer.android.com/ndk/guides/wrap-script#debugging_when_using_wrapsh
+# note that wrap.sh is not supported before android 8.1 (API 27)
+if [ "$os_version" -eq "27" ]; then
+ args=("-Xrunjdwp:transport=dt_android_adb,suspend=n,server=y" -Xcompiler-option --debuggable)
+elif [ "$os_version" -eq "28" ]; then
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y" -Xcompiler-option --debuggable)
+else
+ args=(-XjdwpProvider:adbconnection "-XjdwpOptions:suspend=n,server=y")
+fi
+
+exec "$cmd" "${args[@]}" "$@"