From a3393060176c954cfabe57f9dae2fef5682f495f Mon Sep 17 00:00:00 2001 From: Michael van der Westhuizen Date: Mon, 30 Oct 2023 07:28:48 -0700 Subject: [PATCH] Make gnu_debuglink_test compatible with aarch64 Summary: It turns out that __builtin_trap doesn't produce the right kind of crash on aarch64, eliding the stack trace. Use abort(3) to crash, which reliably generates a crash that the symbolizer can output. Reviewed By: Gownta Differential Revision: D50733603 fbshipit-source-id: 3f244a97ce6d0cbdfe2a4fc9c6f6f9b4cadbe4d4 --- folly/experimental/symbolizer/test/Crash.cpp | 3 ++- folly/experimental/symbolizer/test/gnu_debuglink_test.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/folly/experimental/symbolizer/test/Crash.cpp b/folly/experimental/symbolizer/test/Crash.cpp index 17ff8968c10..85df4c4b551 100644 --- a/folly/experimental/symbolizer/test/Crash.cpp +++ b/folly/experimental/symbolizer/test/Crash.cpp @@ -14,9 +14,10 @@ * limitations under the License. */ +#include #include int main() { folly::symbolizer::installFatalSignalHandler(); - __builtin_trap(); + std::abort(); } diff --git a/folly/experimental/symbolizer/test/gnu_debuglink_test.sh b/folly/experimental/symbolizer/test/gnu_debuglink_test.sh index a72b98c2001..e43961fc632 100755 --- a/folly/experimental/symbolizer/test/gnu_debuglink_test.sh +++ b/folly/experimental/symbolizer/test/gnu_debuglink_test.sh @@ -19,8 +19,8 @@ uuid=$(cat /proc/sys/kernel/random/uuid) for sig in 1 2 3 13 15; do eval "trap 'exit $((sig + 128))' $sig"; done trap 'rm -f "$crash.debuginfo.$uuid" "$crash.strip.$uuid"' 0 -${OBJCOPY} --only-keep-debug "$crash" "$crash.debuginfo.$uuid" -${OBJCOPY} --strip-debug --add-gnu-debuglink="$crash.debuginfo.$uuid" "$crash" "$crash.strip.$uuid" +objcopy --only-keep-debug "$crash" "$crash.debuginfo.$uuid" +objcopy --strip-debug --add-gnu-debuglink="$crash.debuginfo.$uuid" "$crash" "$crash.strip.$uuid" echo '{"op":"start","test":"gnu_debuglink_test"}'; start=$(date +%s)