From b645f23708c9d7eafb0fd40f0a33fa102b75bf15 Mon Sep 17 00:00:00 2001 From: Will Holen Date: Wed, 22 Apr 2020 18:43:13 -0700 Subject: [PATCH] Fix folly::dynamic crash when attaching a debugger to Hermes Summary: folly_futures was compiled with and exported -DFOLLY_MOBILE=1, while folly_json did not. This flag disables fancy F14 data structures for folly::dynamic in favor of a simple std::unordered_map. This caused inlined/templated code from modules depending on folly_futures to disagree with the implementations in folly_json, leading to a crash. The only such libraries were libhermes-inspector and (transitively) libhermes-executor-debug, and these only use folly::dynamic for CDP serialization, which is why the problem was not more apparent. Changelog: [Internal] Fix crash when attaching a Hermes debugger Reviewed By: mhorowitz Differential Revision: D21193307 fbshipit-source-id: 2b795bb6f4f7f991e2adaacec62d62616117322b --- ReactAndroid/src/main/jni/third-party/folly/Android.mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ReactAndroid/src/main/jni/third-party/folly/Android.mk b/ReactAndroid/src/main/jni/third-party/folly/Android.mk index 26888906373..1bd5c3e9d13 100644 --- a/ReactAndroid/src/main/jni/third-party/folly/Android.mk +++ b/ReactAndroid/src/main/jni/third-party/folly/Android.mk @@ -36,7 +36,8 @@ FOLLY_FLAGS := \ -DFOLLY_NO_CONFIG=1 \ -DFOLLY_HAVE_CLOCK_GETTIME=1 \ -DFOLLY_HAVE_MEMRCHR=1 \ - -DFOLLY_USE_LIBCPP=1 + -DFOLLY_USE_LIBCPP=1 \ + -DFOLLY_MOBILE=1 # If APP_PLATFORM in Application.mk targets android-23 above, please comment this line. # NDK uses GNU style stderror_r() after API 23. @@ -87,9 +88,6 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS += -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -FOLLY_FLAGS += \ - -DFOLLY_MOBILE=1 - LOCAL_CFLAGS += $(FOLLY_FLAGS) LOCAL_EXPORT_CPPFLAGS := $(FOLLY_FLAGS)