Add docs for the 'con' flag for gdb

Also expand :VBGattachGDB to support either 'pid' or 'con' as second
command argument.
This commit is contained in:
IdanArye 2015-02-16 00:41:08 +02:00
parent 81760ed080
commit a97d06519a
4 changed files with 25 additions and 10 deletions

View File

@ -1,10 +1,3 @@
function! vebugger#gdb#searchAndAttach(binaryFile)
let l:processId=vebugger#util#selectProcessOfFile(a:binaryFile)
if 0<l:processId
call vebugger#gdb#start(a:binaryFile,{'pid':l:processId})
endif
endfunction
function! vebugger#gdb#start(binaryFile,args)
let l:debugger=vebugger#std#startDebugger(shellescape(vebugger#util#getToolFullPath('gdb',get(a:args,'version'),'gdb'))
\.' -i mi --silent '.fnameescape(a:binaryFile))

View File

@ -57,7 +57,8 @@ function! vebugger#util#selectProcessOfFile(ofFile)
return str2nr(l:resultLinesParsed[l:chosenId][1])
else
let l:chosenLine=l:resultLines[l:chosenId]
return str2nr(matchlist(l:chosenLine,'\v^\s*\d+\)\s+(\d+)')[1])
let g:chosenLine = l:chosenLine
return str2nr(matchstr(l:chosenLine,'\v^\s*\zs(\d+)\ze\s*'))
endif
endfunction

View File

@ -4,7 +4,7 @@
Author: Idan Arye <https://github.com/idanarye/>
License: Same terms as Vim itself (see |license|)
Version: 1.2.2
Version: 1.2.2+
INTRODUCTION *vebugger*
@ -117,6 +117,7 @@ GDB can be launched with *vebugger#gdb#start*
The supported extra arguments are:
* "args": Command line arguments for the debugged program
* "pid": Process id to attach to
* "con": URL of GDB-server to connect to
* "entry": The entry point for starting the debugging(default "main")
* "version": The version of the debugger to run
You can't specify both ("args" and/or "entry") and "pid".
@ -130,6 +131,10 @@ attach to, and attaches to them:
>
VBGattachGDB a.out
<
VBGattachGDB accepts as a second argument the process ID of the process to
attach to or the URL for a GDB-server to connect to.
The *VBGstartGDBForD* command is the same as VBGstartGDB but for Dlang
programs.

View File

@ -22,7 +22,23 @@ command! -range -nargs=0 VBGexecuteSelectedText call vebugger#std#execute(vebugg
command! -range -nargs=0 VBGrawWriteSelectedText call vebugger#writeLine(vebugger#util#get_visual_selection())
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>)
function! s:attachGDB(...)
if 1 == a:0
let l:processId=vebugger#util#selectProcessOfFile(a:1)
if 0 < l:processId
call vebugger#gdb#start(a:1, {'pid': l:processId})
endif
elseif 2 == a:0
if a:2 =~ '\v^\d+$'
call vebugger#gdb#start(a:1,{'pid': str2nr(a:2)})
else
call vebugger#gdb#start(a:1, {'con': a:2})
endif
else
throw "Can't call VBGattachGDB with ".a:0." arguments"
endif
endfunction
command! -nargs=+ -complete=file VBGattachGDB call s:attachGDB(<f-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:]})
command! -nargs=+ -complete=file VBGstartPDB2 call vebugger#pdb#start([<f-args>][0],{'args':[<f-args>][1:],'version':'2'})