[debugger] Restoring line number support in Debugger
Below you can see a part of a report, that In-Portal debugger generates on each page load (only when debugging is enabled).
Among other things this report also have file information (name and line number) from which a particular record was added into debugger report. As you can see they are clickable, however to be able to open each file a special Launchy (https://addons.mozilla.org/en-us/firefox/addon/launchy/) Firefox extension needs to be installed.
Problem
All seems nice, but line number, specified next to filename in debugger report isn't passed along to a program, that will open that file. Because of this developer need:
- to remember line number from a debugger report
- open file in Launchy
- use "Go To Line ..." menu of an editor, where file was opened to go to a line number, that he previously remembered
Doing all that on a regular basis might result in developer forgetting what's for he opened a file in first place.
At Intechnic we are using PHPStorm (http://www.jetbrains.com/phpstorm/) as our IDE. Among many other features it also support command-line invocation (see http://www.jetbrains.com/phpstorm/webhelp/working-with-phpstorm-features-from-command-line.html). According to documentation the only way the line number can be passed to IDE is through "–line" parameter:
PhpStorm.exe C:\SamplesProjects\MetersToInchesConverter.php --line 3
Different IDE most likely will use different way of specifying line number in command line. To be compatible with most of IDE debugger don't pass line number to IDE at all.
Solution
I've been "Command-line Launcher" tool (http://shellrunner.com/2012/11/16/open-files-from-the-command-line-in-phpstorm/), that is created automatically upon PHPStorm installation, but also can be created on request (e.g. if it's missing). I never noticed, but this tool is actually a wrapper script around PhpStorm main executable, that allows it to support larger variety of command-line option formats (same options, but typed in different ways). Along them I've found out one, that allowed "filename:line_number" notation to be used (same as you saw in debugger report before):
pstorm C:\SamplesProjects\MetersToInchesConverter.php:3
Note, that in this example I used newly created wrapper script "pstorm" instead of "PhpStorm.exe". After finding that the only thing, that was needed is to pass line number, from debugger, which was pretty simple.
debugger_file_line_number_fix.patch