Fix stacktrace gathering in FreeBSD 11.0-CURRENT

Cope with ancient GDB versions that lack the -ex flag.  Use a temporary
GDB script instead and pass it to GDB with -x.