mirror of
https://github.com/servo/servo.git
synced 2025-07-05 22:43:40 +01:00
Adds --debug and --debugger flags to ./mach run
This commit is contained in:
parent
f0d5083557
commit
c0eca8f4c0
1 changed files with 35 additions and 3 deletions
|
@ -1,10 +1,12 @@
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
|
import argparse
|
||||||
import os.path as path
|
import os.path as path
|
||||||
from os import chdir
|
from os import chdir
|
||||||
import subprocess
|
import subprocess
|
||||||
import SimpleHTTPServer
|
import SimpleHTTPServer
|
||||||
import SocketServer
|
import SocketServer
|
||||||
|
import mozdebug
|
||||||
from shutil import copytree, rmtree, ignore_patterns
|
from shutil import copytree, rmtree, ignore_patterns
|
||||||
|
|
||||||
from mach.decorators import (
|
from mach.decorators import (
|
||||||
|
@ -21,14 +23,44 @@ class MachCommands(CommandBase):
|
||||||
@Command('run',
|
@Command('run',
|
||||||
description='Run Servo',
|
description='Run Servo',
|
||||||
category='post-build')
|
category='post-build')
|
||||||
|
@CommandArgument('--debug', action='store_true',
|
||||||
|
help='Enable the debugger. Not specifying a '
|
||||||
|
'--debugger option will result in the default '
|
||||||
|
'debugger being used. The following arguments '
|
||||||
|
'have no effect without this.')
|
||||||
|
@CommandArgument('--debugger', default=None, type=str,
|
||||||
|
help='Name of debugger to use.')
|
||||||
@CommandArgument(
|
@CommandArgument(
|
||||||
'params', nargs='...',
|
'params', nargs='...',
|
||||||
help="Command-line arguments to be passed through to Servo")
|
help="Command-line arguments to be passed through to Servo")
|
||||||
def run(self, params):
|
def run(self, params, debug=False, debugger=None):
|
||||||
env = self.build_env()
|
env = self.build_env()
|
||||||
env["RUST_BACKTRACE"] = "1"
|
env["RUST_BACKTRACE"] = "1"
|
||||||
subprocess.check_call([path.join("target", "servo")] + params,
|
|
||||||
env=env)
|
args = [path.join("target", "servo")]
|
||||||
|
|
||||||
|
# Borrowed and modified from:
|
||||||
|
# http://hg.mozilla.org/mozilla-central/file/c9cfa9b91dea/python/mozbuild/mozbuild/mach_commands.py#l883
|
||||||
|
if debug:
|
||||||
|
import mozdebug
|
||||||
|
if not debugger:
|
||||||
|
# No debugger name was provided. Look for the default ones on
|
||||||
|
# current OS.
|
||||||
|
debugger = mozdebug.get_default_debugger_name(
|
||||||
|
mozdebug.DebuggerSearch.KeepLooking)
|
||||||
|
|
||||||
|
self.debuggerInfo = mozdebug.get_debugger_info(debugger)
|
||||||
|
if not self.debuggerInfo:
|
||||||
|
print("Could not find a suitable debugger in your PATH.")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# Prepend the debugger args.
|
||||||
|
args = ([self.debuggerInfo.path] + self.debuggerInfo.args
|
||||||
|
+ args + params)
|
||||||
|
else:
|
||||||
|
args = args + params
|
||||||
|
|
||||||
|
subprocess.check_call(args, env=env)
|
||||||
|
|
||||||
@Command('doc',
|
@Command('doc',
|
||||||
description='Generate documentation',
|
description='Generate documentation',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue