author | Mike Hommey <mh+mozilla@glandium.org> |
Thu, 25 Jun 2020 08:43:23 +0000 | |
changeset 538965 | 50c02f803046c96fef71acf52d48f4fb17a6fc77 |
parent 538964 | 1e893a16cad367334736a622478d131a2b501efa |
child 538966 | 39a6155cb418a977934b6350df9263b1dafec8dd |
push id | 37576 |
push user | ncsoregi@mozilla.com |
push date | Tue, 07 Jul 2020 09:47:47 +0000 |
treeherder | mozilla-central@2aa3b889d603 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gsvelto |
bugs | 689178, 725231 |
milestone | 80.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mozglue/android/APKOpen.cpp +++ b/mozglue/android/APKOpen.cpp @@ -62,23 +62,16 @@ enum StartupEvent { #define mozilla_StartupTimeline_Event(ev, z) ev, #include "StartupTimeline.h" #undef mozilla_StartupTimeline_Event MAX_STARTUP_EVENT_ID }; using namespace mozilla; -static const int MAX_MAPPING_INFO = 32; -static mapping_info lib_mapping[MAX_MAPPING_INFO]; - -APKOPEN_EXPORT const struct mapping_info* getLibraryMapping() { - return lib_mapping; -} - void JNI_Throw(JNIEnv* jenv, const char* classname, const char* msg) { __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Throw\n"); jclass cls = jenv->FindClass(classname); if (cls == nullptr) { __android_log_print( ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't find exception class (or exception pending) %s\n", classname); exit(FAILURE); @@ -143,42 +136,16 @@ static void* nspr_handle = nullptr; static void* plc_handle = nullptr; #else # define sqlite_handle nss_handle # define nspr_handle nss_handle # define plc_handle nss_handle #endif static void* nss_handle = nullptr; -static int mapping_count = 0; - -extern "C" void report_mapping(char* name, void* base, uint32_t len, - uint32_t offset) { - if (mapping_count >= MAX_MAPPING_INFO) return; - - struct mapping_info* info = &lib_mapping[mapping_count++]; - info->name = strdup(name); - info->base = (uintptr_t)base; - info->len = len; - info->offset = offset; -} - -extern "C" void delete_mapping(const char* name) { - for (int pos = 0; pos < mapping_count; ++pos) { - struct mapping_info* info = &lib_mapping[pos]; - if (!strcmp(info->name, name)) { - struct mapping_info* last = &lib_mapping[mapping_count - 1]; - free(info->name); - *info = *last; - --mapping_count; - break; - } - } -} - static UniquePtr<char[]> getUnpackedLibraryName(const char* libraryName) { static const char* libdir = getenv("MOZ_ANDROID_LIBDIR"); size_t len = strlen(libdir) + 1 /* path separator */ + strlen(libraryName) + 1; /* null terminator */ auto file = MakeUnique<char[]>(len); snprintf(file.get(), len, "%s/%s", libdir, libraryName); return file;
--- a/mozglue/android/APKOpen.h +++ b/mozglue/android/APKOpen.h @@ -6,24 +6,16 @@ #define APKOpen_h #include <jni.h> #ifndef APKOPEN_EXPORT # define APKOPEN_EXPORT __attribute__((visibility("default"))) #endif -struct mapping_info { - char* name; - uintptr_t base; - size_t len; - size_t offset; -}; - -APKOPEN_EXPORT const struct mapping_info* getLibraryMapping(); APKOPEN_EXPORT void abortThroughJava(const char* msg); static const int SUCCESS = 0; static const int FAILURE = 1; void JNI_Throw(JNIEnv* jenv, const char* classname, const char* msg); // Bug 1207642 - Work around Dalvik bug by realigning stack on JNI entry #ifndef MOZ_JNICALL
--- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -377,45 +377,16 @@ static void SetJitExceptionHandler() { * * This size is bigger than xul.dll plus some extra for MinidumpWriteDump * allocations. */ static const SIZE_T kReserveSize = 0x5000000; // 80 MB static void* gBreakpadReservedVM; #endif -#if defined(MOZ_WIDGET_ANDROID) -// Android builds use a custom library loader, -// so the embedding will provide a list of shared -// libraries that are mapped into anonymous mappings. -typedef struct { - std::string name; - uintptr_t start_address; - size_t length; - size_t file_offset; -} mapping_info; -static std::vector<mapping_info> gLibraryMappings; - -static void AddMappingInfoToExceptionHandler(const mapping_info& aInfo) { - PageAllocator allocator; - auto_wasteful_vector<uint8_t, kDefaultBuildIdSize> guid(&allocator); - FileID::ElfFileIdentifierFromMappedFile( - reinterpret_cast<void const*>(aInfo.start_address), guid); - gExceptionHandler->AddMappingInfo(aInfo.name, guid, aInfo.start_address, - aInfo.length, aInfo.file_offset); -} - -static void AddAndroidMappingInfo() { - for (auto info : gLibraryMappings) { - AddMappingInfoToExceptionHandler(info); - } -} - -#endif // defined(MOZ_WIDGET_ANDROID) - #ifdef XP_LINUX static inline void my_inttostring(intmax_t t, char* buffer, size_t buffer_length) { my_memset(buffer, 0, buffer_length); my_uitos(buffer, t, my_uint_len(t)); } #endif @@ -2111,20 +2082,16 @@ nsresult SetExceptionHandler(nsIFile* aX // a default to pass exceptions to the OS handler. Boolean keyExistsAndHasValidFormat = false; Boolean prefValue = ::CFPreferencesGetAppBooleanValue( CFSTR("OSCrashReporter"), kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat); if (keyExistsAndHasValidFormat) showOSCrashReporter = prefValue; #endif -#if defined(MOZ_WIDGET_ANDROID) - AddAndroidMappingInfo(); -#endif // defined(MOZ_WIDGET_ANDROID) - mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize); oldTerminateHandler = std::set_terminate(&TerminateHandler); return NS_OK; } bool GetEnabled() { return gExceptionHandler != nullptr; } @@ -3899,25 +3866,11 @@ bool UnsetRemoteExceptionHandler() { #if defined(MOZ_WIDGET_ANDROID) void SetNotificationPipeForChild(int childCrashFd) { gMagicChildCrashReportFd = childCrashFd; } void SetCrashAnnotationPipeForChild(int childCrashAnnotationFd) { gChildCrashAnnotationReportFd = childCrashAnnotationFd; } - -void AddLibraryMapping(const char* library_name, uintptr_t start_address, - size_t mapping_length, size_t file_offset) { - mapping_info info; - if (!gExceptionHandler) { - info.name = library_name; - info.start_address = start_address; - info.length = mapping_length; - info.file_offset = file_offset; - gLibraryMappings.push_back(info); - } else { - AddMappingInfoToExceptionHandler(info); - } -} #endif } // namespace CrashReporter
--- a/toolkit/crashreporter/nsExceptionHandler.h +++ b/toolkit/crashreporter/nsExceptionHandler.h @@ -318,25 +318,16 @@ bool SetRemoteExceptionHandler(const cha uintptr_t aCrashTimeAnnotationFile = 0); bool UnsetRemoteExceptionHandler(); #if defined(MOZ_WIDGET_ANDROID) // Android creates child process as services so we must explicitly set // the handle for the pipe since it can't get remapped to a default value. void SetNotificationPipeForChild(int childCrashFd); void SetCrashAnnotationPipeForChild(int childCrashAnnotationFd); - -// Android builds use a custom library loader, so /proc/<pid>/maps -// will just show anonymous mappings for all the non-system -// shared libraries. This API is to work around that by providing -// info about the shared libraries that are mapped into these anonymous -// mappings. -void AddLibraryMapping(const char* library_name, uintptr_t start_address, - size_t mapping_length, size_t file_offset); - #endif // Annotates the crash report with the name of the calling thread. void SetCurrentThreadName(const char* aName); } // namespace CrashReporter #endif /* nsExceptionHandler_h__ */
--- a/toolkit/xre/nsAndroidStartup.cpp +++ b/toolkit/xre/nsAndroidStartup.cpp @@ -10,35 +10,27 @@ #include <stdlib.h> #include <string.h> #include <pthread.h> #include "mozilla/jni/Utils.h" #include "nsTArray.h" #include "nsString.h" #include "nsAppRunner.h" -#include "APKOpen.h" #include "nsExceptionHandler.h" #include "mozilla/Bootstrap.h" #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args) using namespace mozilla; extern "C" NS_EXPORT void GeckoStart(JNIEnv* env, char** argv, int argc, const StaticXREAppData& aAppData) { mozilla::jni::SetGeckoThreadEnv(env); - const struct mapping_info* info = getLibraryMapping(); - while (info->name) { - CrashReporter::AddLibraryMapping(info->name, info->base, info->len, - info->offset); - info++; - } - if (!argv) { LOG("Failed to get arguments for GeckoStart\n"); return; } BootstrapConfig config; config.appData = &aAppData; config.appDataPath = nullptr;