diff --git a/autoload/vebugger/jdb.vim b/autoload/vebugger/jdb.vim index 741330b..3abff50 100644 --- a/autoload/vebugger/jdb.vim +++ b/autoload/vebugger/jdb.vim @@ -1,70 +1,70 @@ function! vebugger#jdb#start(entryClass,args) - let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('jdb',get(a:args,'version'),'jdb')) - \.(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={} - if has_key(a:args,'srcpath') - let l:debugger.state.jdb.srcpath=a:args.srcpath - else - let l:debugger.state.jdb.srcpath='.' - endif - let l:debugger.state.jdb.filesToClassesMap={} + let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('jdb',get(a:args,'version'),'jdb')) + \.(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={} + if has_key(a:args,'srcpath') + let l:debugger.state.jdb.srcpath=a:args.srcpath + else + let l:debugger.state.jdb.srcpath='.' + endif + let l:debugger.state.jdb.filesToClassesMap={} - if !has_key(a:args,'attach') - 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') - if !has('win32') && !has_key(a:args,'attach') - call vebugger#std#openShellBuffer(l:debugger) - endif + if !has_key(a:args,'attach') + 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') + if !has('win32') && !has_key(a:args,'attach') + call vebugger#std#openShellBuffer(l:debugger) + endif - call l:debugger.addReadHandler(function('vebugger#jdb#_readProgramOutput')) - call l:debugger.addReadHandler(function('vebugger#jdb#_readWhere')) - call l:debugger.addReadHandler(function('vebugger#jdb#_readException')) - call l:debugger.addReadHandler(function('vebugger#jdb#_readEvaluatedExpressions')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readProgramOutput')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readWhere')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readException')) + call l:debugger.addReadHandler(function('vebugger#jdb#_readEvaluatedExpressions')) - call l:debugger.setWriteHandler('std','flow',function('vebugger#jdb#_writeFlow')) - call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#jdb#_writeBreakpoints')) - call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#jdb#_requestEvaluateExpression')) - call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#jdb#_executeStatements')) + call l:debugger.setWriteHandler('std','flow',function('vebugger#jdb#_writeFlow')) + call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#jdb#_writeBreakpoints')) + call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#jdb#_requestEvaluateExpression')) + call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#jdb#_executeStatements')) - call l:debugger.generateWriteActionsFromTemplate() + call l:debugger.generateWriteActionsFromTemplate() - call l:debugger.std_addAllBreakpointActions(g:vebugger_breakpoints) + call l:debugger.std_addAllBreakpointActions(g:vebugger_breakpoints) - return l:debugger + return l:debugger 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) + 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 - if 'out'==a:pipeName - if a:line=~'\v^\> \>' - \||a:line=='> ' - \||a:line=~'\v^Step completed' - \||a:line=~'\v^Breakpoint hit' - \||a:line=~'\v^\> Deferring breakpoint' - \||a:line=='Nothing suspended.' - \||a:line=~'\v^\> run ' "Signs that the output finished - let self.programOutputMode=0 - elseif a:line=~'\v(step|step up|next|cont)$' "Next line should be output - let self.programOutputMode=1 - elseif a:line=~'\v^\> [^>]' "Start of output - let a:readResult.std.programOutput={'line':substitute(a:line,'\v^\> ','','')} - let self.programOutputMode=1 - elseif get(self,'programOutputMode') - let a:readResult.std.programOutput={'line':a:line} - endif - else - let a:readResult.std.programOutput={'line':a:line} - endif + if 'out'==a:pipeName + if a:line=~'\v^\> \>' + \||a:line=='> ' + \||a:line=~'\v^Step completed' + \||a:line=~'\v^Breakpoint hit' + \||a:line=~'\v^\> Deferring breakpoint' + \||a:line=='Nothing suspended.' + \||a:line=~'\v^\> run ' "Signs that the output finished + let self.programOutputMode=0 + elseif a:line=~'\v(step|step up|next|cont)$' "Next line should be output + let self.programOutputMode=1 + elseif a:line=~'\v^\> [^>]' "Start of output + let a:readResult.std.programOutput={'line':substitute(a:line,'\v^\> ','','')} + let self.programOutputMode=1 + elseif get(self,'programOutputMode') + let a:readResult.std.programOutput={'line':a:line} + endif + else + let a:readResult.std.programOutput={'line':a:line} + endif endfunction function! s:getTagContainingString(tag, str) @@ -107,106 +107,139 @@ function! s:findFolderFromStackTrace(src,nameFromStackTrace,frameNumber) let l:path=l:nextPath endfor endfor - return l:path + return l:path endfunction function! vebugger#jdb#_readWhere(pipeName,line,readResult,debugger) - if 'out'==a:pipeName - let l:matches=matchlist(a:line,'\v\s*\[(\d+)]\s*(\S+)\s*\(([^:]*):(\d*)\)') - if 4