[game-data-packager] 11/14: Launcher: add --print-backtrace and --debugger

Simon McVittie smcv at debian.org
Fri Oct 14 11:32:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 02b40027345e9caa964c1b8144f68b8a78b24851
Author: Simon McVittie <smcv at debian.org>
Date:   Fri Oct 14 12:10:59 2016 +0100

    Launcher: add --print-backtrace and --debugger
---
 runtime/launcher.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/runtime/launcher.py b/runtime/launcher.py
index fb7ad82..4cc5d18 100755
--- a/runtime/launcher.py
+++ b/runtime/launcher.py
@@ -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()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list