Bug 1010028 - Set args properly for various debuggers. r=glandium

Set args properly to to separate the debugger and process arguments.
Also add "--args" automatically for gdb front-end cgdb and ddd.

Verification Steps:
1. mach debug +debugger gdb
2. Make sure gdb is launched correctly.
This commit is contained in:
Ting-Yu Lin 2014-05-19 19:21:00 +02:00
parent fb28c1c0e5
commit e5a1dbdf70

View File

@ -767,8 +767,6 @@ class DebugProgram(MachCommandBase):
help='Do not set the JS_DISABLE_SLOW_SCRIPT_SIGNALS env variable; when not set, recoverable but misleading SIGSEGV instances may occur in Ion/Odin JIT code')
def debug(self, params, remote, background, debugger, debugparams, slowscript):
import which
use_lldb = False
use_gdb = False
if debugger:
try:
debugger = which.which(debugger)
@ -779,11 +777,9 @@ class DebugProgram(MachCommandBase):
else:
try:
debugger = which.which('gdb')
use_gdb = True
except Exception:
try:
debugger = which.which('lldb')
use_lldb = True
except Exception as e:
print("You don't have gdb or lldb in your PATH")
print(e)
@ -809,10 +805,17 @@ class DebugProgram(MachCommandBase):
print(e)
return 1
if use_gdb:
args.append('--args')
elif use_lldb:
args.append('--')
# args added to separate the debugger and process arguments.
args_separator = {
'gdb': '--args',
'ddd': '--args',
'cgdb': '--args',
'lldb': '--'
}
debugger_name = os.path.basename(debugger)
if debugger_name in args_separator:
args.append(args_separator[debugger_name])
args.append(binpath)
if not remote: