Guest User

Untitled

a guest
Nov 19th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/bin/bash
  2. gdbcommandfile=$(tempfile)
  3. usepid=$(cat /proc/sys/kernel/core_uses_pid)
  4. printf "set pagination off\nbacktrace\nquit\n" > $gdbcommandfile
  5. ulimit -c unlimited
  6. "$@"&
  7. pid=$!
  8. wait $!
  9. if [[ $? -eq 139 ]]; then
  10. if [[ $usepid == 1 ]]; then
  11. gdb -q $1 core.$pid -x $gdbcommandfile
  12. else
  13. gdb -q $1 core -x $gdbcommandfile
  14. fi
  15. fi
  16. rm $gdbcommandfile
Add Comment
Please, Sign In to add comment