Added command-line-arguments support for all debuggers.
Won't work, ofcourse, when attaching a debugger to a running process...
This commit is contained in:
parent
88ad7dbae7
commit
71671f0fa4
@ -6,11 +6,6 @@ function! vebugger#gdb#searchAndAttach(binaryFile)
|
||||
endfunction
|
||||
|
||||
function! vebugger#gdb#start(binaryFile,args)
|
||||
"let l:debugger=vebugger#std#startDebugger(
|
||||
"\(has_key(a:args,'command')
|
||||
"\? (a:args.command)
|
||||
"\: 'gdb -i mi --silent '.fnameescape(a:binaryFile)))
|
||||
|
||||
let l:debugger=vebugger#std#startDebugger('gdb -i mi --silent '.fnameescape(a:binaryFile))
|
||||
let l:debugger.state.gdb={}
|
||||
|
||||
@ -22,7 +17,7 @@ function! vebugger#gdb#start(binaryFile,args)
|
||||
if get(a:args,'pid') "Attach to process
|
||||
call l:debugger.writeLine('attach '.string(a:args.pid))
|
||||
else
|
||||
call l:debugger.writeLine("set args 1>&2")
|
||||
call l:debugger.writeLine('set args '.vebugger#util#commandLineArgsForProgram(a:args).' 1>&2')
|
||||
call vebugger#std#openShellBuffer(l:debugger)
|
||||
call l:debugger.writeLine('start')
|
||||
end
|
||||
|
@ -1,11 +1,5 @@
|
||||
function! vebugger#jdb#start(entryClass,args)
|
||||
let l:debugger=vebugger#std#startDebugger(
|
||||
\(has_key(a:args,'command')
|
||||
\? (a:args.command)
|
||||
\: 'jdb')
|
||||
\.(has_key(a:args,'classpath')
|
||||
\? ' -classpath '.fnameescape(a:args.classpath)
|
||||
\: ''))
|
||||
let l:debugger=vebugger#std#startDebugger('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
|
||||
@ -15,7 +9,7 @@ function! vebugger#jdb#start(entryClass,args)
|
||||
let l:debugger.state.jdb.filesToClassesMap={}
|
||||
|
||||
call l:debugger.writeLine('stop on '.a:entryClass.'.main')
|
||||
call l:debugger.writeLine('run '.a:entryClass)
|
||||
call l:debugger.writeLine('run '.a:entryClass.' '.vebugger#util#commandLineArgsForProgram(a:args))
|
||||
call l:debugger.writeLine('monitor where')
|
||||
|
||||
call l:debugger.addReadHandler(function('s:readWhere'))
|
||||
|
@ -1,9 +1,6 @@
|
||||
function! vebugger#pdb#start(entryFile,args)
|
||||
let l:debugger=vebugger#std#startDebugger(
|
||||
\(has_key(a:args,'command')
|
||||
\? (a:args.command)
|
||||
\: 'python -m pdb')
|
||||
\.' '.a:entryFile)
|
||||
let l:debugger=vebugger#std#startDebugger('python -m pdb '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args))
|
||||
|
||||
let l:debugger.state.pdb={
|
||||
\'willPrintNext':{'expression':'','stage':0}
|
||||
\}
|
||||
|
@ -1,9 +1,5 @@
|
||||
function! vebugger#rdebug#start(entryFile,args)
|
||||
let l:debugger=vebugger#std#startDebugger(
|
||||
\(has_key(a:args,'command')
|
||||
\? (a:args.command)
|
||||
\: 'ruby -rdebug')
|
||||
\.' '.a:entryFile)
|
||||
let l:debugger=vebugger#std#startDebugger('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
|
||||
|
||||
|
@ -31,3 +31,23 @@ function! vebugger#util#selectProcessOfFile(ofFile)
|
||||
let l:chosenLine=l:resultLines[l:chosenId]
|
||||
return str2nr(matchlist(l:chosenLine,'\v^\s*\d+\)\s+(\d+)')[1])
|
||||
endfunction
|
||||
|
||||
function! vebugger#util#commandLineArgsForProgram(debuggerArgs)
|
||||
if has_key(a:debuggerArgs,'args')
|
||||
if type(a:debuggerArgs.args)==type([])
|
||||
return join(map(a:debuggerArgs.args,'s:argEscape(v:val)'),' ')
|
||||
elseif type(a:debuggerArgs.args)==type('')
|
||||
return a:debuggerArgs.args
|
||||
else
|
||||
return string(a:debuggerArgs.args)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:argEscape(arg)
|
||||
if has('win32')
|
||||
return shellescape(a:arg)
|
||||
else
|
||||
return '"'.escape(a:arg,'"').'"'
|
||||
end
|
||||
endfunction
|
||||
|
@ -20,10 +20,10 @@ command! -nargs=1 VBGexecute call vebugger#std#execute(<q-args>)
|
||||
command! -range -nargs=0 VBGevalSelectedText call vebugger#std#eval(vebugger#util#get_visual_selection())
|
||||
command! -range -nargs=0 VBGexecuteSelectedText call vebugger#std#execute(vebugger#util#get_visual_selection())
|
||||
|
||||
command! -nargs=1 -complete=file VBGstartGDB call vebugger#gdb#start(<q-args>,{})
|
||||
command! -nargs=+ -complete=file VBGstartGDB call vebugger#gdb#start([<f-args>][0],{'args':[<f-args>][1:]})
|
||||
command! -nargs=1 -complete=file VBGattachGDB call vebugger#gdb#searchAndAttach(<q-args>)
|
||||
command! -nargs=1 -complete=file VBGstartPDB call vebugger#pdb#start(<q-args>,{})
|
||||
command! -nargs=1 -complete=file VBGstartRDebug call vebugger#rdebug#start(<q-args>,{})
|
||||
command! -nargs=+ -complete=file VBGstartRDebug call vebugger#rdebug#start([<f-args>][0],{'args':[<f-args>][1:]})
|
||||
command! -nargs=+ -complete=file VBGstartPDB call vebugger#pdb#start([<f-args>][0],{'args':[<f-args>][1:]})
|
||||
|
||||
if exists('g:vebugger_leader')
|
||||
if !empty(g:vebugger_leader)
|
||||
|
Loading…
x
Reference in New Issue
Block a user