Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions autoload/vebugger/jdb.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
function! vebugger#jdb#start(entryClass,args)
function! vebugger#jdb#start(args)
if !has_key(a:args, 'con')
let a:args.con = 9009
endif

let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('jdb',get(a:args,'version'),'jdb'))
\.(has_key(a:args,'classpath') ? ' -classpath '.fnameescape(a:args.classpath) : ''))
\.(has_key(a:args,'classpath') ? ' -classpath '.fnameescape(a:args.classpath) : '')
\.(!has_key(a:args,'entryClass') ? ' -attach '.fnameescape(a:args.con) : ''))

let l:debugger.state.jdb={}
if has_key(a:args,'srcpath')
let l:debugger.state.jdb.srcpath=a:args.srcpath
Expand All @@ -9,11 +15,13 @@ function! vebugger#jdb#start(entryClass,args)
endif
let l:debugger.state.jdb.filesToClassesMap={}

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')
if !has('win32')
call vebugger#std#openShellBuffer(l:debugger)
if has_key(a:args, 'entryClass')
if !has('win32')
call vebugger#std#openShellBuffer(l:debugger)
endif
call l:debugger.writeLine('stop on '.a:args.entryClass.'.main')
call l:debugger.writeLine('run '.a:args.entryClass.' '.vebugger#util#commandLineArgsForProgram(a:args))
call l:debugger.writeLine('monitor where')
endif

call l:debugger.addReadHandler(function('vebugger#jdb#_readProgramOutput'))
Expand Down
14 changes: 9 additions & 5 deletions doc/vebugger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,26 @@ LAUNCHING JDB *vebugger-jdb*

JDB is launched with *vebugger#jdb#start*
>
call vebugger#jdb#start('Main',{
call vebugger#jdb#start({
\'entryClass':'Main',
\'classpath':'classes',
\'srcpath':'src',
\'args':['hello','world']})
<
Unlike in the other debuggers, the first argument here is not the name of a
file - it's the name of the class to run. The supported extra arguments are:
Unlike in the other debuggers, there is no first argument. The supported extra arguments are:
* "args": Command line arguments for the debugged program
* "classpath": Where to look for class files
* "srcpath": Where to look for source files
* "version": The version of the debugger to run
* "con": A connection string for attaching to an existing jvm. Ex. localhost:8000 or 8000
defaults to 9009, the standard debug port for jvms.
* "entryClass": A class that contains main for starting the jdb up with.
If entryClass is defined it takes precedence over con.
If you don't supply "classpath" and "srcpath", Vebugger will assume you are
using the current directory for source files and class files.

JDB does not have a command for starting it, since you usually want to supply
"classpath" and "srcpath".
JDB can be started with VBGstartJDB. If the desired the user can call the command with the extra
arguments that are defined above.


LAUNCHING RDEBUG *vebugger-rdebug*
Expand Down
1 change: 1 addition & 0 deletions plugin/vebugger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ command! -nargs=+ -complete=file VBGstartPDB call vebugger#pdb#start([<f-args>][
command! -nargs=+ -complete=file VBGstartPDB2 call vebugger#pdb#start([<f-args>][0],{'args':[<f-args>][1:],'version':'2'})
command! -nargs=+ -complete=file VBGstartPDB3 call vebugger#pdb#start([<f-args>][0],{'args':[<f-args>][1:],'version':'3'})
command! -nargs=+ -complete=file VBGstartGDBForD call vebugger#gdb#start([<f-args>][0],{'args':[<f-args>][1:],'entry':'_Dmain'})
command! -nargs=* -complete=command VBGstartJDB call vebugger#jdb#start(string(<q-args>) ? eval([<f-args>][0]) : {})

if exists('g:vebugger_leader')
if !empty(g:vebugger_leader)
Expand Down