author | Mike Hommey <mh+mozilla@glandium.org> |
Mon, 25 Nov 2019 23:04:24 +0000 | |
changeset 503744 | de739f20d4f9cd9a5848057c6d0e0d7ceb86910f |
parent 503743 | 4ed429a830595b0d791f4f5cd71f479aa479a582 |
child 503745 | 8596a38b5dabbd56202cf97d8d8c0541e0c621d0 |
push id | 36847 |
push user | ncsoregi@mozilla.com |
push date | Tue, 26 Nov 2019 09:34:48 +0000 |
treeherder | mozilla-central@7bc0df30a8a9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gerald |
bugs | 1598194 |
milestone | 72.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/baseprofiler/core/shared-libraries-linux.cc +++ b/mozglue/baseprofiler/core/shared-libraries-linux.cc @@ -28,26 +28,29 @@ # include <elf.h> # include <fcntl.h> # include <features.h> # include <sys/mman.h> # include <sys/stat.h> # include <sys/types.h> # include <vector> -# if defined(GP_OS_linux) -# include <link.h> // dl_phdr_info -# elif defined(GP_OS_android) +# if defined(MOZ_LINKER) # include "AutoObjectMapper.h" # include "ElfLoader.h" // dl_phdr_info +# elif defined(GP_OS_linux) || defined(GP_OS_android) +# include <link.h> // dl_phdr_info +# else +# error "Unexpected configuration" +# endif + +# if defined(GP_OS_android) extern "C" MOZ_EXPORT __attribute__((weak)) int dl_iterate_phdr( int (*callback)(struct dl_phdr_info* info, size_t size, void* data), void* data); -# else -# error "Unexpected configuration" # endif // ---------------------------------------------------------------------------- // Starting imports from toolkit/crashreporter/google-breakpad/, as needed by // this file when moved to mozglue. // Imported from // toolkit/crashreporter/google-breakpad/src/common/memory_range.h. @@ -643,34 +646,34 @@ struct LoadedLibraryInfo { mLastMappingEnd(aLastMappingEnd) {} std::string mName; unsigned long mBaseAddress; unsigned long mFirstMappingStart; unsigned long mLastMappingEnd; }; -# if defined(GP_OS_android) +# if defined(MOZ_LINKER) static void outputMapperLog(const char* aBuf) { /* LOG("%s", aBuf); */ } # endif static std::string IDtoUUIDString(const std::vector<uint8_t>& aIdentifier) { std::string uuid = FileID::ConvertIdentifierToUUIDString(aIdentifier); // This is '0', not '\0', since it represents the breakpad id age. uuid += '0'; return uuid; } // Get the breakpad Id for the binary file pointed by bin_name static std::string getId(const char* bin_name) { std::vector<uint8_t> identifier; identifier.reserve(kDefaultBuildIdSize); -# if defined(GP_OS_android) +# if defined(MOZ_LINKER) if (nsDependentCString(bin_name).Find("!/") != kNotFound) { AutoObjectMapperFaultyLib mapper(outputMapperLog); void* image = nullptr; size_t size = 0; if (mapper.Map(&image, &size, bin_name) && image && size) { if (FileID::ElfFileIdentifierFromMappedFile(image, identifier)) { return IDtoUUIDString(identifier); }
--- a/mozglue/baseprofiler/lul/AutoObjectMapper.cpp +++ b/mozglue/baseprofiler/lul/AutoObjectMapper.cpp @@ -15,17 +15,17 @@ # include <fcntl.h> # include "mozilla/Assertions.h" # include "mozilla/Sprintf.h" # include "PlatformMacros.h" # include "AutoObjectMapper.h" -# if defined(GP_OS_android) +# if defined(MOZ_LINKER) # include <dlfcn.h> # include "mozilla/Types.h" // FIXME move these out of mozglue/linker/ElfLoader.h into their // own header, so as to avoid conflicts arising from two definitions // of Array extern "C" { MFBT_API size_t __dl_get_mappable_length(void* handle); MFBT_API void* __dl_mmap(void* handle, void* addr, size_t length, off_t offset); @@ -90,17 +90,17 @@ bool AutoObjectMapperPOSIX::Map(/*OUT*/ close(fd); mIsMapped = true; mImage = *start = image; mSize = *length = sz; return true; } -# if defined(GP_OS_android) +# if defined(MOZ_LINKER) AutoObjectMapperFaultyLib::AutoObjectMapperFaultyLib(void (*aLog)(const char*)) : AutoObjectMapperPOSIX(aLog), mHdl(nullptr) {} AutoObjectMapperFaultyLib::~AutoObjectMapperFaultyLib() { if (mHdl) { // We've got an object mapped by faulty.lib. Unmap it via faulty.lib. MOZ_ASSERT(mSize > 0); // Assert on the basis that no valid mapping would start at page zero. @@ -120,11 +120,11 @@ AutoObjectMapperFaultyLib::~AutoObjectMa bool AutoObjectMapperFaultyLib::Map(/*OUT*/ void** start, /*OUT*/ size_t* length, std::string fileName) { MOZ_ASSERT(!mHdl); return false; } -# endif // defined(GP_OS_android) +# endif // defined(MOZ_LINKER) #endif // MOZ_BASE_PROFILER
--- a/mozglue/baseprofiler/lul/AutoObjectMapper.h +++ b/mozglue/baseprofiler/lul/AutoObjectMapper.h @@ -56,17 +56,17 @@ class MOZ_STACK_CLASS AutoObjectMapperPO AutoObjectMapperPOSIX& operator=(const AutoObjectMapperPOSIX&); // Disable heap allocation of this class. void* operator new(size_t); void* operator new[](size_t); void operator delete(void*); void operator delete[](void*); }; -#if defined(GP_OS_android) +#if defined(MOZ_LINKER) // This is a variant of AutoObjectMapperPOSIX suitable for use in // conjunction with faulty.lib on Android. How it behaves depends on // the name of the file to be mapped. There are three possible cases: // // (1) /foo/bar/xyzzy/blah.apk!/libwurble.so // We hand it as-is to faulty.lib and let it fish the relevant // bits out of the APK. // @@ -104,11 +104,11 @@ class MOZ_STACK_CLASS AutoObjectMapperFa AutoObjectMapperFaultyLib& operator=(const AutoObjectMapperFaultyLib&); // Disable heap allocation of this class. void* operator new(size_t); void* operator new[](size_t); void operator delete(void*); void operator delete[](void*); }; -#endif // defined(GP_OS_android) +#endif // defined(MOZ_LINKER) #endif // AutoObjectMapper_h
--- a/mozglue/baseprofiler/lul/platform-linux-lul.cpp +++ b/mozglue/baseprofiler/lul/platform-linux-lul.cpp @@ -31,17 +31,17 @@ void read_procmaps(lul::LUL* aLUL) { # if defined(GP_OS_linux) || defined(GP_OS_android) SharedLibraryInfo info = SharedLibraryInfo::GetInfoForSelf(); for (size_t i = 0; i < info.GetSize(); i++) { const SharedLibrary& lib = info.GetEntry(i); std::string nativePath = lib.GetDebugPath(); -# if defined(GP_OS_android) +# if defined(MOZ_LINKER) // We're using faulty.lib. Use a special-case object mapper. AutoObjectMapperFaultyLib mapper(aLUL->mLog); # else // We can use the standard POSIX-based mapper. AutoObjectMapperPOSIX mapper(aLUL->mLog); # endif // Ask |mapper| to map the object. Then hand its mapped address
--- a/tools/profiler/core/shared-libraries-linux.cc +++ b/tools/profiler/core/shared-libraries-linux.cc @@ -23,26 +23,29 @@ #include <nsTArray.h> #include "common/linux/file_id.h" #include <algorithm> #include <dlfcn.h> #include <features.h> #include <sys/types.h> -#if defined(GP_OS_linux) -# include <link.h> // dl_phdr_info -#elif defined(GP_OS_android) +#if defined(MOZ_LINKER) # include "AutoObjectMapper.h" # include "ElfLoader.h" // dl_phdr_info +#elif defined(GP_OS_linux) || defined(GP_OS_android) +# include <link.h> // dl_phdr_info +#else +# error "Unexpected configuration" +#endif + +#if defined(GP_OS_android) extern "C" MOZ_EXPORT __attribute__((weak)) int dl_iterate_phdr( int (*callback)(struct dl_phdr_info* info, size_t size, void* data), void* data); -#else -# error "Unexpected configuration" #endif struct LoadedLibraryInfo { LoadedLibraryInfo(const char* aName, unsigned long aBaseAddress, unsigned long aFirstMappingStart, unsigned long aLastMappingEnd) : mName(aName), mBaseAddress(aBaseAddress), @@ -50,17 +53,17 @@ struct LoadedLibraryInfo { mLastMappingEnd(aLastMappingEnd) {} nsCString mName; unsigned long mBaseAddress; unsigned long mFirstMappingStart; unsigned long mLastMappingEnd; }; -#if defined(GP_OS_android) +#if defined(MOZ_LINKER) static void outputMapperLog(const char* aBuf) { LOG("%s", aBuf); } #endif static nsCString IDtoUUIDString( const google_breakpad::wasteful_vector<uint8_t>& aIdentifier) { using namespace google_breakpad; nsCString uuid; @@ -73,17 +76,17 @@ static nsCString IDtoUUIDString( // Get the breakpad Id for the binary file pointed by bin_name static nsCString getId(const char* bin_name) { using namespace google_breakpad; PageAllocator allocator; auto_wasteful_vector<uint8_t, kDefaultBuildIdSize> identifier(&allocator); -#if defined(GP_OS_android) +#if defined(MOZ_LINKER) if (nsDependentCString(bin_name).Find("!/") != kNotFound) { AutoObjectMapperFaultyLib mapper(outputMapperLog); void* image = nullptr; size_t size = 0; if (mapper.Map(&image, &size, bin_name) && image && size) { if (FileID::ElfFileIdentifierFromMappedFile(image, identifier)) { return IDtoUUIDString(identifier); }
--- a/tools/profiler/lul/AutoObjectMapper.cpp +++ b/tools/profiler/lul/AutoObjectMapper.cpp @@ -11,17 +11,17 @@ #include <fcntl.h> #include "mozilla/Assertions.h" #include "mozilla/Sprintf.h" #include "PlatformMacros.h" #include "AutoObjectMapper.h" -#if defined(GP_OS_android) +#if defined(MOZ_LINKER) # include <dlfcn.h> # include "mozilla/Types.h" // FIXME move these out of mozglue/linker/ElfLoader.h into their // own header, so as to avoid conflicts arising from two definitions // of Array extern "C" { MFBT_API size_t __dl_get_mappable_length(void* handle); MFBT_API void* __dl_mmap(void* handle, void* addr, size_t length, off_t offset); @@ -90,17 +90,17 @@ bool AutoObjectMapperPOSIX::Map(/*OUT*/ close(fd); mIsMapped = true; mImage = *start = image; mSize = *length = sz; return true; } -#if defined(GP_OS_android) +#if defined(MOZ_LINKER) // A helper function for AutoObjectMapperFaultyLib::Map. Finds out // where the installation's lib directory is, since we'll have to look // in there to get hold of libmozglue.so. Returned C string is heap // allocated and the caller must deallocate it. static char* get_installation_lib_dir() { nsCOMPtr<nsIProperties> directoryService( do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID)); if (!directoryService) { @@ -180,9 +180,9 @@ bool AutoObjectMapperFaultyLib::Map(/*OU mHdl = hdl; mImage = *start = image; mSize = *length = sz; return true; } } -#endif // defined(GP_OS_android) +#endif // defined(MOZ_LINKER)
--- a/tools/profiler/lul/AutoObjectMapper.h +++ b/tools/profiler/lul/AutoObjectMapper.h @@ -56,17 +56,17 @@ class MOZ_STACK_CLASS AutoObjectMapperPO AutoObjectMapperPOSIX& operator=(const AutoObjectMapperPOSIX&); // Disable heap allocation of this class. void* operator new(size_t); void* operator new[](size_t); void operator delete(void*); void operator delete[](void*); }; -#if defined(GP_OS_android) +#if defined(MOZ_LINKER) // This is a variant of AutoObjectMapperPOSIX suitable for use in // conjunction with faulty.lib on Android. How it behaves depends on // the name of the file to be mapped. There are three possible cases: // // (1) /foo/bar/xyzzy/blah.apk!/libwurble.so // We hand it as-is to faulty.lib and let it fish the relevant // bits out of the APK. // @@ -104,11 +104,11 @@ class MOZ_STACK_CLASS AutoObjectMapperFa AutoObjectMapperFaultyLib& operator=(const AutoObjectMapperFaultyLib&); // Disable heap allocation of this class. void* operator new(size_t); void* operator new[](size_t); void operator delete(void*); void operator delete[](void*); }; -#endif // defined(GP_OS_android) +#endif // defined(MOZ_LINKER) #endif // AutoObjectMapper_h
--- a/tools/profiler/lul/platform-linux-lul.cpp +++ b/tools/profiler/lul/platform-linux-lul.cpp @@ -27,17 +27,17 @@ void read_procmaps(lul::LUL* aLUL) { #if defined(GP_OS_linux) || defined(GP_OS_android) SharedLibraryInfo info = SharedLibraryInfo::GetInfoForSelf(); for (size_t i = 0; i < info.GetSize(); i++) { const SharedLibrary& lib = info.GetEntry(i); std::string nativePath = lib.GetNativeDebugPath(); -# if defined(GP_OS_android) +# if defined(MOZ_LINKER) // We're using faulty.lib. Use a special-case object mapper. AutoObjectMapperFaultyLib mapper(aLUL->mLog); # else // We can use the standard POSIX-based mapper. AutoObjectMapperPOSIX mapper(aLUL->mLog); # endif // Ask |mapper| to map the object. Then hand its mapped address