At the time of writng I am using Debian Testing (stretch). The php-xdebug package has php7.0 as a dependency so it will be installed by default.
apt-get install php-xdebug
The vdebug plugin requires python support in vim, but the version supplied by Debian
only supports python3. So first step is to compile your own version of vim with python.
I added to my .bashrc alias 'vimdgb=/path/to/my/vim/with/python'
- install vdebug https://github.com/joonty/vdebug
- press <f5> to start the debug session, it displays 'waiting for connection'
- navigate to the page with a uri like
http://localhost/myapp/index.php?XDEBUG_SESSION_START=dd1
Run <f5>
Step Over <f2>
Step In <f3>
Step Out <f4>
Run to cursor <f9>
Detach <f7> End debugging but let execution carry on as normal.
Stop <f6> kill the program and close the debugger UI.
Set/remove Breakpoint <f10>
Return to context view after evaluating an expression: <f11>
Evaluate variable under cursor: <f12>
vdebug has the following options for breakpoints:
- line: stop at line. Set and remove with . Normal breakpoint.
- conditional: :Breakpoint conditional . Break when this condition occurs.
- exception: :Breakpoint exception . Break when this exception occurs.
- call: :Breakpoint call . Break when function is called.
- return: :Breakpoint return . Break when function returns.
- watch: :Breakpoint watch . Break when value changes. Not supported in xdebug!
:Breakpoint conditional $x > 4
:Breakpoint exception PDOException
:Breakpoint call open_file
:Breakpoint call MyClass::OpenFile
:Breakpoint return open_file
:Breakpoint return MyClass::OpenFile
:Breakpoint watch $myvar
Set/remove line breakpoint <f10>
vdebug doesn't show breakpoints by default, but can open a window to show them. :BreakpointWindow To close, retype :BreakpointWindow or q
:VDebugTrace <expression>
example: :VDebugTrace $x
This opens the trace window which will show how any piece of code is evaluated as your code executes. The window stays oen until you close it manually.