Bug 928397 - Enable xpcshell-test debugging on Windows platforms and default debugger detection. r=ted.mielczarek

This commit is contained in:
Alessio Placitelli
2014-07-02 13:52:00 +02:00
parent 00c63d50ae
commit 7885462da5
6 changed files with 51 additions and 160 deletions

View File

@@ -23,8 +23,6 @@ __all__ = [
"dumpLeakLog",
"isURL",
"processLeakLog",
"getDebuggerInfo",
"DEBUGGER_INFO",
"replaceBackSlashes",
'KeyValueParseError',
'parseKeyValue',
@@ -48,54 +46,6 @@ def setAutomationLog(alt_logger):
global log
log = alt_logger
# Map of debugging programs to information about them, like default arguments
# and whether or not they are interactive.
DEBUGGER_INFO = {
# gdb requires that you supply the '--args' flag in order to pass arguments
# after the executable name to the executable.
"gdb": {
"interactive": True,
"args": "-q --args"
},
"cgdb": {
"interactive": True,
"args": "-q --args"
},
"lldb": {
"interactive": True,
"args": "--",
"requiresEscapedArgs": True
},
# Visual Studio Debugger Support
"devenv.exe": {
"interactive": True,
"args": "-debugexe"
},
# Visual C++ Express Debugger Support
"wdexpress.exe": {
"interactive": True,
"args": "-debugexe"
},
# valgrind doesn't explain much about leaks unless you set the
# '--leak-check=full' flag. But there are a lot of objects that are
# semi-deliberately leaked, so we set '--show-possibly-lost=no' to avoid
# uninteresting output from those objects. We set '--smc-check==all-non-file'
# and '--vex-iropt-register-updates=allregs-at-mem-access' so that valgrind
# deals properly with JIT'd JavaScript code.
"valgrind": {
"interactive": False,
"args": " ".join(["--leak-check=full",
"--show-possibly-lost=no",
"--smc-check=all-non-file",
"--vex-iropt-register-updates=allregs-at-mem-access"])
}
}
class ZipFileReader(object):
"""
Class to read zip files in Python 2.5 and later. Limited to only what we
@@ -224,58 +174,6 @@ def addCommonOptions(parser, defaults={}):
help = "prevents the test harness from redirecting "
"stdout and stderr for interactive debuggers")
def getFullPath(directory, path):
"Get an absolute path relative to 'directory'."
return os.path.normpath(os.path.join(directory, os.path.expanduser(path)))
def searchPath(directory, path):
"Go one step beyond getFullPath and try the various folders in PATH"
# Try looking in the current working directory first.
newpath = getFullPath(directory, path)
if os.path.isfile(newpath):
return newpath
# At this point we have to fail if a directory was given (to prevent cases
# like './gdb' from matching '/usr/bin/./gdb').
if not os.path.dirname(path):
for dir in os.environ['PATH'].split(os.pathsep):
newpath = os.path.join(dir, path)
if os.path.isfile(newpath):
return newpath
return None
def getDebuggerInfo(directory, debugger, debuggerArgs, debuggerInteractive = False):
debuggerInfo = None
if debugger:
debuggerPath = searchPath(directory, debugger)
if not debuggerPath:
print "Error: Path %s doesn't exist." % debugger
sys.exit(1)
debuggerName = os.path.basename(debuggerPath).lower()
def getDebuggerInfo(type, default):
if debuggerName in DEBUGGER_INFO and type in DEBUGGER_INFO[debuggerName]:
return DEBUGGER_INFO[debuggerName][type]
return default
debuggerInfo = {
"path": debuggerPath,
"interactive" : getDebuggerInfo("interactive", False),
"args": getDebuggerInfo("args", "").split(),
"requiresEscapedArgs": getDebuggerInfo("requiresEscapedArgs", False)
}
if debuggerArgs:
debuggerInfo["args"] = debuggerArgs.split()
if debuggerInteractive:
debuggerInfo["interactive"] = debuggerInteractive
return debuggerInfo
def dumpLeakLog(leakLogFile, filter = False):
"""Process the leak log, without parsing it.