Bug 1236983 - add windbg smarts to mozdebug; r=jmaher,aklotz

This commit is contained in:
Nathan Froyd 2016-01-05 12:47:39 -05:00
parent 0edcbf015f
commit 53f6b89c41

30
testing/mozbase/mozdebug/mozdebug/mozdebug.py Normal file → Executable file
View File

@ -50,7 +50,12 @@ _DEBUGGER_INFO = {
'wdexpress.exe': {
'interactive': True,
'args': ['-debugexe']
}
},
# Windows Development Kit super-debugger.
'windbg.exe': {
'interactive': True,
},
}
# Maps each OS platform to the preferred debugger programs found in _DEBUGGER_INFO.
@ -62,6 +67,19 @@ _DEBUGGER_PRIORITIES = {
'unknown': ['gdb']
}
def _windbg_installation_paths():
programFilesSuffixes = ['', ' (x86)']
programFiles = "C:/Program Files"
# Try the most recent versions first.
windowsKitsVersions = ['10', '8.1', '8']
for suffix in programFilesSuffixes:
windowsKitsPrefix = os.path.join(programFiles + suffix,
'Windows Kits')
for version in windowsKitsVersions:
yield os.path.join(windowsKitsPrefix, version,
'Debuggers', 'x86', 'windbg.exe')
def get_debugger_info(debugger, debuggerArgs = None, debuggerInteractive = False):
'''
Get the information about the requested debugger.
@ -89,6 +107,16 @@ def get_debugger_info(debugger, debuggerArgs = None, debuggerInteractive = False
debuggerPath = find_executable(debugger)
# windbg is not installed with the standard set of tools, and it's
# entirely possible that the user hasn't added the install location to
# PATH, so we have to be a little more clever than normal to locate it.
# Just try to look for it in the standard installed location(s).
if not debuggerPath and debugger == 'windbg.exe':
for candidate in _windbg_installation_paths():
if os.path.exists(candidate):
debuggerPath = candidate
break
if not debuggerPath:
print 'Error: Could not find debugger %s.' % debugger
return None