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