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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial