2013-12-28 15:23:33 -05:00
|
|
|
let g:vebugger_breakpoints=[]
|
|
|
|
|
2016-02-16 17:32:15 -05:00
|
|
|
"Initialize the default pipe bufferers
|
|
|
|
function! vebugger#std#setStandardBufferers(debugger)
|
|
|
|
for l:pipe in values(a:debugger.pipes)
|
|
|
|
let l:pipe.bufferer = function('vebugger#std#readNewLinesFromPipe')
|
|
|
|
endfor
|
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Initialize the std part of the debugger's state
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#setStandardState(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
let a:debugger.state.std={
|
|
|
|
\'config':{
|
|
|
|
\ 'externalFileStop_flowCommand':''},
|
|
|
|
\'location':{},
|
|
|
|
\'callstack':[],
|
|
|
|
\'evaluateExpressions':[]}
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Initialize the std part of the debugger's read result template
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#setStandardReadResultTemplate(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
let a:debugger.readResultTemplate.std={
|
|
|
|
\'programOutput':{},
|
|
|
|
\'location':{},
|
|
|
|
\'callstack':{},
|
|
|
|
\'evaluatedExpression':{},
|
|
|
|
\'programFinish':{},
|
|
|
|
\'exception':{}}
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Initialize the std part of the debugger's write actions template
|
2013-12-27 16:52:57 -05:00
|
|
|
function! vebugger#std#setStandardWriteactionsTemplate(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
let a:debugger.writeActionsTemplate.std={
|
|
|
|
\'flow':'',
|
|
|
|
\'breakpoints':[],
|
|
|
|
\'evaluateExpressions':[],
|
|
|
|
\'executeStatements':[],
|
|
|
|
\'removeAfterDisplayed':[],
|
|
|
|
\'closeDebugger':''}
|
2013-12-27 16:52:57 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Adds the std_ functions to the debugger object
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#addStandardFunctions(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
for l:k in keys(s:standardFunctions)
|
|
|
|
let a:debugger['std_'.l:k]=s:standardFunctions[l:k]
|
|
|
|
endfor
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Add the standard think handlers to the debugger
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#addStandardThinkHandlers(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
for l:ThinkHandler in values(s:standardThinkHandlers)
|
|
|
|
call a:debugger.addThinkHandler(l:ThinkHandler)
|
|
|
|
endfor
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Add the standard close handlers to the debugger
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#addStandardCloseHandlers(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
for l:CloseHandler in values(s:standardCloseHandlers)
|
|
|
|
call a:debugger.addCloseHandler(l:CloseHandler)
|
|
|
|
endfor
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Performs the standard initialization of the debugger object
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#standardInit(debugger)
|
2016-02-16 17:32:15 -05:00
|
|
|
call vebugger#std#setStandardBufferers(a:debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
call vebugger#std#setStandardState(a:debugger)
|
|
|
|
call vebugger#std#setStandardReadResultTemplate(a:debugger)
|
|
|
|
call vebugger#std#setStandardWriteactionsTemplate(a:debugger)
|
|
|
|
call vebugger#std#addStandardFunctions(a:debugger)
|
|
|
|
call vebugger#std#addStandardThinkHandlers(a:debugger)
|
|
|
|
call vebugger#std#addStandardCloseHandlers(a:debugger)
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Start a debugger with the std settings
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#startDebugger(command)
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:debugger=vebugger#startDebugger(a:command)
|
2013-12-25 13:33:12 -05:00
|
|
|
|
2015-02-28 12:16:25 -05:00
|
|
|
call vebugger#std#standardInit(l:debugger)
|
2013-12-25 13:33:12 -05:00
|
|
|
|
2015-02-28 12:16:25 -05:00
|
|
|
return l:debugger
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
2016-02-16 17:32:15 -05:00
|
|
|
"Read and return all new lines from a Vebugger pipe object.
|
|
|
|
function! vebugger#std#readNewLinesFromPipe() dict
|
|
|
|
let l:lastNewline = strridx(self.buffer, "\n")
|
|
|
|
if 0 <= l:lastNewline
|
|
|
|
let l:outLines = split(strpart(self.buffer, 0, l:lastNewline), '\r\n\|\n\|\r')
|
|
|
|
let self.buffer = strpart(self.buffer, l:lastNewline + 1)
|
|
|
|
return l:outLines
|
|
|
|
endif
|
|
|
|
|
|
|
|
return []
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Opens the shell buffer for a debugger. The shell buffer displays the output
|
|
|
|
"of the debugged program, and when it's closed the debugger gets terminated.
|
|
|
|
"Shell buffers should not be used when attaching a debugger to a running
|
|
|
|
"process.
|
2014-05-16 10:42:22 -04:00
|
|
|
function! vebugger#std#openShellBuffer(debugger)
|
2015-02-28 12:16:25 -05:00
|
|
|
if has_key(a:debugger,'shellBuffer')
|
|
|
|
if -1<bufwinnr(a:debugger.shellBuffer)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
let l:oldBuffer=bufnr('Vebugger:Shell')
|
|
|
|
if -1<l:oldBuffer
|
|
|
|
let a:debugger.shellBuffer=l:oldBuffer
|
|
|
|
call a:debugger.std_addLineToShellBuffer('')
|
|
|
|
call a:debugger.std_addLineToShellBuffer('==================')
|
|
|
|
call a:debugger.std_addLineToShellBuffer('')
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
8 new
|
|
|
|
let b:debugger=a:debugger
|
|
|
|
autocmd BufDelete <buffer> if exists('b:debugger') | call b:debugger.kill() | endif
|
|
|
|
setlocal buftype=nofile
|
2017-12-13 08:23:28 -05:00
|
|
|
setlocal filetype=VebuggerShell
|
2015-02-28 12:16:25 -05:00
|
|
|
setlocal bufhidden=wipe
|
|
|
|
let a:debugger.shellBuffer=bufnr('')
|
|
|
|
silent file Vebugger:Shell
|
|
|
|
wincmd p
|
2014-05-16 10:42:22 -04:00
|
|
|
endfunction
|
2013-12-25 13:33:12 -05:00
|
|
|
|
2015-06-27 08:03:03 -04:00
|
|
|
"Closes the shell buffer
|
|
|
|
function! vebugger#std#closeShellBuffer(debugger)
|
|
|
|
if has_key(a:debugger,'shellBuffer')
|
|
|
|
if -1<bufwinnr(a:debugger.shellBuffer)
|
|
|
|
let l:bufwin=bufwinnr(a:debugger.shellBuffer)
|
|
|
|
exe l:bufwin.'wincmd w'
|
|
|
|
wincmd c
|
|
|
|
wincmd p
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2013-12-25 13:33:12 -05:00
|
|
|
let s:standardFunctions={}
|
2014-05-17 15:43:18 -04:00
|
|
|
|
|
|
|
"Write a line to the shell buffer
|
2014-05-16 10:42:22 -04:00
|
|
|
function! s:standardFunctions.addLineToShellBuffer(line) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
if has_key(self,'shellBuffer')
|
|
|
|
let l:bufwin=bufwinnr(self.shellBuffer)
|
|
|
|
if -1<l:bufwin
|
|
|
|
exe l:bufwin.'wincmd w'
|
|
|
|
call append (line('$'),a:line)
|
|
|
|
normal G
|
|
|
|
wincmd p
|
|
|
|
endif
|
|
|
|
endif
|
2014-05-16 10:42:22 -04:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Set the write actions to add all breakpoints registered in Vebugger
|
2013-12-28 15:23:33 -05:00
|
|
|
function! s:standardFunctions.addAllBreakpointActions(breakpoints) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
for l:breakpoint in a:breakpoints
|
|
|
|
call self.addWriteAction('std','breakpoints',{
|
|
|
|
\'action':'add',
|
|
|
|
\'file':(l:breakpoint.file),
|
|
|
|
\'line':(l:breakpoint.line)})
|
|
|
|
endfor
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Make the debugger evaluate an expression
|
2014-01-17 17:36:13 -05:00
|
|
|
function! s:standardFunctions.eval(expression) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
if -1==index(self.state.std.evaluateExpressions,a:expression)
|
|
|
|
call add(self.state.std.evaluateExpressions,a:expression)
|
|
|
|
endif
|
|
|
|
call self.addWriteAction('std','evaluateExpressions',{
|
|
|
|
\'expression':(a:expression)})
|
|
|
|
call self.performWriteActions()
|
2014-01-17 17:36:13 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Execute a statement in the debugged program
|
2014-05-16 16:58:02 -04:00
|
|
|
function! s:standardFunctions.execute(statement) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
call self.addWriteAction('std','executeStatements',{
|
|
|
|
\'statement':(a:statement)})
|
|
|
|
call self.performWriteActions()
|
2014-05-16 16:58:02 -04:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
|
2013-12-25 13:33:12 -05:00
|
|
|
let s:standardThinkHandlers={}
|
2014-05-17 15:43:18 -04:00
|
|
|
|
|
|
|
"Update the shell buffer with program output
|
2014-05-16 10:42:22 -04:00
|
|
|
function! s:standardThinkHandlers.addProgramOutputToShell(readResult,debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:programOutput=a:readResult.std.programOutput
|
|
|
|
if !empty(l:programOutput)
|
|
|
|
call a:debugger.std_addLineToShellBuffer(l:programOutput.line)
|
|
|
|
endif
|
2014-05-16 10:42:22 -04:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Make Vim jump to the currently executed line
|
2013-12-27 15:54:11 -05:00
|
|
|
function! s:standardThinkHandlers.moveToCurrentLine(readResult,debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
if !empty(a:readResult.std.location)
|
|
|
|
if !empty(a:debugger.state.std.config.externalFileStop_flowCommand) " Do we need to worry about stopping at external files?
|
|
|
|
if 0!=stridx(tolower(fnamemodify(a:readResult.std.location.file,':p')),tolower(getcwd()))
|
|
|
|
call a:debugger.setWriteAction('std','flow',a:debugger.state.std.config.externalFileStop_flowCommand)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if a:debugger.state.std.location!=a:readResult.std.location
|
|
|
|
if has_key(a:debugger.state.std.location,'file')
|
|
|
|
exe 'sign unplace 1 file='.fnameescape(fnamemodify(a:debugger.state.std.location.file,':p'))
|
|
|
|
endif
|
|
|
|
let a:debugger.state.std.location=deepcopy(a:readResult.std.location)
|
2015-11-06 15:30:02 -05:00
|
|
|
if -1 == bufwinnr(a:readResult.std.location.file)
|
2015-02-28 12:16:25 -05:00
|
|
|
exe get(g:, 'vebugger_view_source_cmd', 'new').' '.(a:readResult.std.location.file)
|
|
|
|
endif
|
|
|
|
call vebugger#std#updateMarksForFile(a:debugger.state,a:readResult.std.location.file)
|
|
|
|
exe 'sign jump 1 file='.fnameescape(fnamemodify(a:readResult.std.location.file,':p'))
|
|
|
|
endif
|
|
|
|
endif
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Update the call stack
|
2013-12-27 16:09:58 -05:00
|
|
|
function! s:standardThinkHandlers.updateCallStack(readResult,debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:callstack=a:readResult.std.callstack
|
|
|
|
if !empty(l:callstack)
|
|
|
|
if get(l:callstack,'clearOld')
|
|
|
|
let a:debugger.state.std.callstack=[]
|
|
|
|
endif
|
|
|
|
let l:frame={'file':(l:callstack.file),'line':(l:callstack.line)}
|
|
|
|
if 'after'==get(l:callstack,'add')
|
|
|
|
call add(a:debugger.state.std.callstack,l:frame)
|
|
|
|
elseif 'before'==get(l:callstack,'add')
|
|
|
|
call insert(a:debugger.state.std.callstack,l:frame)
|
|
|
|
endif
|
|
|
|
endif
|
2013-12-27 16:09:58 -05:00
|
|
|
endfunction
|
|
|
|
|
2017-01-22 06:39:06 -05:00
|
|
|
"Helper print function; when using vim timers feedkeys ensures that messages
|
|
|
|
"can be confirmend by the user.
|
|
|
|
function! s:printWithFeedKeys(evaluatedExpression)
|
|
|
|
if empty(get(a:evaluatedExpression,'expression'))
|
|
|
|
let l:echo = a:evaluatedExpression.value
|
|
|
|
else
|
|
|
|
let l:echo = a:evaluatedExpression.expression.': '.a:evaluatedExpression.value
|
|
|
|
endif
|
|
|
|
let l:echoLines = split(l:echo, '\r\n\|\n\|\r')
|
|
|
|
if len(l:echoLines) == 1
|
|
|
|
call add(l:echoLines, '')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if has('timers')
|
|
|
|
" Convert to an expression we can use with feedkeys.
|
|
|
|
" string(l:echo) won't do because it uses single-quotes which
|
|
|
|
" do not escape newlines
|
|
|
|
let l:echoJoinExpr = 'join('.string(l:echoLines).', "\n")'
|
|
|
|
|
|
|
|
let l:echoKeys = ':echo '.l:echoJoinExpr."\<Cr>"
|
|
|
|
if mode() == 'n'
|
|
|
|
" Call echo normaly
|
|
|
|
call feedkeys(l:echoKeys)
|
|
|
|
elseif mode() == 'i'
|
|
|
|
" Execute command in insert mode
|
|
|
|
call feedkeys("\<C-o>".l:echoKeys)
|
|
|
|
endif
|
|
|
|
" NOTE: Other modes are not supported
|
|
|
|
else
|
|
|
|
" Without timer support, feedkeys won't work and we have
|
|
|
|
" to echo directly
|
|
|
|
echo join(l:echoLines, "\n")
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Print an expression that it's evaluation was previously requested
|
2014-01-17 17:36:13 -05:00
|
|
|
function! s:standardThinkHandlers.printEvaluatedExpression(readResult,debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:evaluatedExpression=a:readResult.std.evaluatedExpression
|
|
|
|
if !empty(l:evaluatedExpression)
|
2017-01-22 06:39:06 -05:00
|
|
|
if !empty(get(l:evaluatedExpression,'expression'))
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:index=index(a:debugger.state.std.evaluateExpressions,l:evaluatedExpression.expression)
|
|
|
|
if 0<=l:index
|
|
|
|
call remove(a:debugger.state.std.evaluateExpressions,l:index)
|
|
|
|
endif
|
|
|
|
endif
|
2017-01-22 06:39:06 -05:00
|
|
|
call s:printWithFeedKeys(l:evaluatedExpression)
|
2015-02-28 12:16:25 -05:00
|
|
|
call a:debugger.addWriteAction('std','removeAfterDisplayed',a:readResult)
|
|
|
|
endif
|
2014-02-07 17:51:13 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Close the debugger when the program is finished but the debugger wasn't
|
|
|
|
"closed automatically
|
2014-02-07 17:51:13 -05:00
|
|
|
function! s:standardThinkHandlers.closeDebuggerWhenProgramFinishes(readResult,debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
if !empty(a:readResult.std.programFinish)
|
|
|
|
call a:debugger.setWriteAction('std','closeDebugger','close')
|
|
|
|
endif
|
2014-01-17 17:36:13 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Print an exception message
|
2014-02-08 15:58:34 -05:00
|
|
|
function! s:standardThinkHandlers.printException(readResult,debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
if !empty(a:readResult.std.exception)
|
|
|
|
echohl WarningMsg
|
|
|
|
echo a:readResult.std.exception.message."\n"
|
|
|
|
echohl None
|
|
|
|
endif
|
2014-02-08 15:58:34 -05:00
|
|
|
endfunction
|
|
|
|
|
2013-12-25 13:33:12 -05:00
|
|
|
let s:standardCloseHandlers={}
|
2014-05-17 15:43:18 -04:00
|
|
|
"Remove the currently executed line when a debugger is closed
|
2013-12-25 13:33:12 -05:00
|
|
|
function! s:standardCloseHandlers.removeCurrentMarker(debugger) dict
|
2015-02-28 12:16:25 -05:00
|
|
|
let a:debugger.state.std.location={}
|
|
|
|
sign unplace 1
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
|
|
|
|
2017-10-17 14:28:20 -04:00
|
|
|
|
|
|
|
if hlexists("DebuggedLine")
|
|
|
|
sign define vebugger_current linehl=DebuggedLine
|
|
|
|
else
|
|
|
|
sign define vebugger_current text=->
|
|
|
|
endif
|
2015-04-15 16:00:02 -04:00
|
|
|
|
|
|
|
if hlexists('BreakPoint')
|
|
|
|
sign define vebugger_breakpoint text=** linehl=BreakPoint texthl=BreakPoint
|
|
|
|
else
|
|
|
|
sign define vebugger_breakpoint text=** linehl=ColorColumn texthl=ColorColumn
|
|
|
|
endif
|
2014-05-17 15:43:18 -04:00
|
|
|
|
|
|
|
"Update all the marks(currently executed line and breakpoints) for a file
|
2013-12-25 13:33:12 -05:00
|
|
|
function! vebugger#std#updateMarksForFile(state,filename)
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:filename=fnamemodify(a:filename,":p")
|
2015-11-06 15:30:02 -05:00
|
|
|
if -1 < bufnr(l:filename)
|
2015-02-28 12:16:25 -05:00
|
|
|
exe 'sign unplace 1 file='.fnameescape(fnamemodify(l:filename,':p'))
|
|
|
|
exe 'sign unplace 2 file='.fnameescape(fnamemodify(l:filename,':p'))
|
|
|
|
|
|
|
|
for l:breakpoint in g:vebugger_breakpoints
|
|
|
|
if fnamemodify(l:breakpoint.file,':p')==fnamemodify(a:filename,':p')
|
|
|
|
exe 'sign place 2 name=vebugger_breakpoint line='.l:breakpoint.line.' file='.fnameescape(fnamemodify(l:breakpoint.file,':p'))
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
|
|
|
|
if !empty(a:state)
|
|
|
|
if !empty(a:state.std.location)
|
|
|
|
if fnamemodify(a:state.std.location.file,':p')==fnamemodify(a:filename,':p')
|
|
|
|
exe 'sign place 1 name=vebugger_current line='.a:state.std.location.line.' file='.fnameescape(fnamemodify(l:filename,':p'))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2013-12-25 13:33:12 -05:00
|
|
|
endfunction
|
2013-12-28 15:23:33 -05:00
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Toggle a breakpoint on and off
|
2013-12-28 15:23:33 -05:00
|
|
|
function! vebugger#std#toggleBreakpoint(file,line)
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:debugger=vebugger#getActiveDebugger()
|
|
|
|
let l:debuggerState=empty(l:debugger)
|
|
|
|
\? {}
|
|
|
|
\: l:debugger.state
|
|
|
|
for l:i in range(len(g:vebugger_breakpoints))
|
|
|
|
let l:breakpoint=g:vebugger_breakpoints[l:i]
|
|
|
|
if l:breakpoint.file==a:file && l:breakpoint.line==a:line
|
|
|
|
call remove(g:vebugger_breakpoints,l:i)
|
|
|
|
if !empty(l:debugger)
|
|
|
|
call l:debugger.addWriteActionAndPerform('std','breakpoints',{
|
|
|
|
\'action':'remove',
|
|
|
|
\'file':(a:file),
|
|
|
|
\'line':(a:line)})
|
|
|
|
endif
|
|
|
|
call vebugger#std#updateMarksForFile(l:debuggerState,a:file)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
call add(g:vebugger_breakpoints,{'file':(a:file),'line':(a:line)})
|
|
|
|
if !empty(l:debugger)
|
|
|
|
call l:debugger.addWriteActionAndPerform('std','breakpoints',{
|
|
|
|
\'action':'add',
|
|
|
|
\'file':(a:file),
|
|
|
|
\'line':(a:line)})
|
|
|
|
endif
|
|
|
|
call vebugger#std#updateMarksForFile(l:debuggerState,a:file)
|
2013-12-28 15:23:33 -05:00
|
|
|
endfunction
|
|
|
|
|
2014-05-17 15:43:18 -04:00
|
|
|
"Clear all breakpoints
|
2013-12-28 15:23:33 -05:00
|
|
|
function! vebugger#std#clearBreakpoints()
|
2015-02-28 12:16:25 -05:00
|
|
|
let l:debugger=vebugger#getActiveDebugger()
|
|
|
|
let l:debuggerState=empty(l:debugger) ? {} : l:debugger.state
|
|
|
|
let l:files=[]
|
|
|
|
for l:breakpoint in g:vebugger_breakpoints
|
|
|
|
if index(l:files,l:breakpoint.file)<0
|
|
|
|
call add(l:files,l:breakpoint.file)
|
|
|
|
endif
|
|
|
|
if !empty(l:debugger)
|
|
|
|
call l:debugger.addWriteAction('std','breakpoints',extend({'action':'remove'},l:breakpoint))
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
if !empty(l:debugger)
|
|
|
|
call l:debugger.performWriteActions()
|
|
|
|
endif
|
|
|
|
let g:vebugger_breakpoints=[]
|
|
|
|
for l:file in l:files
|
|
|
|
call vebugger#std#updateMarksForFile(l:debuggerState,l:file)
|
|
|
|
endfor
|
2014-05-16 16:58:02 -04:00
|
|
|
endfunction
|