Closed Bug 1517811 Opened 8 months ago Closed 8 months ago

`mach run --debugger=windbg.exe` doesn't work if windbg isn't in PATH

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set

Tracking

(firefox66 fixed)

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: ted, Assigned: ted)

References

Details

Attachments

(1 file)

`mach run` uses mozdebug to locate debuggers:
https://searchfox.org/mozilla-central/rev/fef7f858efb695a76010b4c624da5277c16e95b3/python/mozbuild/mozbuild/mach_commands.py#984-1008

mozdebug has code to locate windbg even if it's not in PATH:
https://searchfox.org/mozilla-central/rev/fef7f858efb695a76010b4c624da5277c16e95b3/testing/mozbase/mozdebug/mozdebug/mozdebug.py#165-177

This code works fine on my system:
$ ./mach python
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mozdebug
>>> mozdebug.get_debugger_info('windbg.exe')
DebuggerInfo(path='C:/Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\windbg.exe', interactive=True, args=[], requiresEscapedArgs=False)

However, we error out before trying that because of this check in mach's main.py:
https://searchfox.org/mozilla-central/rev/fef7f858efb695a76010b4c624da5277c16e95b3/python/mach/mach/main.py#454-480

$ ./mach run --debugger=windbg.exe
Specified debugger 'windbg.exe' is not found.
Is it installed? Is it in your PATH?

It feels like we shouldn't shoot ourselves in the foot here. Maybe mach should be using `mozdebug.get_debugger_info` instead of just `which`, since all of our test harnesses etc are likely using mozdebug anyway?
See Also: → 1517793
Additionally this doesn't even work if you pass an absolute path to the debugger, because `which.which` doesn't work with absolute paths. :-/

$ ./mach run --debugger='C:/Program Files (x86)/Windows Kits/10/Debuggers/x64/windbg.exe'
Specified debugger 'C:/Program Files (x86)/Windows Kits/10/Debuggers/x64/windbg.exe' is not found.
Is it installed? Is it in your PATH?

Will be monitoring this bug, and possibly take it if I have some bandwidth..

I wrote a simple local patch to use mozdebug which made this work for me. I'll get it up for review.

Assignee: nobody → ted
Pushed by tmielczarek@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e08a0bb35c03
use mozdebug in mach to validate debugger arguments. r=froydnj
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.