michael@0: # Apparently, there's simply no way to ask GDB to exit with a non-zero michael@0: # status when the script run with the --eval-command option fails. Thus, if michael@0: # we have --eval-command run prolog.py directly, syntax errors there will michael@0: # lead GDB to exit with no indication anything went wrong. michael@0: # michael@0: # To avert that, we use this very small launcher script to run prolog.py michael@0: # and catch errors. michael@0: # michael@0: # Remember, errors in this file will cause spurious passes, so keep this as michael@0: # simple as possible! michael@0: michael@0: import os michael@0: import sys michael@0: import traceback michael@0: try: michael@0: # testlibdir is set on the GDB command line, via: michael@0: # --eval-command python testlibdir=... michael@0: execfile(os.path.join(testlibdir, 'prolog.py')) michael@0: except Exception as err: michael@0: sys.stderr.write('Error running GDB prologue:\n') michael@0: traceback.print_exc() michael@0: sys.exit(1)