Last active
November 6, 2024 20:10
-
-
Save mosra/85e2d89f8cc5a44a674723c0f7e6a78a to your computer and use it in GitHub Desktop.
Print a backtrace of the last failed command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save into /usr/local/bin/bt and make the file executable. On Ubuntu you may | |
# need to additionally perform the following: | |
# | |
# sudo apt install systemd-coredump | |
# | |
# Calling `bt` then non-interactively prints a backtrace of last program that | |
# exited with a SIGABRT or SIGSEGV. Makes use of systemd's builtin coredumpctl, | |
# causes no core files littered around on the filesystem. | |
set -e | |
coredumpctl debug -q -A "-iex \"set pagination off\" -iex \"set style enabled on\" -iex \"set debuginfod enabled on\" -ex bt --batch" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment