Commit 02b40027 authored by Simon McVittie's avatar Simon McVittie

Launcher: add --print-backtrace and --debugger

parent ecf4ad4a
......@@ -188,6 +188,10 @@ class Launcher:
help='expansion to launch')
parser.add_argument('--smp', default=False, action='store_true',
help='use a multi-threaded game engine, if supported')
parser.add_argument('--print-backtrace', default=False,
action='store_true', help='print backtrace on crash')
parser.add_argument('--debugger', default=None,
help='run engine under a debugger')
parser.add_argument('--quiet', '-q', default=False, action='store_true',
help='silence console logging')
parser.add_argument('arguments', nargs=argparse.REMAINDER,
......@@ -582,6 +586,13 @@ class Launcher:
environ['LD_LIBRARY_PATH'] = ':'.join(library_path)
if self.args.print_backtrace:
self.argv[:0] = ['gdb', '-return-child-result', '-batch',
'-ex', 'run', '-ex', 'thread apply all bt full',
'-ex', 'kill', '-ex', 'quit', '--args']
elif self.args.debugger:
self.argv[:0] = shlex.split(self.args.debugger)
logger.debug('Executing: %r', self.argv + self.args.arguments)
self.flush()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment