Bug 1755602 - consistently use minidump-stackwalk instead of minidump_stackwalk. r=glandium

Inconsistency confuses some of our tools. As part of this, I:

* Updated some docs to point to rust-minidump
* Added a fallback to mozcrash.py to try both versions
* Make mozcrash.py use --brief output when the local mdsw is used
* Remove the renaming hack from build-minidump-stackwalk.sh

This isn't as simple as a sed because we still have breakpad in tree
for minidump-analyzer. I did my best to replace the right strings.

Differential Revision: https://phabricator.services.mozilla.com/D138971
This commit is contained in:
Alexis Beingessner 2022-03-09 16:44:42 +00:00
Родитель 86290d26dd
Коммит ec10d290e7
15 изменённых файлов: 91 добавлений и 59 удалений

Просмотреть файл

@ -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"

Просмотреть файл

@ -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

Просмотреть файл

@ -8,7 +8,8 @@ Debugging A Minidump
The
`minidump <http://msdn.microsoft.com/en-us/library/windows/desktop/ms680369%28v=vs.85%29.aspx>`__
file format contains data about a crash on Windows. It is used by
`Breakpad <https://wiki.mozilla.org/Breakpad>`__ and also by various
`rust-minidump <https://github.com/luser/rust-minidump>`__,
`Breakpad <https://wiki.mozilla.org/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 <Understanding Crash Reports>`
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 <https://github.com/luser/rust-minidump/tree/master/minidump-stackwalk>`__
CLI application, which includes extensive user documentation.
That documentation includes a
`dedicated section <https://github.com/luser/rust-minidump/tree/master/minidump-stackwalk#analyzing-firefox-minidumps>`__
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 <https://hg.mozilla.org/users/tmielczarek_mozilla.com/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 <https://code.google.com/p/google-breakpad/>`__.
#. Use the
`minidump_stackwalk <https://code.google.com/p/google-breakpad/wiki/LinuxStarterGuide>`__
breakpad tool to get the stack trace.
`minidump-stackwalk <https://github.com/luser/rust-minidump/tree/master/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/

Просмотреть файл

@ -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")

Просмотреть файл

@ -365,7 +365,7 @@ class BaseBootstrapper(object):
def ensure_minidump_stackwalk_packages(self):
"""
Install minidump_stackwalk.
Install minidump-stackwalk.
"""
pass

Просмотреть файл

@ -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):

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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:

Просмотреть файл

@ -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

Просмотреть файл

@ -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):

Просмотреть файл

@ -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"])

Просмотреть файл

@ -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"]
)

Просмотреть файл

@ -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