diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py index 7f3de106ab42..e02a5132ddf4 100755 --- a/build/pgo/profileserver.py +++ b/build/pgo/profileserver.py @@ -43,7 +43,7 @@ def get_crashreports(directory, name=None): "$MOZ_FETCHES_DIR is not set in the environment" ) stackwalk_binary = os.path.join( - fetches_dir, "minidump_stackwalk", "minidump_stackwalk" + fetches_dir, "minidump-stackwalk", "minidump-stackwalk" ) if sys.platform == "win32": stackwalk_binary += ".exe" diff --git a/build/sparse-profiles/taskgraph b/build/sparse-profiles/taskgraph index 7b4a2d2449fc..1d5dc45f14cd 100644 --- a/build/sparse-profiles/taskgraph +++ b/build/sparse-profiles/taskgraph @@ -74,7 +74,7 @@ path:other-licenses/bsdiff/ path:other-licenses/nsis/Contrib/CityHash/cityhash/ path:toolkit/mozapps/update/updater -# for the minidump_stackwalk toolchain task +# for the minidump-stackwalk toolchain task path:toolkit/crashreporter path:tools/crashreporter/ path:mfbt diff --git a/docs/contributing/debugging/debugging_a_minidump.rst b/docs/contributing/debugging/debugging_a_minidump.rst index 3b51cc8be942..5638c29d8524 100644 --- a/docs/contributing/debugging/debugging_a_minidump.rst +++ b/docs/contributing/debugging/debugging_a_minidump.rst @@ -8,7 +8,8 @@ Debugging A Minidump The `minidump `__ file format contains data about a crash on Windows. It is used by -`Breakpad `__ and also by various +`rust-minidump `__, +`Breakpad `__, and also by various Windows debugging tools. Each minidump includes the following data. - Details about the exception which led to the crash. @@ -28,6 +29,21 @@ Minidumps are not available to everyone. For details on how to gain access and where to find minidump files for crash reports, consult the :ref:`crash report documentation ` +Using rust-minidump's tooling +----------------------------------- + +Most of our crash-reporting infrastructure is based on rust-minidump. +The primary tool for this is the +`minidump-stackwalk `__ +CLI application, which includes extensive user documentation. + +That documentation includes a +`dedicated section `__ +on locally analyzing Firefox crashreports and minidumps. + +If you're looking for minidump_dump, it's included as part of +minidump-stackwalk. + Using the MS Visual Studio debugger ----------------------------------- @@ -125,11 +141,6 @@ need to build the tool for ARM and run it under QEMU. Using other tools to inspect minidump data ------------------------------------------ -Breakpad includes a tool called ``minidump_dump`` built alongside -``minidump_stackwalk`` which will verbosely print the contents of a -minidump. This can sometimes be useful for finding specific information -that is not exposed on crash-stats. - Ted has a few tools that can be built against an already-built copy of Breakpad to do more targeted inspection. All of these tools assume you have checked out their source in a directory next to the breakpad @@ -137,9 +148,9 @@ checkout, and that you have built Breakpad in an objdir named ``obj-breakpad`` at the same level. - `stackwalk-http `__ - is a version of minidump_stackwalk that can fetch symbols over HTTP, - and also has the Mozilla symbol server URL baked in. If you run it - like ``stackwalk /path/to/dmp /tmp/syms`` it will print the stack + is a version of the breakpad's minidump_stackwalk that can fetch symbols + over HTTP, and also has the Mozilla symbol server URL baked in. If you + run it like ``stackwalk /path/to/dmp /tmp/syms`` it will print the stack trace and save the symbols it downloaded in ``/tmp/syms``. Note that symbols are only uploaded to the symbol server for nightly and release builds, not per-change builds. @@ -177,8 +188,8 @@ Getting a stack trace from a crashed B2G process #. Build and install `google-breakpad `__. #. Use the - `minidump_stackwalk `__ - breakpad tool to get the stack trace. + `minidump-stackwalk `__ + tool to get the stack trace. .. code:: bash @@ -188,4 +199,4 @@ Getting a stack trace from a crashed B2G process $ adb pull /data/b2g/mozilla/*.default/minidump/*.dmp . $ls *.dmp 71788789-197e-d769-67167423-4e7aef32.dmp - $ minidump_stackwalk 71788789-197e-d769-67167423-4e7aef32.dmp objdir-debug/dist/crashreporter-symbols/ + $ minidump-stackwalk 71788789-197e-d769-67167423-4e7aef32.dmp objdir-debug/dist/crashreporter-symbols/ diff --git a/js/src/devtools/automation/autospider.py b/js/src/devtools/automation/autospider.py index 27f5c8f9da6a..87c625cbd074 100755 --- a/js/src/devtools/automation/autospider.py +++ b/js/src/devtools/automation/autospider.py @@ -437,7 +437,7 @@ if use_minidump: }.get(platform.system()) injector_lib = resolve_path((DIR.fetches,), "injector", injector_basename) - stackwalk = resolve_path((DIR.fetches,), "minidump_stackwalk", "minidump_stackwalk") + stackwalk = resolve_path((DIR.fetches,), "minidump-stackwalk", "minidump-stackwalk") if stackwalk is not None: env.setdefault("MINIDUMP_STACKWALK", stackwalk) dump_syms = resolve_path((DIR.fetches,), "dump_syms", "dump_syms") diff --git a/python/mozboot/mozboot/base.py b/python/mozboot/mozboot/base.py index 656dbe229203..5fff9d1b26b3 100644 --- a/python/mozboot/mozboot/base.py +++ b/python/mozboot/mozboot/base.py @@ -365,7 +365,7 @@ class BaseBootstrapper(object): def ensure_minidump_stackwalk_packages(self): """ - Install minidump_stackwalk. + Install minidump-stackwalk. """ pass diff --git a/python/mozboot/mozboot/linux_common.py b/python/mozboot/mozboot/linux_common.py index 6c3516479b55..337f627a6a7c 100644 --- a/python/mozboot/mozboot/linux_common.py +++ b/python/mozboot/mozboot/linux_common.py @@ -99,7 +99,7 @@ class MinidumpStackwalkInstall(object): pass def ensure_minidump_stackwalk_packages(self): - self.install_toolchain_artifact("minidump_stackwalk") + self.install_toolchain_artifact("minidump-stackwalk") class MobileAndroidBootstrapper(object): diff --git a/python/mozboot/mozboot/mozillabuild.py b/python/mozboot/mozboot/mozillabuild.py index d13f15f8e032..d04d2a306ee8 100644 --- a/python/mozboot/mozboot/mozillabuild.py +++ b/python/mozboot/mozboot/mozillabuild.py @@ -239,7 +239,7 @@ class MozillaBuildBootstrapper(BaseBootstrapper): self.install_toolchain_artifact("fix-stacks") def ensure_minidump_stackwalk_packages(self): - self.install_toolchain_artifact("minidump_stackwalk") + self.install_toolchain_artifact("minidump-stackwalk") def _update_package_manager(self): pass diff --git a/python/mozboot/mozboot/osx.py b/python/mozboot/mozboot/osx.py index f8dae4b0da57..8c8c478d2ef6 100644 --- a/python/mozboot/mozboot/osx.py +++ b/python/mozboot/mozboot/osx.py @@ -309,7 +309,7 @@ class OSXBootstrapper(OSXAndroidBootstrapper, BaseBootstrapper): self.install_toolchain_artifact("node") def ensure_minidump_stackwalk_packages(self): - self.install_toolchain_artifact("minidump_stackwalk") + self.install_toolchain_artifact("minidump-stackwalk") def install_homebrew(self): print(BREW_INSTALL) diff --git a/taskcluster/ci/toolchain/kind.yml b/taskcluster/ci/toolchain/kind.yml index 52bd702d4100..d4535077c269 100644 --- a/taskcluster/ci/toolchain/kind.yml +++ b/taskcluster/ci/toolchain/kind.yml @@ -38,7 +38,7 @@ jobs-from: - llvm-symbolizer.yml - macos-sdk.yml - mingw.yml - - minidump_stackwalk.yml + - minidump-stackwalk.yml - misc.yml - nasm.yml - node.yml diff --git a/taskcluster/ci/toolchain/minidump_stackwalk.yml b/taskcluster/ci/toolchain/minidump-stackwalk.yml similarity index 96% rename from taskcluster/ci/toolchain/minidump_stackwalk.yml rename to taskcluster/ci/toolchain/minidump-stackwalk.yml index 62f3f34b7723..eda48060d01e 100644 --- a/taskcluster/ci/toolchain/minidump_stackwalk.yml +++ b/taskcluster/ci/toolchain/minidump-stackwalk.yml @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. --- job-defaults: - description: "minidump_stackwalk toolchain build" + description: "minidump-stackwalk toolchain build" attributes: local-toolchain: true worker-type: b-linux @@ -11,7 +11,7 @@ job-defaults: max-run-time: 1800 run: script: build-minidump-stackwalk.sh - toolchain-artifact: public/build/minidump_stackwalk.tar.zst + toolchain-artifact: public/build/minidump-stackwalk.tar.zst run-on-projects: - trunk fetches: diff --git a/taskcluster/scripts/misc/build-minidump-stackwalk.sh b/taskcluster/scripts/misc/build-minidump-stackwalk.sh index 929392e78aae..31a7f669b6a5 100755 --- a/taskcluster/scripts/misc/build-minidump-stackwalk.sh +++ b/taskcluster/scripts/misc/build-minidump-stackwalk.sh @@ -3,12 +3,11 @@ set -x -e -v # minidump-stackwalk is just one sub-crate of the rust-minidump project, # (but it depends on other subcrates, so we *do* need the whole rust-minidump). -# We need to specifically tell Cargo to build just this binary, and then extract -# and rename it (it's officially built with a "-" in its name, but we prefer "_" -# here, as that was the name of its predecessors). +# We need to specifically tell Cargo to build just this binary. The rest +# of this is just making sure all the compiler toolchains are setup and +# little quirks of cross-compiling a self-contained binary. FETCH=rust-minidump -LOCAL_PROJECT=minidump-stackwalk -PROJECT=minidump_stackwalk +PROJECT=minidump-stackwalk COMPRESS_EXT=zst # Needed by osx-cross-linker. @@ -81,14 +80,13 @@ PATH="$(cd $MOZ_FETCHES_DIR && pwd)/rustc/bin:$PATH" cd $MOZ_FETCHES_DIR/$FETCH -cargo build --verbose --release --target "$TARGET" --bin $LOCAL_PROJECT $FEATURES +cargo build --verbose --release --target "$TARGET" --bin $PROJECT $FEATURES +cd .. mkdir $PROJECT -cp target/$TARGET/release/${LOCAL_PROJECT}${EXE} ${PROJECT}/${PROJECT}${EXE} +cp $FETCH/target/$TARGET/release/${PROJECT}${EXE} ${PROJECT}/${PROJECT}${EXE} tar -acf ${PROJECT}.tar.$COMPRESS_EXT $PROJECT mkdir -p $UPLOAD_DIR cp ${PROJECT}.tar.$COMPRESS_EXT $UPLOAD_DIR -cd .. - . $GECKO_PATH/taskcluster/scripts/misc/vs-cleanup.sh diff --git a/testing/mozbase/mozcrash/mozcrash/mozcrash.py b/testing/mozbase/mozcrash/mozcrash/mozcrash.py index c5e1cd03a552..a5ee655e272b 100644 --- a/testing/mozbase/mozcrash/mozcrash/mozcrash.py +++ b/testing/mozbase/mozcrash/mozcrash/mozcrash.py @@ -68,10 +68,10 @@ def check_for_crashes( have `stackwalk_binary` executed on them, with `symbols_path` passed as an extra argument. - `stackwalk_binary` should be a path to the minidump_stackwalk binary. + `stackwalk_binary` should be a path to the minidump-stackwalk binary. If `stackwalk_binary` is not set, the MINIDUMP_STACKWALK environment variable will be checked and its value used if it is not empty. If neither is set, then - ~/.mozbuild/minidump_stackwalk/minidump_stackwalk will be used. + ~/.mozbuild/minidump-stackwalk/minidump-stackwalk will be used. `symbols_path` should be a path to a directory containing symbols to use for dump processing. This can either be a path to a directory containing Breakpad-format @@ -120,13 +120,13 @@ def check_for_crashes( if info.reason: stackwalk_output.append("Mozilla crash reason: %s" % info.reason) if info.stackwalk_stderr: - stackwalk_output.append("stderr from minidump_stackwalk:") + stackwalk_output.append("stderr from minidump-stackwalk:") stackwalk_output.append(info.stackwalk_stderr) elif info.stackwalk_stdout is not None: stackwalk_output.append(info.stackwalk_stdout) if info.stackwalk_retcode is not None and info.stackwalk_retcode != 0: stackwalk_output.append( - "minidump_stackwalk exited with return code {}".format( + "minidump-stackwalk exited with return code {}".format( info.stackwalk_retcode ) ) @@ -218,10 +218,10 @@ class CrashInfo(object): containing a set of symbols. :param dump_save_path: Path to which to save the dump files. If this is None, the MINIDUMP_SAVE_PATH environment variable will be used. - :param stackwalk_binary: Path to the minidump_stackwalk binary. If this is None, + :param stackwalk_binary: Path to the minidump-stackwalk binary. If this is None, the MINIDUMP_STACKWALK environment variable will be used as the path to the minidump binary. If neither is set, - then ~/.mozbuild/minidump_stackwalk/minidump_stackwalk + then ~/.mozbuild/minidump-stackwalk/minidump-stackwalk will be used.""" def __init__( @@ -230,6 +230,7 @@ class CrashInfo(object): self.dump_directory = dump_directory self.symbols_path = symbols_path self.remove_symbols = False + self.brief_output = False if dump_save_path is None: dump_save_path = os.environ.get("MINIDUMP_SAVE_PATH", None) @@ -238,12 +239,31 @@ class CrashInfo(object): if stackwalk_binary is None: stackwalk_binary = os.environ.get("MINIDUMP_STACKWALK", None) if stackwalk_binary is None: - # Location of minidump_stackwalk installed by "mach bootstrap". - stackwalk_binary = os.path.expanduser( - "~/.mozbuild/minidump_stackwalk/minidump_stackwalk" - ) - if mozinfo.isWin and not stackwalk_binary.endswith(".exe"): - stackwalk_binary += ".exe" + # Location of minidump-stackwalk installed by "mach bootstrap". + # + # In the transition to rust-minidump, the binary name was changed + # from minidump_stackwalk to minidump-stackwalk, but if the user + # hasn't run mach bootstrap yet, then they'll still have the old + # binary. So we try both names (but prefer the new one). + # + # If neither exists, then we intentionally leave a junk path + # in stackwalk_binary, as later checks will handle this properly + # when our actual error reporting is setup. + possible_names = ["minidump-stackwalk", "minidump_stackwalk"] + for possible_name in possible_names: + stackwalk_binary = os.path.expanduser( + "~/.mozbuild/{name}/{name}".format(name=possible_name) + ) + if mozinfo.isWin and not stackwalk_binary.endswith(".exe"): + stackwalk_binary += ".exe" + if os.path.exists(stackwalk_binary): + # If we reach this point, then we're almost certainly + # running on a local user's machine. Full minidump-stackwalk + # output is a bit noisy and verbose for that use-case, + # so we should use the --brief output. + self.brief_output = True + break + self.stackwalk_binary = stackwalk_binary self.logger = get_logger() @@ -335,10 +355,11 @@ class CrashInfo(object): and os.path.exists(self.stackwalk_binary) and os.access(self.stackwalk_binary, os.X_OK) ): - # If minidump_stackwalk -V fails, then we're using the old breakpad version, - # which is implicitly "human" output and doesn't support the --human flag. + # If minidump-stackwalk -V fails, then we're using the old breakpad version, + # (minidump_stackwalk) which is implicitly "human" output and doesn't + # support the --human flag. # - # Otherwise we're using rust-minidump's minidump_stackwalk. Before 0.9.6 + # Otherwise we're using rust-minidump's minidump-stackwalk. Before 0.9.6 # --human had to be passed explicitly to get human output, but now it's # the default (to behave more similarly to breakpad). But since we've # already filtered out breakpad as an option, we can explicitly pass @@ -383,6 +404,8 @@ class CrashInfo(object): # Specify the kind of output if rust_minidump: command.append("--human") + if self.brief_output: + command.append("--brief") # The minidump path and symbols_path values are positional and come last # (in practice the CLI parsers are more permissive, but best not to @@ -393,7 +416,7 @@ class CrashInfo(object): command.append(self.symbols_path) self.logger.info(u"Copy/paste: {}".format(" ".join(command))) - # run minidump_stackwalk + # run minidump-stackwalk p = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) @@ -404,7 +427,7 @@ class CrashInfo(object): err = six.ensure_str(err) if len(out) > 3: - # minidump_stackwalk is chatty, + # minidump-stackwalk is chatty, # so ignore stderr when it succeeds. # The top frame of the crash is always the line after "Thread N (crashed)" # Examples: @@ -441,12 +464,12 @@ class CrashInfo(object): errors.append( "MINIDUMP_STACKWALK not set, can't process dump. Either set " "MINIDUMP_STACKWALK or use mach bootstrap --no-system-changes " - "to install minidump_stackwalk." + "to install minidump-stackwalk." ) elif self.stackwalk_binary and not os.path.exists(self.stackwalk_binary): errors.append( "MINIDUMP_STACKWALK binary not found: %s. Use mach bootstrap " - "--no-system-changes to install minidump_stackwalk." + "--no-system-changes to install minidump-stackwalk." % self.stackwalk_binary ) elif not os.access(self.stackwalk_binary, os.X_OK): diff --git a/testing/mozbase/mozlog/mozlog/formatters/machformatter.py b/testing/mozbase/mozlog/mozlog/formatters/machformatter.py index 990c71cd3ed0..ecbab618df86 100644 --- a/testing/mozbase/mozlog/mozlog/formatters/machformatter.py +++ b/testing/mozbase/mozlog/mozlog/formatters/machformatter.py @@ -531,12 +531,12 @@ class MachFormatter(base.BaseFormatter): if data.get("stackwalk_returncode", 0) != 0: rv.append( - "minidump_stackwalk exited with return code %d" + "minidump-stackwalk exited with return code %d" % data["stackwalk_returncode"] ) if data.get("stackwalk_stderr"): - rv.append("stderr from minidump_stackwalk:") + rv.append("stderr from minidump-stackwalk:") rv.append(data["stackwalk_stderr"]) elif data.get("stackwalk_stdout"): rv.append(data["stackwalk_stdout"]) diff --git a/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py b/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py index f47989492db2..9e0b5223f78f 100644 --- a/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py +++ b/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py @@ -128,14 +128,14 @@ class TbplFormatter(BaseFormatter): rv.append("Crash dump filename: %s" % data["minidump_path"]) if data.get("stackwalk_stderr"): - rv.append("stderr from minidump_stackwalk:") + rv.append("stderr from minidump-stackwalk:") rv.append(data["stackwalk_stderr"]) elif data.get("stackwalk_stdout"): rv.append(data["stackwalk_stdout"]) if data.get("stackwalk_returncode", 0) != 0: rv.append( - "minidump_stackwalk exited with return code %d" + "minidump-stackwalk exited with return code %d" % data["stackwalk_returncode"] ) diff --git a/testing/mozharness/mozharness/mozilla/testing/testbase.py b/testing/mozharness/mozharness/mozilla/testing/testbase.py index 8a05f614c524..8416ea630f4a 100755 --- a/testing/mozharness/mozharness/mozilla/testing/testbase.py +++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py @@ -233,11 +233,11 @@ class TestingMixin( if raise_on_failure: raise - # If no symbols URL can be determined let minidump_stackwalk query the symbols. + # If no symbols URL can be determined let minidump-stackwalk query the symbols. # As of now this only works for Nightly and release builds. if not self.symbols_url: self.warning( - "No symbols_url found. Let minidump_stackwalk query for symbols." + "No symbols_url found. Let minidump-stackwalk query for symbols." ) return self.symbols_url @@ -664,15 +664,15 @@ Did you run with --create-virtualenv? Is mozinstall in virtualenv_modules?""" if "MOZ_FETCHES_DIR" in os.environ: minidump_stackwalk_path = os.path.join( os.environ["MOZ_FETCHES_DIR"], - "minidump_stackwalk", - "minidump_stackwalk", + "minidump-stackwalk", + "minidump-stackwalk", ) if self.platform_name() in ("win32", "win64"): minidump_stackwalk_path += ".exe" if not minidump_stackwalk_path or not os.path.isfile(minidump_stackwalk_path): - self.error("minidump_stackwalk path was not fetched?") + self.error("minidump-stackwalk path was not fetched?") # don't burn the job but we should at least turn them orange so it is caught self.record_status(TBPL_WARNING, WARNING) return None