Just some intermediate stuff
This commit is contained in:
parent
c05655d79d
commit
4694c8974c
@ -1,8 +1,8 @@
|
|||||||
function! vebugger#ninspect#start(entryFile,args)
|
function! vebugger#ninspect#attach(connection, args)
|
||||||
let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('node',get(a:args,'version'),'node'))
|
let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('node',get(a:args,'version'),'node'))
|
||||||
\.' inspect '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args))
|
\.' inspect '.a:connection)
|
||||||
let l:debugger.state.ninspect={}
|
let l:debugger.state.ninspect={}
|
||||||
let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules
|
"let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules
|
||||||
|
|
||||||
|
|
||||||
call l:debugger.writeLine("$stdout=$stderr")
|
call l:debugger.writeLine("$stdout=$stderr")
|
||||||
@ -20,7 +20,43 @@ function! vebugger#ninspect#start(entryFile,args)
|
|||||||
call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#ninspect#_writeBreakpoints'))
|
call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#ninspect#_writeBreakpoints'))
|
||||||
call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#ninspect#_requestEvaluateExpression'))
|
call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#ninspect#_requestEvaluateExpression'))
|
||||||
" call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#ninspect#_executeStatements'))
|
" call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#ninspect#_executeStatements'))
|
||||||
call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#ninspect#_removeAfterDisplayed'))
|
" call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#ninspect#_removeAfterDisplayed'))
|
||||||
|
|
||||||
|
call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#ninspect#_closeDebugger'))
|
||||||
|
|
||||||
|
call l:debugger.generateWriteActionsFromTemplate()
|
||||||
|
|
||||||
|
call l:debugger.std_addAllBreakpointActions(g:vebugger_breakpoints)
|
||||||
|
|
||||||
|
" Don't stop at the beginning
|
||||||
|
" call l:debugger.writeLine('cont')
|
||||||
|
|
||||||
|
return l:debugger
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! vebugger#ninspect#start(entryFile,args)
|
||||||
|
let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('node',get(a:args,'version'),'node'))
|
||||||
|
\.' inspect '.a:entryFile.' '.vebugger#util#commandLineArgsForProgram(a:args))
|
||||||
|
let l:debugger.state.ninspect={}
|
||||||
|
"let l:debugger.state.std.config.externalFileStop_flowCommand='stepover' "skip external modules
|
||||||
|
|
||||||
|
|
||||||
|
call l:debugger.writeLine("$stdout=$stderr")
|
||||||
|
let l:debugger.pipes.err.annotation = "err&prg\t\t"
|
||||||
|
if !has('win32')
|
||||||
|
call vebugger#std#openShellBuffer(l:debugger)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call l:debugger.addReadHandler(function('vebugger#ninspect#_readProgramOutput'))
|
||||||
|
call l:debugger.addReadHandler(function('vebugger#ninspect#_readWhere'))
|
||||||
|
" call l:debugger.addReadHandler(function('vebugger#ninspect#_readEvaluatedExpressions'))
|
||||||
|
call l:debugger.addReadHandler(function('vebugger#ninspect#_readFinish'))
|
||||||
|
|
||||||
|
call l:debugger.setWriteHandler('std','flow',function('vebugger#ninspect#_writeFlow'))
|
||||||
|
call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#ninspect#_writeBreakpoints'))
|
||||||
|
call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#ninspect#_requestEvaluateExpression'))
|
||||||
|
" call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#ninspect#_executeStatements'))
|
||||||
|
" call l:debugger.setWriteHandler('std','removeAfterDisplayed',function('vebugger#ninspect#_removeAfterDisplayed'))
|
||||||
|
|
||||||
call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#ninspect#_closeDebugger'))
|
call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#ninspect#_closeDebugger'))
|
||||||
|
|
||||||
@ -38,16 +74,36 @@ function! vebugger#ninspect#_readProgramOutput(pipeName,line,readResult,debugger
|
|||||||
if 'err'==a:pipeName
|
if 'err'==a:pipeName
|
||||||
let a:readResult.std.programOutput={'line':a:line}
|
let a:readResult.std.programOutput={'line':a:line}
|
||||||
else
|
else
|
||||||
let l:matches=matchlist(a:line,'\v(^........debug\>.............|^........|^)\<\s(.*)$')
|
"let l:donematch=matchlist(a:line,'\vdebug\>.............\<\sWaiting\sfor\sthe\sdebugger\sto\sdisconnect...')
|
||||||
if 3<len(l:matches)
|
"if 1<len(l:donematch)
|
||||||
let a:readResult.std.programOutput={'line':l:matches[2]}
|
" let self.programOutputMode=0
|
||||||
endif
|
" let a:readResult.std.programFinish={'finish':1}
|
||||||
|
"else
|
||||||
|
" if get(self,'programOutputMode')
|
||||||
|
let l:matches=matchlist(a:line,'\v(^........debug\>.............|^........|^)\<\s(.*)$')
|
||||||
|
if 3<len(l:matches)
|
||||||
|
let a:readResult.std.programOutput={'line':l:matches[2]}
|
||||||
|
endif
|
||||||
|
" else
|
||||||
|
" let l:startmatch=matchlist(a:line,'\vdebug\>')
|
||||||
|
" if 1<len(l:startmatch)
|
||||||
|
" call a:debugger.writeLine('cont') " Start by continuing
|
||||||
|
" let self.programOutputMode=1
|
||||||
|
" endif
|
||||||
|
" endif
|
||||||
|
"endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vebugger#ninspect#_readWhere(pipeName,line,readResult,debugger)
|
function! vebugger#ninspect#_readWhere(pipeName,line,readResult,debugger)
|
||||||
if 'out'==a:pipeName
|
if 'out'==a:pipeName
|
||||||
let l:matches=matchlist(a:line,'\vin\s(.*):(\d+)$')
|
let l:matches=matchlist(a:line,'\vin\s(.*):(\d+)$')
|
||||||
|
|
||||||
|
" if get(self,'programOutputMode')
|
||||||
|
" echom 'test'.self.programOutputMode
|
||||||
|
" else
|
||||||
|
" echom 'test2'
|
||||||
|
" endif
|
||||||
|
|
||||||
if 3<len(l:matches)
|
if 3<len(l:matches)
|
||||||
let l:file=l:matches[1]
|
let l:file=l:matches[1]
|
||||||
@ -89,7 +145,7 @@ function! vebugger#ninspect#_writeBreakpoints(writeAction,debugger)
|
|||||||
if 'add'==(l:breakpoint.action)
|
if 'add'==(l:breakpoint.action)
|
||||||
call a:debugger.writeLine('sb('''.fnameescape(l:breakpoint.file).''','.l:breakpoint.line.')')
|
call a:debugger.writeLine('sb('''.fnameescape(l:breakpoint.file).''','.l:breakpoint.line.')')
|
||||||
elseif 'remove'==l:breakpoint.action
|
elseif 'remove'==l:breakpoint.action
|
||||||
call a:debugger.writeLine('cb('.fnameescape(l:breakpoint.file).','.l:breakpoint.line.')')
|
call a:debugger.writeLine('cb('''.fnameescape(l:breakpoint.file).''','.l:breakpoint.line.')')
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
@ -98,6 +154,7 @@ function! vebugger#ninspect#_requestEvaluateExpression(writeAction,debugger)
|
|||||||
for l:evalAction in a:writeAction
|
for l:evalAction in a:writeAction
|
||||||
call a:debugger.std_addLineToShellBuffer('Eval: '.l:evalAction.expression)
|
call a:debugger.std_addLineToShellBuffer('Eval: '.l:evalAction.expression)
|
||||||
call a:debugger.writeLine('exec console.log(JSON.stringify('.l:evalAction.expression.', null, 2))')
|
call a:debugger.writeLine('exec console.log(JSON.stringify('.l:evalAction.expression.', null, 2))')
|
||||||
|
"call a:debugger.writeLine('exec JSON.stringify('.l:evalAction.expression.', null, 2)')
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -125,10 +182,17 @@ function! vebugger#ninspect#_readEvaluatedExpressions(pipeName,line,readResult,d
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! vebugger#ninspect#_removeAfterDisplayed(writeAction,debugger)
|
" function! vebugger#ninspect#_removeAfterDisplayed(writeAction,debugger)
|
||||||
for l:removeAction in a:writeAction
|
" for l:removeAction in a:writeAction
|
||||||
if has_key(l:removeAction,'id')
|
" if has_key(l:removeAction,'id')
|
||||||
call a:debugger.writeLine('undisplay '.l:removeAction.id)
|
" call a:debugger.writeLine('undisplay '.l:removeAction.id)
|
||||||
endif
|
" endif
|
||||||
endfor
|
" endfor
|
||||||
endfunction
|
" endfunction
|
||||||
|
|
||||||
|
" function! s:unescapeString(str)
|
||||||
|
" let l:result=a:str
|
||||||
|
" let l:result=substitute(l:result,'\\"','"','g')
|
||||||
|
" let l:result=substitute(l:result,'\\t',"\t",'g')
|
||||||
|
" return l:result
|
||||||
|
" endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user