diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index eb9d47b2b688..155ef2657935 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -68,9 +68,6 @@ #ifndef MOZ_STATIC_JS @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@ #endif -#ifdef MOZ_DMD -@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@ -#endif #ifndef MOZ_SYSTEM_NSPR #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@ diff --git a/build/automation.py.in b/build/automation.py.in index c669da01795e..60c252c072d3 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -183,33 +183,22 @@ class Automation(object): else: os.kill(self.pid, signal.SIGKILL) - def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None, ubsanPath=None): + def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, lsanPath=None, ubsanPath=None): if xrePath == None: xrePath = self.DIST_BIN if env == None: env = dict(os.environ) ldLibraryPath = os.path.abspath(os.path.join(SCRIPT_DIR, xrePath)) - dmdLibrary = None - preloadEnvVar = None if self.UNIXISH or self.IS_MAC: envVar = "LD_LIBRARY_PATH" - preloadEnvVar = "LD_PRELOAD" if self.IS_MAC: envVar = "DYLD_LIBRARY_PATH" - dmdLibrary = "libdmd.dylib" - else: # unixish - dmdLibrary = "libdmd.so" if envVar in env: ldLibraryPath = ldLibraryPath + ":" + env[envVar] env[envVar] = ldLibraryPath elif self.IS_WIN32: env["PATH"] = env["PATH"] + ";" + str(ldLibraryPath) - dmdLibrary = "dmd.dll" - preloadEnvVar = "MOZ_REPLACE_MALLOC_LIB" - - if dmdPath and dmdLibrary and preloadEnvVar: - env[preloadEnvVar] = os.path.join(dmdPath, dmdLibrary) if crashreporter and not debugger: env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' diff --git a/build/mobile/remoteautomation.py b/build/mobile/remoteautomation.py index 00ae2a8ec5a5..cde9406983c3 100644 --- a/build/mobile/remoteautomation.py +++ b/build/mobile/remoteautomation.py @@ -60,15 +60,12 @@ class RemoteAutomation(Automation): self._remoteLog = logfile # Set up what we need for the remote environment - def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, dmdPath=None, lsanPath=None, ubsanPath=None): + def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, lsanPath=None, ubsanPath=None): # Because we are running remote, we don't want to mimic the local env # so no copying of os.environ if env is None: env = {} - if dmdPath: - env['MOZ_REPLACE_MALLOC_LIB'] = os.path.join(dmdPath, 'libdmd.so') - # Except for the mochitest results table hiding option, which isn't # passed to runtestsremote.py as an actual option, but through the # MOZ_HIDE_RESULTS_TABLE environment variable. diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp index 294b26aacc4b..b1e02a167425 100644 --- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -4877,6 +4877,9 @@ replace_malloc_init_funcs(); #ifdef MOZ_REPLACE_MALLOC_STATIC extern "C" void logalloc_init(malloc_table_t*, ReplaceMallocBridge**); + +extern "C" void +dmd_init(malloc_table_t*, ReplaceMallocBridge**); #endif bool @@ -4913,6 +4916,11 @@ init() if (Equals(initialTable, gReplaceMallocTable)) { logalloc_init(&gReplaceMallocTable, &gReplaceMallocBridge); } +#ifdef MOZ_DMD + if (Equals(initialTable, gReplaceMallocTable)) { + dmd_init(&gReplaceMallocTable, &gReplaceMallocBridge); + } +#endif #endif replace_malloc_init_funcs(); } diff --git a/memory/replace/dmd/moz.build b/memory/replace/dmd/moz.build index a1492debd633..2df4e4751079 100644 --- a/memory/replace/dmd/moz.build +++ b/memory/replace/dmd/moz.build @@ -9,14 +9,18 @@ EXPORTS += [ ] UNIFIED_SOURCES += [ - '../../../mfbt/HashFunctions.cpp', - '../../../mfbt/JSONWriter.cpp', - '../../../mfbt/Poison.cpp', - '../../../mozglue/misc/StackWalk.cpp', 'DMD.cpp', ] -SharedLibrary('dmd') +if not CONFIG['MOZ_REPLACE_MALLOC_STATIC']: + UNIFIED_SOURCES += [ + '/mfbt/HashFunctions.cpp', + '/mfbt/JSONWriter.cpp', + '/mfbt/Poison.cpp', + '/mozglue/misc/StackWalk.cpp', + ] + +ReplaceMalloc('dmd') DEFINES['MOZ_NO_MOZALLOC'] = True DEFINES['IMPL_MFBT'] = True diff --git a/memory/replace/dmd/test/test_dmd.js b/memory/replace/dmd/test/test_dmd.js index 8d043f7b540a..1efdb7333374 100644 --- a/memory/replace/dmd/test/test_dmd.js +++ b/memory/replace/dmd/test/test_dmd.js @@ -137,7 +137,6 @@ function run_test() { // asynchronously. gEnv.set('DMD', '1'); - gEnv.set(gEnv.get("DMD_PRELOAD_VAR"), gEnv.get("DMD_PRELOAD_VALUE")); runProcess(gDmdTestFile, []); diff --git a/memory/replace/logalloc/replay/moz.build b/memory/replace/logalloc/replay/moz.build index 37c435d9359d..4764bc052914 100644 --- a/memory/replace/logalloc/replay/moz.build +++ b/memory/replace/logalloc/replay/moz.build @@ -12,6 +12,14 @@ SOURCES += [ 'Replay.cpp', ] +if CONFIG['MOZ_REPLACE_MALLOC_STATIC'] and CONFIG['MOZ_DMD']: + UNIFIED_SOURCES += [ + '/mfbt/HashFunctions.cpp', + '/mfbt/JSONWriter.cpp', + '/mfbt/Poison.cpp', + '/mozglue/misc/StackWalk.cpp', + ] + if not CONFIG['MOZ_REPLACE_MALLOC_STATIC']: SOURCES += [ '../FdPrintf.cpp', diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 3127bec4ec73..c862a02a56af 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -920,35 +920,10 @@ class RunProgram(MachCommandBase): if show_dump_stats: dmd_params.append('--show-dump-stats=yes') - bin_dir = os.path.dirname(binpath) - lib_name = self.substs['DLL_PREFIX'] + 'dmd' + self.substs['DLL_SUFFIX'] - dmd_lib = os.path.join(bin_dir, lib_name) - if not os.path.exists(dmd_lib): - print("Please build with |--enable-dmd| to use DMD.") - return 1 - - env_vars = { - "Darwin": { - "DYLD_INSERT_LIBRARIES": dmd_lib, - "LD_LIBRARY_PATH": bin_dir, - }, - "Linux": { - "LD_PRELOAD": dmd_lib, - "LD_LIBRARY_PATH": bin_dir, - }, - "WINNT": { - "MOZ_REPLACE_MALLOC_LIB": dmd_lib, - }, - } - - arch = self.substs['OS_ARCH'] - if dmd_params: - env_vars[arch]["DMD"] = " ".join(dmd_params) + extra_env['DMD'] = ' '.join(dmd_params) else: - env_vars[arch]["DMD"] = "1" - - extra_env.update(env_vars.get(arch, {})) + extra_env['DMD'] = '1' return self.run_process(args=args, ensure_exit_code=False, pass_thru=True, append_env=extra_env) diff --git a/testing/awsy/mach_commands.py b/testing/awsy/mach_commands.py index d2bdadd633c8..503cd3e6d366 100644 --- a/testing/awsy/mach_commands.py +++ b/testing/awsy/mach_commands.py @@ -144,32 +144,8 @@ class MachCommands(MachCommandBase): # Setup DMD env vars if necessary. if kwargs['dmd']: - dmd_params = [] - bin_dir = os.path.dirname(binary) - lib_name = self.substs['DLL_PREFIX'] + 'dmd' + self.substs['DLL_SUFFIX'] - dmd_lib = os.path.join(bin_dir, lib_name) - if not os.path.exists(dmd_lib): - print("Please build with |--enable-dmd| to use DMD.") - return 1 - env_vars = { - "Darwin": { - "DYLD_INSERT_LIBRARIES": dmd_lib, - "LD_LIBRARY_PATH": bin_dir, - }, - "Linux": { - "LD_PRELOAD": dmd_lib, - "LD_LIBRARY_PATH": bin_dir, - }, - "WINNT": { - "MOZ_REPLACE_MALLOC_LIB": dmd_lib, - }, - } - - arch = self.substs['OS_ARCH'] - for k, v in env_vars[arch].iteritems(): - os.environ[k] = v if 'DMD' not in os.environ: os.environ['DMD'] = '1' diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py index 2af78bdf83c5..27422931d96a 100644 --- a/testing/mochitest/mochitest_options.py +++ b/testing/mochitest/mochitest_options.py @@ -434,12 +434,6 @@ class MochitestArguments(ArgumentContainer): "default": False, "help": "Run tests with DMD active.", }], - [["--dmd-path"], - {"default": None, - "dest": "dmdPath", - "help": "Specifies the path to the directory containing the shared library for DMD.", - "suppress": True, - }], [["--dump-output-directory"], {"default": None, "dest": "dumpOutputDirectory", @@ -701,16 +695,6 @@ class MochitestArguments(ArgumentContainer): if options.profilePath: options.profilePath = self.get_full_path(options.profilePath, parser.oldcwd) - if options.dmdPath: - options.dmdPath = self.get_full_path(options.dmdPath, parser.oldcwd) - - if options.dmd and not options.dmdPath: - if build_obj: - options.dmdPath = build_obj.bindir - else: - parser.error( - "could not find dmd libraries, specify them with --dmd-path") - if options.utilityPath: options.utilityPath = self.get_full_path(options.utilityPath, parser.oldcwd) diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 9a41d950ea58..476dac70b758 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -1622,7 +1622,6 @@ toolbar#nav-bar { xrePath=options.xrePath, env=env, debugger=debugger, - dmdPath=options.dmdPath, lsanPath=lsanPath, ubsanPath=ubsanPath) diff --git a/testing/mochitest/runtestsremote.py b/testing/mochitest/runtestsremote.py index 5a91aeaa148c..5c121ff0c277 100644 --- a/testing/mochitest/runtestsremote.py +++ b/testing/mochitest/runtestsremote.py @@ -356,13 +356,6 @@ def run_test_harness(parser, options): mozinfo.info['android_version'] = androidVersion deviceRoot = dm.deviceRoot - if options.dmdPath: - dmdLibrary = "libdmd.so" - dmdPathOnDevice = os.path.join(deviceRoot, dmdLibrary) - dm.removeFile(dmdPathOnDevice) - dm.pushFile(os.path.join(options.dmdPath, dmdLibrary), dmdPathOnDevice) - options.dmdPath = deviceRoot - options.dumpOutputDirectory = deviceRoot procName = options.app.split('/')[-1] diff --git a/testing/mozbase/mozrunner/mozrunner/utils.py b/testing/mozbase/mozrunner/mozrunner/utils.py index e02ff98da7b2..26f53d93b1e3 100755 --- a/testing/mozbase/mozrunner/mozrunner/utils.py +++ b/testing/mozbase/mozrunner/mozrunner/utils.py @@ -84,7 +84,7 @@ def _raw_log(): def test_environment(xrePath, env=None, crashreporter=True, debugger=False, - dmdPath=None, lsanPath=None, ubsanPath=None, log=None): + lsanPath=None, ubsanPath=None, log=None): """ populate OS environment variables for mochitest and reftests. @@ -102,29 +102,18 @@ def test_environment(xrePath, env=None, crashreporter=True, debugger=False, ldLibraryPath = xrePath envVar = None - dmdLibrary = None - preloadEnvVar = None if mozinfo.isUnix: envVar = "LD_LIBRARY_PATH" - dmdLibrary = "libdmd.so" - preloadEnvVar = "LD_PRELOAD" elif mozinfo.isMac: envVar = "DYLD_LIBRARY_PATH" - dmdLibrary = "libdmd.dylib" - preloadEnvVar = "DYLD_INSERT_LIBRARIES" elif mozinfo.isWin: envVar = "PATH" - dmdLibrary = "dmd.dll" - preloadEnvVar = "MOZ_REPLACE_MALLOC_LIB" if envVar: envValue = ((env.get(envVar), str(ldLibraryPath)) if mozinfo.isWin - else (ldLibraryPath, dmdPath, env.get(envVar))) + else (ldLibraryPath, env.get(envVar))) env[envVar] = os.path.pathsep.join([path for path in envValue if path]) - if dmdPath and dmdLibrary and preloadEnvVar: - env[preloadEnvVar] = os.path.join(dmdPath, dmdLibrary) - # crashreporter env['GNOME_DISABLE_CRASH_DIALOG'] = '1' env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1' diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 8aba8bfc396e..cfe238e50e7e 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -653,23 +653,8 @@ class XPCShellTestThread(Thread): self.complete_command = cmdH + cmdT + cmdI + args if self.test_object.get('dmd') == 'true': - if sys.platform.startswith('linux'): - preloadEnvVar = 'LD_PRELOAD' - libdmd = os.path.join(self.xrePath, 'libdmd.so') - elif sys.platform == 'osx' or sys.platform == 'darwin': - preloadEnvVar = 'DYLD_INSERT_LIBRARIES' - # self.xrePath is /Contents/Resources. - # We need /Contents/MacOS/libdmd.dylib. - contents_dir = os.path.dirname(self.xrePath) - libdmd = os.path.join(contents_dir, 'MacOS', 'libdmd.dylib') - elif sys.platform == 'win32': - preloadEnvVar = 'MOZ_REPLACE_MALLOC_LIB' - libdmd = os.path.join(self.xrePath, 'dmd.dll') - self.env['PYTHON'] = sys.executable self.env['BREAKPAD_SYMBOLS_PATH'] = self.symbolsPath - self.env['DMD_PRELOAD_VAR'] = preloadEnvVar - self.env['DMD_PRELOAD_VALUE'] = libdmd if self.test_object.get('subprocess') == 'true': self.env['PYTHON'] = sys.executable