Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoload/vebugger/gdb.vim
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ endfunction
function! vebugger#gdb#_writeBreakpoints(writeAction,debugger)
for l:breakpoint in a:writeAction
if 'add'==(l:breakpoint.action)
call a:debugger.writeLine('break '.fnameescape(l:breakpoint.file).':'.l:breakpoint.line)
call a:debugger.writeLine('break '.fnameescape(l:breakpoint.file).':'.l:breakpoint.line.' '.l:breakpoint.condition)
elseif 'remove'==l:breakpoint.action
call a:debugger.writeLine('clear '.fnameescape(l:breakpoint.file).':'.l:breakpoint.line)
endif
Expand Down
14 changes: 10 additions & 4 deletions autoload/vebugger/std.vim
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ function! s:standardFunctions.addAllBreakpointActions(breakpoints) dict
call self.addWriteAction('std','breakpoints',{
\'action':'add',
\'file':(l:breakpoint.file),
\'line':(l:breakpoint.line)})
\'line':(l:breakpoint.line),
\'condition':(l:breakpoint.condition)})
endfor
endfunction

Expand Down Expand Up @@ -347,8 +348,12 @@ function! vebugger#std#updateMarksForFile(state,filename)
endif
endfunction

"Toggle a breakpoint on and off
function! vebugger#std#toggleBreakpoint(file,line)
call vebugger#std#toggleConditionalBreakpoint(a:file,a:line,"")
endfunction

"Toggle a breakpoint on and off
function! vebugger#std#toggleConditionalBreakpoint(file,line,condition)
let l:debugger=vebugger#getActiveDebugger()
let l:debuggerState=empty(l:debugger)
\? {}
Expand All @@ -367,12 +372,13 @@ function! vebugger#std#toggleBreakpoint(file,line)
return
endif
endfor
call add(g:vebugger_breakpoints,{'file':(a:file),'line':(a:line)})
call add(g:vebugger_breakpoints,{'file':(a:file),'line':(a:line),'condition':(a:condition)})
if !empty(l:debugger)
call l:debugger.addWriteActionAndPerform('std','breakpoints',{
\'action':'add',
\'file':(a:file),
\'line':(a:line)})
\'line':(a:line),
\'condition':(a:condition)})
endif
call vebugger#std#updateMarksForFile(l:debuggerState,a:file)
endfunction
Expand Down
2 changes: 2 additions & 0 deletions plugin/vebugger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ command! -nargs=0 VBGcontinue call vebugger#userAction('setWriteActionAndPerform
command! -nargs=0 VBGtoggleTerminalBuffer call vebugger#userAction('toggleTerminalBuffer')
command! -nargs=+ -complete=file VBGtoggleBreakpoint call vebugger#std#toggleBreakpoint(<f-args>)
command! -nargs=0 VBGtoggleBreakpointThisLine call vebugger#std#toggleBreakpoint(expand('%:p:.'),line('.'))
command! -nargs=1 VBGaddConditionalBreakpointThisLine call vebugger#std#toggleConditionalBreakpoint(expand('%:p:.'),line('.'), <q-args>)
command! -nargs=0 VBGclearBreakpoints call vebugger#std#clearBreakpoints()

command! -nargs=1 VBGeval call vebugger#userAction('std_eval', <q-args>)
Expand Down Expand Up @@ -72,6 +73,7 @@ if exists('g:vebugger_leader')
\'i':'VBGstepIn',
\'o':'VBGstepOver',
\'O':'VBGstepOut',
\'k':'exe "VBGaddConditionalBreakpointThisLine ".input("Condition> ")',
\'c':'VBGcontinue',
\'t':'VBGtoggleTerminalBuffer',
\'b':'VBGtoggleBreakpointThisLine',
Expand Down