From 722d1e49b808d0ec45d7d2f02e5d9d89fd90aeb2 Mon Sep 17 00:00:00 2001 From: IdanArye Date: Fri, 23 May 2014 17:43:01 +0300 Subject: [PATCH] Make GDB, JDB, PDB and RDebug look at global variables for exeutable paths. Mdbg already had this feature, since the Windows SDK doesn't normally put it in the PATH(just like any other Microsoft tool that assumes you are going to use Visual Studio and don't need the PATH...) --- README.md | 3 ++- autoload/vebugger/gdb.vim | 3 ++- autoload/vebugger/jdb.vim | 3 ++- autoload/vebugger/pdb.vim | 3 ++- autoload/vebugger/rdebug.vim | 3 ++- doc/vebugger.txt | 19 ++++++++++++++++--- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0899cc6..6c3589a 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,8 @@ https://github.com/Shougo/vimproc.vim. Notice that vimproc needs to be built - there are instructions in the GitHub page. In order for Vebugger to use a debugger, that debugger must be installed and -it's executable must be in the PATH. In case of RDebug and PDB, which are used +it's executable must be either be in the PATH or set with a global variable +(see `help vebugger-configuration`). In case of RDebug and PDB, which are used from the Ruby and Python modules, the interpreter(`ruby` or `python`) is the one that must be installed and in the path. diff --git a/autoload/vebugger/gdb.vim b/autoload/vebugger/gdb.vim index 0d6e2cf..4c4334f 100644 --- a/autoload/vebugger/gdb.vim +++ b/autoload/vebugger/gdb.vim @@ -6,7 +6,8 @@ function! vebugger#gdb#searchAndAttach(binaryFile) endfunction function! vebugger#gdb#start(binaryFile,args) - let l:debugger=vebugger#std#startDebugger('gdb -i mi --silent '.fnameescape(a:binaryFile)) + let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('gdb','gdb')) + \.' -i mi --silent '.fnameescape(a:binaryFile)) let l:debugger.state.gdb={} diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index 4b72286..5fa38e9 100644 --- a/autoload/vebugger/jdb.vim +++ b/autoload/vebugger/jdb.vim @@ -1,5 +1,6 @@ function! vebugger#jdb#start(entryClass,args) - let l:debugger=vebugger#std#startDebugger('jdb'.(has_key(a:args,'classpath') ? ' -classpath '.fnameescape(a:args.classpath) : '')) + let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('jdb','jdb')) + \.(has_key(a:args,'classpath') ? ' -classpath '.fnameescape(a:args.classpath) : '')) let l:debugger.state.jdb={} if has_key(a:args,'srcpath') let l:debugger.state.jdb.srcpath=a:args.srcpath diff --git a/autoload/vebugger/pdb.vim b/autoload/vebugger/pdb.vim index 9b4cba1..43f8d5f 100644 --- a/autoload/vebugger/pdb.vim +++ b/autoload/vebugger/pdb.vim @@ -1,5 +1,6 @@ function! vebugger#pdb#start(entryFile,args) - let l:debugger=vebugger#std#startDebugger('python -m pdb '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args)) + let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('python','python')) + \.' -m pdb '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args)) let l:debugger.state.pdb={} diff --git a/autoload/vebugger/rdebug.vim b/autoload/vebugger/rdebug.vim index 885c426..e42e91c 100644 --- a/autoload/vebugger/rdebug.vim +++ b/autoload/vebugger/rdebug.vim @@ -1,5 +1,6 @@ function! vebugger#rdebug#start(entryFile,args) - let l:debugger=vebugger#std#startDebugger('ruby -rdebug '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args)) + let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('ruby','ruby')) + \.' -rdebug '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args)) let l:debugger.state.rdebug={} let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules diff --git a/doc/vebugger.txt b/doc/vebugger.txt index 7b9860d..66bdfb1 100644 --- a/doc/vebugger.txt +++ b/doc/vebugger.txt @@ -58,9 +58,10 @@ Notice that vimproc needs to be built - there are instructions in the GitHub page. In order for Vebugger to use a debugger, that debugger must be installed and -it's executable must be in the PATH. In case of RDebug and PDB, which are used -from the Ruby and Python modules, the interpreter("ruby" or "python") is the -one that must be installed and in the path. +it's executable must either be in the PATH or set with a global variable (see +|vebugger-configuration|). In case of RDebug and PDB, which are used from the +Ruby and Python modules, the interpreter("ruby" or "python") is the one that +must be installed and in the path. CONFIGURATION *vebugger-configuration* @@ -72,6 +73,18 @@ Example: > let g:vebugger_leader='d' < +If a debugger is not in the PATH you can set the direct path to it by setting +g:vebugger_path_XXX, where XXX is the executable used for the debugger: + +*g:vebugger_path_gdb* defaults to "gdb" +*g:vebugger_path_jdb* defaults to "jdb" +*g:vebugger_path_mdbg* defaults to "Mdbg.exe" +*g:vebugger_path_python* defaults to "python" +*g:vebugger_path_ruby* defaults to "ruby" + +Notice that for PDB and RDebug you use "python" and "ruby", since the debugger +is actually a module bundled in the interpreter. + LAUNCHING DEBUGGERS *vebugger-launching* A debugger's implementation is responsible for starting it. The standard is to