Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed project to Vdebug and added help file

  • Loading branch information...
commit 88152df88053d62960bbf7a2eae7b2a287595ef0 1 parent 02b70ab
@joonty authored
View
4 LICENCE
@@ -1,8 +1,4 @@
Copyright © 2012 Jon Cairns <jon AT joncairns.com>
- 2011 Ludovic Pelle <ludovic_pelle AT carpe-hora.com>
- 2011 Kévin Gomez <contact AT kevingomez.fr>
- 2007 Sam Ghods <sam AT box.net>
- 2004 Seung Woo Shin <segv AT sayclub.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
113 doc/Vdebug.txt
@@ -0,0 +1,113 @@
+*Vdebug* A powerful, fast, multi-language debugger for Vim
+
+
+ 888 888 888 888
+ 888 888 888 888
+ 888 888 888 888
+ Y88b d88P .d88888 .d88b. 88888b. 888 888 .d88b.
+ Y88b d88P d88" 888 d8P Y8b 888 "88b 888 888 d88P"88b
+ Y88o88P 888 888 88888888 888 888 888 888 888 888
+ Y888P Y88b 888 Y8b. 888 d88P Y88b 888 Y88b 888
+ Y8P "Y88888 "Y8888 88888P" "Y88888 "Y88888
+ 888
+ Y8b d88P
+ "Y88P"
+
+
+
+===============================================================================
+CONTENTS *Vdebug-contents*
+
+ 1. Introduction..................................|VdebugIntro|
+ 1.1 Debugging................................|VdebugIntroDebugging|
+ 1.2 The DBGP protocol........................|VdebugIntroDBGP|
+ 1.3 Supported languages......................|VdebugIntroLanguages|
+ 2. Installing the plugin.........................|VdebugInstallation|
+ 3. Setting up the debugging environment..........|VdebugSetUp|
+ 4. Options.......................................|VdebugOptions|
+ 5. Usage.........................................|VdebugUsage|
+ 5.1 Starting the debugger....................|VdebugStart|
+ 5.2 Finding your way around the UI...........|VdebugUI|
+ 5.2.1 The source window..................|VdebugSourceWindow|
+ 5.2.2 The watch window...................|VdebugWatchWindow|
+ 5.2.3 The stack window...................|VdebugStackWindow|
+ 5.2.4 The status window..................|VdebugStatusWindow|
+ 5.2.5 The breakpoint window..............|VdebugBreakpointWindow|
+ 5.3 Commands.................................|VdebugCommands|
+ 5.3.1 Run................................|VdebugCommandRun|
+ 5.3.2 Step over..........................|VdebugCommandStepOver|
+ 5.3.3 Step in............................|VdebugCommandStepIn|
+ 5.3.4 Step out...........................|VdebugCommandStepOut|
+ 5.3.5 Run to cursor......................|VdebugCommandRunToCursor|
+ 5.3.6 Detach.............................|VdebugCommandDetach|
+ 5.3.7 Stop/close.........................|VdebugCommandStop|
+ 5.4 Breakpoints..............................|VdebugBreakpoints|
+ 5.4.1 Setting a line breakpoint..........|VdebugSetLineBreakpoint|
+ 5.4.2 Removing a line breakpoint.........|VdebugRemoveLineBreakpoint|
+ 5.4.3 Setting all breakpoints............|VdebugSetBreakpoint|
+ 5.4.4 Breakpoint types...................|VdebugBreakpointTypes|
+ 5.4.5 The breakpoint window..............|VdebugBreakpointWindow|
+ 5.4.6 Removing all breakpoints...........|VdebugRemoveBreakpoint|
+ 5.5 Evaluating expressions...................|VdebugEval|
+ 5.5.1 Evaluating any expression..........|VdebugEvalExpression|
+ 5.5.2 Evaluating highlighted expressions.|VdebugEvalHighlighted|
+ 6. Using an IDE key..............................|VdebugIDEKey|
+ 7. Debugging a script on a remote server.........|VdebugRemote|
+
+==============================================================================
+1. Introduction *VdebugIntro*
+
+So what does this plugin actually do?
+
+It provides an interface for debugging scripts, allowing you to halt execution,
+view the variables at the current position and find out exactly what's going on
+in your program. It supports the DBGP protocol, which includes all types of
+breakpoint, code snippet evaluation, and more.
+
+------------------------------------------------------------------------------
+1.1 Debugging *VdebugIntroDebugging*
+
+Debugging is mainly used to do what the name suggests: weed out bugs that are
+appearing in your program. Using a debugging tool means that you don't have to
+resort to 'print' statements or writing out to logs to find out where your
+program is going wrong: you can pause execution, step through line by line and
+break at certain points to see what's going on.
+
+This is nothing new, and IDEs have been supporting debuggers for many years. In
+fact, Vim has had several plugins that support debuggers, most notably the long
+line of related Xdebug plugins for PHP.
+
+So why have I created a new one? There are a few reasons:
+
+ * The Xdebug plugin was getting too complicated, and all the code was in
+ one file, making it difficult to navigate and maintain.
+ * It wasn't truly multi-language, and was mainly focussed on Xdebug with
+ PHP. I wanted a debugger that could work identically with any language
+ that had debuggers using the DBGP protocol.
+ * There were some inefficiencies in the Xdebug plugin that affected the
+ speed, which I knew could be addressed.
+ * I wanted to create a set of Python classes that could be used on their
+ own outside of Vim, that provided an interface to debuggers.
+ * There were extra features that I wanted to build in, and doing so in the
+ original plugin would have meant a rewrite anyway.
+
+I hope you find this plugin helpful and enjoyable to use :)
+
+------------------------------------------------------------------------------
+1.2 The DBGP protocol
+
+This is a protocol that defines the communication between an IDE and debugger
+engine. The IDE speaks to the engine in pre-defined plain text commands, such as:
+
+ breakpoint_set -i 10 -t line -f /home/user/example.php -n 5
+
+The debugger engine replies in XML, such as:
+
+ <response command="breakpoint_set"
+ transaction_id="10"
+ state="enabled"
+ id="1"/>
+
+That makes the protocol cross platform and pretty easy to implement. One of the
+Python modules (files), called 'dbgp.py', is a set of classes that provide
+socket handling and a object-oriented interface to the most common operations.
View
2  doc/tags
@@ -0,0 +1,2 @@
+Vdebug-contents Vdebug.txt /*Vdebug-contents*
+Vdebug.txt Vdebug.txt /*Vdebug.txt*
View
196 plugin/debugger.vim
@@ -1,196 +0,0 @@
-" DBGp client: a remote debugger interface to the DBGp protocol
-"
-" Script Info and Documentation {{{
-"=============================================================================
-" Copyright: Copyright (C) 2007 Sam Ghods
-" License: The MIT License
-"
-" Permission is hereby granted, free of charge, to any person obtaining
-" a copy of this software and associated documentation files
-" (the "Software"), to deal in the Software without restriction,
-" including without limitation the rights to use, copy, modify,
-" merge, publish, distribute, sublicense, and/or sell copies of the
-" Software, and to permit persons to whom the Software is furnished
-" to do so, subject to the following conditions:
-"
-" The above copyright notice and this permission notice shall be included
-" in all copies or substantial portions of the Software.
-"
-" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-" Name Of File: debugger.vim, debugger.py
-" Description: remote debugger interface to DBGp protocol
-" Maintainer: Sam Ghods <sam <at> box.net>
-" Last Change: June 18, 2007
-" URL: http://www.vim.org/scripts/script.php?script_id=1929
-" Version: 1.1.1
-" Originally written by Seung Woo Shin <segv <at> sayclub.com>
-" The original script is located at:
-" http://www.vim.org/scripts/script.php?script_id=1152
-" Usage: N.B.: For a complete tutorial on how to setup this script,
-" please visit:
-" http://tech.blog.box.net/2007/06/20/how-to-debug-php-with-vim-and-xdebug-on-linux/
-" -----
-"
-" This file should reside in the plugins directory along
-" with debugger.py and be automatically sourced.
-"
-" By default, the script expects the debugging engine to connect
-" on port 9000. You can change this with the g:debuggerPort
-" variable by putting the following line your vimrc:
-"
-" let g:debuggerPort = 10001
-"
-" where 10001 is the new port number you want the server to
-" connect to.
-"
-" There are three maximum limits you can set referring to the
-" properties (variables) returned by the debugging engine.
-"
-" g:debuggerMaxChildren (default 32): The max number of array or
-" object children to initially retrieve per variable.
-" For example:
-"
-" let g:debuggerMaxChildren = 64
-"
-" g:debuggerMaxData (default 1024 bytes): The max amount of
-" variable data to retrieve.
-" For example:
-"
-" let g:debuggerMaxData = 2048
-"
-" g:debuggerMaxDepth (default 1): The maximum depth that the
-" debugger engine may return when sending arrays, hashs or
-" object structures to the IDE.
-" For example:
-"
-" let g:debuggerMaxDepth = 10
-"
-" Finally, if you use the Mini Buffer Explorer vim plugin,
-" minibufexpl.vim, running the debugger may mess up your window
-" setup. As a result the script has support to close and open
-" the explorer when you enter and quit debugging sessions. To
-" enable this support, add the following line to your vimrc:
-"
-" let g:debuggerMiniBufExpl = 1
-"
-" History: 1.1.1 o Added a check so the script doesn't load if python is
-" not compiled in. (Contributed by Lars Becker.)
-" 1.1 o Added vim variable to change port.
-" o You can now put debugger.py in either runtime directory
-" or the home directory.
-" o Added to ability to change max children, data and depth
-" settings.
-" o Made it so stack_get wouldn't be called if the debugger
-" has already stopped.
-" o Added support for minibufexpl.vim.
-" o License added.
-" 1.0 o Initial release on December 7, 2004
-"
-" Known Issues: The code is designed for the DBGp protocol, but it has only been
-" tested with XDebug 2.0RC4. If anyone would like to contribute patches
-" to get it working with other DBGp software, I would be happy
-" to implement them.
-"
-" Sometimes things go a little crazy... breakpoints don't show
-" up, too many windows are created / not enough are closed, and
-" so on... if you can actually find a set of solidly
-" reproducible steps that lead to a bug, please do e-mail <sam
-" <at> box.net> and I will take a look.
-"
-" Todo: Compatibility for other DBGp engines.
-"
-" Add a status line/window which constantly shows what the current
-" status of the debugger is. (starting, break, stopped, etc.)
-"
-"=============================================================================
-" }}}
-
-" Do not source this script when python is not compiled in.
-if !has("python")
- finish
-endif
-
-" Load debugger.py either from the runtime directory (usually
-" /usr/local/share/vim/vim71/plugin/ if you're running Vim 7.1) or from the
-" home vim directory (usually ~/.vim/plugin/).
-if filereadable($VIMRUNTIME."/plugin/python/debugger.py")
- pyfile $VIMRUNTIME/plugin/debugger.py
-elseif filereadable($HOME."/.vim/plugin/python/debugger.py")
- pyfile $HOME/.vim/plugin/python/debugger.py
-else
- " when we use pathogen for instance
- let $CUR_DIRECTORY=expand("<sfile>:p:h")
-
- if filereadable($CUR_DIRECTORY."/python/debugger.py")
- pyfile $CUR_DIRECTORY/python/debugger.py
- else
- call confirm('debugger.vim: Unable to find debugger.py. Place it in either your home vim directory or in the Vim runtime directory.', 'OK')
- endif
-endif
-
-if !exists("g:debugger_options")
- let g:debugger_options = {}
-endif
-
-if !exists("g:debugger_keymap")
- let g:debugger_keymap = {}
-endif
-
-let g:debugger_keymap_defaults = {
-\ "run" : "<F5>",
-\ "run_to_cursor" : "<F1>",
-\ "step_over" : "<F2>",
-\ "step_into" : "<F3>",
-\ "step_out" : "<F4>",
-\ "close" : "<F6>",
-\ "set_breakpoint" : "<F8>",
-\}
-
-let g:debugger_options_defaults = {
-\ "port" : 9000,
-\ "timeout" : 30,
-\ "server" : 'localhost',
-\ "on_close" : 'detach',
-\ "ide_key" : '',
-\ "debug_window_level" : 0,
-\ "debug_file_level" : 2,
-\ "debug_file" : "/home/jon/monkeys",
-\ "remote_path" : "/home/pi/projects",
-\ "local_path" : "/home/jon",
-\}
-
-let g:debugger_options = extend(g:debugger_options_defaults,g:debugger_options)
-let g:debugger_keymap = extend(g:debugger_keymap_defaults,g:debugger_keymap)
-
-for [s:fname, s:key] in items(g:debugger_keymap)
- exe "map ".s:key." :python vdebug.".s:fname."()<cr>"
-endfor
-
-vnoremap <Leader>e :python vdebug.handle_visual_eval()<cr>
-
-command! -nargs=? Breakpoint python vdebug.set_breakpoint('<args>')
-command! -nargs=? BreakpointRemove python vdebug.remove_breakpoint('<args>')
-command! BreakpointWindow python vdebug.toggle_breakpoint_window()
-
-command! -nargs=? DebuggerEval python vdebug.handle_eval('<args>')
-
-sign define current text=-> texthl=DbgCurrent linehl=DbgCurrent
-sign define breakpt text=B> texthl=DbgBreakPt linehl=DbgBreakPt
-
-hi DbgCurrent term=reverse ctermfg=White ctermbg=Red gui=reverse
-hi DbgBreakPt term=reverse ctermfg=White ctermbg=Green gui=reverse
-
-function! debugger:get_visual_selection()
- let [lnum1, col1] = getpos("'<")[1:2]
- let [lnum2, col2] = getpos("'>")[1:2]
- let lines = getline(lnum1, lnum2)
- let lines[-1] = lines[-1][: col2 - 1]
- let lines[0] = lines[0][col1 - 1:]
- return join(lines, "\n")
-endfunction
View
2  plugin/python/debugger.py
@@ -382,7 +382,7 @@ def eval(self,code):
self.ui.watchwin.accept_renderer(rend)
def handle_visual_eval(self):
- selection = vim.eval("debugger:get_visual_selection()")
+ selection = vim.eval("vdebug:get_visual_selection()")
self.eval(selection)
def run_to_cursor(self):
View
2  plugin/python/ui/vimui.py
@@ -383,7 +383,7 @@ class StatusWindow(Window):
def on_create(self):
self.write("Status: starting\nListening on port\nNot connected\n\nPress <F5> to start "+\
"debugging, <F6> to stop/close. Type "+\
- ":help vim-debugger for more information.")
+ ":help Vdebug for more information.")
self.command('setlocal syntax=debugger_status')
if self.creation_count == 1:
cmd = 'au BufWinLeave %s :silent! bdelete %s' %(self.name,self.name)
View
103 plugin/vdebug.vim
@@ -0,0 +1,103 @@
+" Powerful, fast, multi-language debugger client for Vim.
+"
+" Script Info and Documentation {{{
+"=============================================================================
+" Copyright: Copyright (C) 2012 Jon Cairns
+" Licence: The MIT Licence (see LICENCE file)
+" Name Of File: vdebug.vim
+" Description: Multi-language debugger client for Vim
+" Maintainer: Jon Cairns <jon at joncairns.com>
+" Last Change: June 18, 2007
+" Version: 1.0
+" Inspired by the Xdebug plugin, which was originally written by
+" Seung Woo Shin <segv <at> sayclub.com> and extended by many
+" others.
+" Usage: Use :help Vdebug for information on how to configure and use
+" this script, or visit the Github page http://github.com/joonty/vdebug.
+"
+"=============================================================================
+" }}}
+
+" Do not source this script when python is not compiled in.
+if !has("python")
+ finish
+endif
+
+" Load debugger.py either from the runtime directory (usually
+" /usr/local/share/vim/vim71/plugin/ if you're running Vim 7.1) or from the
+" home vim directory (usually ~/.vim/plugin/).
+if filereadable($VIMRUNTIME."/plugin/python/debugger.py")
+ pyfile $VIMRUNTIME/plugin/debugger.py
+elseif filereadable($HOME."/.vim/plugin/python/debugger.py")
+ pyfile $HOME/.vim/plugin/python/debugger.py
+else
+ " when we use pathogen for instance
+ let $CUR_DIRECTORY=expand("<sfile>:p:h")
+
+ if filereadable($CUR_DIRECTORY."/python/debugger.py")
+ pyfile $CUR_DIRECTORY/python/debugger.py
+ else
+ call confirm('debugger.vim: Unable to find debugger.py. Place it in either your home vim directory or in the Vim runtime directory.', 'OK')
+ endif
+endif
+
+if !exists("g:debugger_options")
+ let g:debugger_options = {}
+endif
+
+if !exists("g:debugger_keymap")
+ let g:debugger_keymap = {}
+endif
+
+let g:debugger_keymap_defaults = {
+\ "run" : "<F5>",
+\ "run_to_cursor" : "<F1>",
+\ "step_over" : "<F2>",
+\ "step_into" : "<F3>",
+\ "step_out" : "<F4>",
+\ "close" : "<F6>",
+\ "set_breakpoint" : "<F8>",
+\}
+
+let g:debugger_options_defaults = {
+\ "port" : 9000,
+\ "timeout" : 30,
+\ "server" : 'localhost',
+\ "on_close" : 'detach',
+\ "ide_key" : '',
+\ "debug_window_level" : 0,
+\ "debug_file_level" : 2,
+\ "debug_file" : "/home/jon/monkeys",
+\ "remote_path" : "/home/pi/projects",
+\ "local_path" : "/home/jon",
+\}
+
+let g:debugger_options = extend(g:debugger_options_defaults,g:debugger_options)
+let g:debugger_keymap = extend(g:debugger_keymap_defaults,g:debugger_keymap)
+
+for [s:fname, s:key] in items(g:debugger_keymap)
+ exe "map ".s:key." :python vdebug.".s:fname."()<cr>"
+endfor
+
+vnoremap <Leader>e :python vdebug.handle_visual_eval()<cr>
+
+command! -nargs=? Breakpoint python vdebug.set_breakpoint('<args>')
+command! -nargs=? BreakpointRemove python vdebug.remove_breakpoint('<args>')
+command! BreakpointWindow python vdebug.toggle_breakpoint_window()
+
+command! -nargs=? VdebugEval python vdebug.handle_eval('<args>')
+
+sign define current text=-> texthl=DbgCurrent linehl=DbgCurrent
+sign define breakpt text=B> texthl=DbgBreakPt linehl=DbgBreakPt
+
+hi DbgCurrent term=reverse ctermfg=White ctermbg=Red gui=reverse
+hi DbgBreakPt term=reverse ctermfg=White ctermbg=Green gui=reverse
+
+function! vdebug:get_visual_selection()
+ let [lnum1, col1] = getpos("'<")[1:2]
+ let [lnum2, col2] = getpos("'>")[1:2]
+ let lines = getline(lnum1, lnum2)
+ let lines[-1] = lines[-1][: col2 - 1]
+ let lines[0] = lines[0][col1 - 1:]
+ return join(lines, "\n")
+endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.