diff -r 000000000000 -r 6474c204b198 js/src/gdb/lib-for-tests/catcher.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/src/gdb/lib-for-tests/catcher.py Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,22 @@ +# Apparently, there's simply no way to ask GDB to exit with a non-zero +# status when the script run with the --eval-command option fails. Thus, if +# we have --eval-command run prolog.py directly, syntax errors there will +# lead GDB to exit with no indication anything went wrong. +# +# To avert that, we use this very small launcher script to run prolog.py +# and catch errors. +# +# Remember, errors in this file will cause spurious passes, so keep this as +# simple as possible! + +import os +import sys +import traceback +try: + # testlibdir is set on the GDB command line, via: + # --eval-command python testlibdir=... + execfile(os.path.join(testlibdir, 'prolog.py')) +except Exception as err: + sys.stderr.write('Error running GDB prologue:\n') + traceback.print_exc() + sys.exit(1)