diff --git a/README.md b/README.md index 878a138..6c3589a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ interactive shell debugger, and comes with implementations for: * GDB - doesn't need introdcution... * JDB - a Java debugger + * Mdbg - a .NET debugger(Windows only) * PDB - a Python module for debugging Python scripts * RDebug - a Ruby command line option for debugging Ruby scripts @@ -38,10 +39,14 @@ Vebugger is built under the following assumptions: debugger has a cool feature I want to support, I'll implement it even if the other debuggers don't have it. -Vebugger is developed under Linux. I'll try it under Windows once I feel like -setting a Windows development environment, and fix what needs to be fixed to -make it work there. I have neither plans nor means to support OSX, but I will -accept pull requests that add OSX support. +Vebugger is developed under Linux. It doesn't work properly under Windows due +to lack of PTY support. I have neither plans nor means to support OSX, but I +will accept pull requests that add OSX support. + +The features that don't work under windows are: + + * RDebug. + * Displaying output from the debugged program. REQUIREMENTS ============ @@ -51,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 add9049..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={} @@ -18,7 +19,9 @@ function! vebugger#gdb#start(binaryFile,args) call l:debugger.writeLine('attach '.string(a:args.pid)) else call l:debugger.writeLine('set args '.vebugger#util#commandLineArgsForProgram(a:args).' 1>&2') - call vebugger#std#openShellBuffer(l:debugger) + if !has('win32') + call vebugger#std#openShellBuffer(l:debugger) + endif call l:debugger.writeLine('start') end diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index 5876430..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 @@ -11,7 +12,9 @@ function! vebugger#jdb#start(entryClass,args) call l:debugger.writeLine('stop on '.a:entryClass.'.main') call l:debugger.writeLine('run '.a:entryClass.' '.vebugger#util#commandLineArgsForProgram(a:args)) call l:debugger.writeLine('monitor where') - call vebugger#std#openShellBuffer(l:debugger) + if !has('win32') + call vebugger#std#openShellBuffer(l:debugger) + endif call l:debugger.addReadHandler(function('s:readProgramOutput')) call l:debugger.addReadHandler(function('s:readWhere')) diff --git a/autoload/vebugger/mdbg.vim b/autoload/vebugger/mdbg.vim new file mode 100644 index 0000000..e1b7611 --- /dev/null +++ b/autoload/vebugger/mdbg.vim @@ -0,0 +1,180 @@ +function! vebugger#mdbg#searchAndAttach(binaryFile,srcpath) + let l:processId=vebugger#util#selectProcessOfFile(a:binaryFile) + if 0\s*([^=]+)\=(.*)$') + if 2 License: Same terms as Vim itself (see |license|) -Version: 1.0.0 +Version: 1.1.0 INTRODUCTION *vebugger* @@ -21,6 +21,7 @@ Vebugger is built as a generic framework for building frontends for interactive shell debugger, and comes with implementations for: * GDB - doesn't need introdcution... * JDB - a Java debugger +* Mdbg - a .NET debugger(Windows only) * PDB - a Python module for debugging Python scripts * RDebug - a Ruby command line option for debugging Ruby scripts Other implementations can be added with ease, and I will accept pull requests @@ -39,10 +40,14 @@ Vebugger is built under the following assumptions: debugger has a cool feature I want to support, I'll implement it even if the other debuggers don't have it. -Vebugger is developed under Linux. I'll try it under Windows once I feel like -setting a Windows development environment, and fix what needs to be fixed to -make it work there. I have neither plans nor means to support OSX, but I will -accept pull requests that add OSX support. +Vebugger is developed under Linux. It doesn't work properly under Windows due +to lack of PTY support. I have neither plans nor means to support OSX, but I +will accept pull requests that add OSX support. + +The features that don't work under windows are: + +* RDebug. +* Displaying output from the debugged program. REQUIREMENTS *vebugger-requirements* @@ -53,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* @@ -67,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 @@ -151,6 +169,38 @@ PDB can also be launched with the *VBGstartPDB* command: VBGstartPDB script.py hello world < +LAUNCHING MDBG *vebugger-mdbg* + +Mdbg is launched with *vebugger#mdbg#start* +> + call vebugger#mdbg#start('App.exe',{ + \'srcpath':'src', + \'args':['hello','world']}) +< + +The supported extra arguments are: +* "srcpath": Where to look for source files +* "noConsole": If non-zero, do not open a console for the debugged program +* "args": Command line arguments for the debugged program +* "pid": Process id to attach to +If you specify "pid", you can't specify "args" and/or "noConsole". + +If you don't supply "srcpath", Vebugger will assume you are +using the current directory for source files. + +Mdbg does not have a command for starting it, since you usually want to supply +"srcpath". + +You can also search for a process with *vebugger#mdbg#searchAndAttach* +> + call vebugger#mdbg#searchAndAttach('App.exe','src') +< +Here the first argument is the executable and the second is the source files +directory. This will display a list of available processes to attach to. +Notice that unlike GDB, you need "src" here since Mdbg doesn't display full +source file paths. + + USING THE DEBUGGERS *vebugger-usage* *vebugger-commands* Once you have launched a debugger, you can use the following commands to