Skip to content

Instantly share code, notes, and snippets.

@pallas
Last active September 2, 2025 05:39
Show Gist options
  • Select an option

  • Save pallas/035bf6beb9bbf0872d84b38ebacb0cde to your computer and use it in GitHub Desktop.

Select an option

Save pallas/035bf6beb9bbf0872d84b38ebacb0cde to your computer and use it in GitHub Desktop.
GDB wrapper to produce backtrace automatically
#!/bin/bash
# SPDX-License-Identifier: Unlicense
# Author: Derrick Lyndon Pallas <derrick@pallas.us>
[ $# -gt 0 ] &&
exec gdb "$1" --return-child-result --silent --batch \
--ex "run $([ $# -gt 1 ] && printf "'%s' " "${@:2}")" \
--ex "thread apply all bt" \
2>/dev/null
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment