js/src/gdb/lib-for-tests/catcher.py

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial