DBGPavim : An improved Python/PHP debugger
| script karma
Downloaded by 293
Comments, bugs, improvements
script versions (upload new version)
|This is a plugin to enable php debug in VIM with Xdebug, which originates from http://www.vim.org/scripts/script.php?script_id=1152.
But most of the code, especially the debugger backend has been rewritten.
Screencast -- http://youtu.be/GY3EcGQvw00
Tested with --
* XDebug 2.2 - PHP 5.4 - GVIM 7.3 - Python 2.7 @ Windows 7
* XDebug 2.0 - PHP 5.2 - VIM 7.3 - Python 2.7@ Linux
* XDebug 2.0 - PHP 5.2 - VIM 7.3 - Python 2.3@ Linux
* XDebug 2.2 - PHP 5.2 - VIM 7.3 - Python 2.7@ Linux
The source code is hosted at https://github.com/brookhong/DBGPavim.
Some screenshots (under windows) are here at http://sharing-from-brook.16002.n6.nabble.com/Debug-php-in-VIM-with-Xdebug-and-DBGPavim-td4930670.html.
## The enhancements are --
### Non blocking debugger backend.
So that VIM users do not need to wait for connection from apache server. No timeout things, users press F5 to start debugger backend, and uses his/her VIM normally. Debug backend won't stop users to interact with VIM. Users can press F6 to stop debugger backend anytime.
### Catch all connections from apache server.
This is very important for a large website, especially for thoes pages who contain AJAX requests. In that case, one reload of a page may trigger dozens of http request, each of them goes to a different URL. The new debugger backend will catch all connections from apache server. Users can debug all of them without missing anyone.
### Break only at breakpoints
let g:dbgPavimBreakAtEntry = 0
The setting will cause debugger backend to break only at breakpoints. Default value is 1, which means it works like before, the debugger backend breaks at entry.
### New commands and function keys
In normal mode
<F5> => start debugger backend
<F6> => stop debugger backend
<F8> => toggle dbgPavimBreakAtEntry, when g:dbgPavimBreakAtEntry=0, debugger backend breaks only at breakpoints.
:Bl => to list all breakpoints
:Bp => toggle breakpoint on current line
In debuggin mode
<F1> => toggle help window
<F2> => step into
<F3> => step over
<F4> => step out
<F5> => start debugging / run
<F6> => stop debugging
<F7> => evalute expression and display result. cursor is automatically move to watch window. type line and just press enter.
<F9> => toggle layout
<F11> => shows all variables
<F12> => shows variable on current cursor
:Pg => to print value of complex variables like $this->savings
:Up => goto upper level of stack
:Dn => goto lower level of stack
In Watch window
If you press Enter key at a line which ends with --
(object) => to get value of an object.
(array) => to get value of an array.
If you press Enter key at a line of output from command :Bl, that breakpoint will be located.
In Stack window
If you press Enter key at a line, stack level will be set.
### Windows Support
### Status line for debugger backend
After user press <F5> to start debugger backend, a string like "PHP-bae-LISN" will show up at the right side of status line.
The status string looks like --
bae => means Break At Entry
bap => means Break only At breakPoints
LISN => means the debugger backend is listening.
PENDn => means there are n connections waiting for debugging.
CONN => means debug session has been established, and being debugged.
CLSD => means the debugger backend has stopped.
### New layout of windows
### Remote debugging
In case that you need run VIM on a different machine from server where apache httpd runs, configuration for DBGPavim --
let g:dbgPavimPathMap = [['D:/works/php','/var/www'],]
Some change for Apache configuration is also necessary --
php_value xdebug.remote_host <ip_address_where_you_run_vim>
* Make sure your vim has python(at least 2.3) supported, in vim with command
In case of your VIM don't support python, download VIM source package from http://www.vim.org/download.php, then build your own VIM with commands --
./configure --prefix=/opt/vim --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.4/config
* Install xdebug for php, and edit php.ini
* Edit your ~/.vimrc
let g:dbgPavimPort = 9009
let g:dbgPavimBreakAtEntry = 0
* Edit your apche configure file
In your VirtualHost section, set debugger port same as the one in your vimrc
php_value xdebug.remote_port 9009
* Save debugger.py and debugger.vim to your ~/.vim/plugin
* Open your php file, use :Bp to set breakpoints
* Now, press F5 to start debugger backend
* Back to your browser, add XDEBUG_SESSION_START=1 to your URL, for example, http://localhost/index.php?XDEBUG_SESSION_START=1. If you would like to debug from CLI, start your php script like
php -dxdebug.remote_autostart=1 -dxdebug.remote_port=9009 test.php
If you are tied of adding XDEBUG_SESSION_START=1 in query string, there is a XDEBUG_SESSION helper at http://userscripts.org/scripts/review/132695, a user script for Google Chrome. It also works for Firefox with help of GreaseMonkey.
|Just unzip the zip file to your VIM file path, usually to be ~/.vim.
Click on the package to download.
ip used for rating: 220.127.116.11
||1. object/array expansion inline in watch window
2. list breakpoints to location list
3. some bug fixes
||1. pretty output in watch window for python debugging
2. user friendly notice of exception
3. :We [foo] => to eval expression `foo` automatically after each step
||1. :Wc $foo to toggle watch on variable $foo, :Wl to list watched variables
2. customizable key mappings
3. keep other tabs intact after debugging completed
4. bug fix for windows
||1. dbgPavimBreakAtEntry default as 0, so it will not break at entry by default.
2. doc for python debugging
3. :Dp command to debug current file from CLI
||1. remote debugging support
2. doc embeded
3. rename all global parameters from g:debuggerXXXX to g:dbgPavimXXXX