Merge pull request #55 from nemrod/jdbattach
Add support for attaching JDB to a running process
This commit is contained in:
commit
aea7ad4639
@ -1,6 +1,7 @@
|
|||||||
function! vebugger#jdb#start(entryClass,args)
|
function! vebugger#jdb#start(entryClass,args)
|
||||||
let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('jdb',get(a:args,'version'),'jdb'))
|
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') && !has_key(a:args,'attach') ? ' -classpath '.fnameescape(a:args.classpath) : '')
|
||||||
|
\.(has_key(a:args,'attach') ? ' -attach '.shellescape(a:args.attach) : ''))
|
||||||
let l:debugger.state.jdb={}
|
let l:debugger.state.jdb={}
|
||||||
if has_key(a:args,'srcpath')
|
if has_key(a:args,'srcpath')
|
||||||
let l:debugger.state.jdb.srcpath=a:args.srcpath
|
let l:debugger.state.jdb.srcpath=a:args.srcpath
|
||||||
@ -9,10 +10,14 @@ function! vebugger#jdb#start(entryClass,args)
|
|||||||
endif
|
endif
|
||||||
let l:debugger.state.jdb.filesToClassesMap={}
|
let l:debugger.state.jdb.filesToClassesMap={}
|
||||||
|
|
||||||
call l:debugger.writeLine('stop on '.a:entryClass.'.main')
|
if !has_key(a:args,'attach')
|
||||||
call l:debugger.writeLine('run '.a:entryClass.' '.vebugger#util#commandLineArgsForProgram(a:args))
|
call l:debugger.writeLine('stop on '.a:entryClass.'.main')
|
||||||
|
call l:debugger.writeLine('run '.a:entryClass.' '.vebugger#util#commandLineArgsForProgram(a:args))
|
||||||
|
else
|
||||||
|
call l:debugger.writeLine('run')
|
||||||
|
endif
|
||||||
call l:debugger.writeLine('monitor where')
|
call l:debugger.writeLine('monitor where')
|
||||||
if !has('win32')
|
if !has('win32') && !has_key(a:args,'attach')
|
||||||
call vebugger#std#openShellBuffer(l:debugger)
|
call vebugger#std#openShellBuffer(l:debugger)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -33,6 +38,12 @@ function! vebugger#jdb#start(entryClass,args)
|
|||||||
return l:debugger
|
return l:debugger
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! vebugger#jdb#attach(address, ...)
|
||||||
|
let l:args = a:0 ? a:{1} : {}
|
||||||
|
let l:args.attach = a:address
|
||||||
|
call vebugger#jdb#start('', l:args)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! vebugger#jdb#_readProgramOutput(pipeName,line,readResult,debugger) dict
|
function! vebugger#jdb#_readProgramOutput(pipeName,line,readResult,debugger) dict
|
||||||
if 'out'==a:pipeName
|
if 'out'==a:pipeName
|
||||||
if a:line=~'\v^\> \>'
|
if a:line=~'\v^\> \>'
|
||||||
|
@ -212,6 +212,15 @@ file - it's the name of the class to run. The supported extra arguments are:
|
|||||||
* "classpath": Where to look for class files
|
* "classpath": Where to look for class files
|
||||||
* "srcpath": Where to look for source files. You can have multiple srcpaths, passed as a list
|
* "srcpath": Where to look for source files. You can have multiple srcpaths, passed as a list
|
||||||
* "version": The version of the debugger to run
|
* "version": The version of the debugger to run
|
||||||
|
|
||||||
|
Alternatively, to attach to a running process you can use *vebugger#jdb#attach*
|
||||||
|
>
|
||||||
|
call vebugger#jdb#attach('8000',{
|
||||||
|
\'srcpath':'src'})
|
||||||
|
<
|
||||||
|
The first argument here is the the address to attach to, e.g. 127.0.0.1:8000
|
||||||
|
or just 8000. It does not support the "args" or "classpath" arguments.
|
||||||
|
|
||||||
If you don't supply "classpath" and "srcpath", Vebugger will assume you are
|
If you don't supply "classpath" and "srcpath", Vebugger will assume you are
|
||||||
using the current directory for source files and class files.
|
using the current directory for source files and class files.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user