let s:script_dir_path=expand(':p:h') function! vebugger#lldb#start(binaryFile,args) let l:debuggerExe=vebugger#util#getToolFullPath('python','lldb','python2') let l:debugger=vebugger#std#startDebugger(shellescape(l:debuggerExe) \.' '.s:script_dir_path.'/lldb_wrapper.py '.fnameescape(a:binaryFile)) let l:debugger.state.lldb={} if get(a:args,'pid') "Attach to process call l:debugger.writeLine('process attach --pid '.string(a:args.pid)) elseif has_key(a:args,'con') "Attach to lldbserver call l:debugger.writeLine('platform connect connect://'.a:args.con) else call l:debugger.writeLine('settings set target.run-args '.vebugger#util#commandLineArgsForProgram(a:args)) if !has('win32') call vebugger#std#openShellBuffer(l:debugger) endif " TODO: remove 'and false'; add a temporary breakpoint to lldb if has_key(a:args,'entry') && 0 " call l:debugger.writeLine('tbreak '.a:args.entry) " call l:debugger.writeLine('run') else call l:debugger.writeLine('breakpoint set --name main') call l:debugger.writeLine('process launch') endif endif call l:debugger.addReadHandler(function('vebugger#lldb#_readProgramOutput')) call l:debugger.addReadHandler(function('vebugger#lldb#_readWhere')) call l:debugger.addReadHandler(function('vebugger#lldb#_readFinish')) call l:debugger.addReadHandler(function('vebugger#lldb#_readEvaluatedExpressions')) call l:debugger.setWriteHandler('std','flow',function('vebugger#lldb#_writeFlow')) call l:debugger.setWriteHandler('std','breakpoints',function('vebugger#lldb#_writeBreakpoints')) call l:debugger.setWriteHandler('std','closeDebugger',function('vebugger#lldb#_closeDebugger')) call l:debugger.setWriteHandler('std','evaluateExpressions',function('vebugger#lldb#_requestEvaluateExpression')) call l:debugger.setWriteHandler('std','executeStatements',function('vebugger#lldb#_executeStatements')) call l:debugger.generateWriteActionsFromTemplate() call l:debugger.std_addAllBreakpointActions(g:vebugger_breakpoints) return l:debugger endfunction function! vebugger#lldb#_readProgramOutput(pipeName,line,readResult,debugger) if 'out'==a:pipeName \&&(a:line=~'\v^program_stdout:' \||a:line=~'\v^program_stderr:') let a:readResult.std.programOutput={'line':strpart(a:line, 16)} endif endfunction function! vebugger#lldb#_readWhere(pipeName,line,readResult,debugger) if 'out'==a:pipeName \&&a:line=~'\v^where:' let l:matches=matchlist(a:line,'\v^where:\s([^:]+):(\d+)') if 2