From a97d06519ac1a6e4976ab313b2bc9e4c5b805c0c Mon Sep 17 00:00:00 2001 From: IdanArye Date: Mon, 16 Feb 2015 00:41:08 +0200 Subject: [PATCH] Add docs for the 'con' flag for gdb Also expand :VBGattachGDB to support either 'pid' or 'con' as second command argument. --- autoload/vebugger/gdb.vim | 7 ------- autoload/vebugger/util.vim | 3 ++- doc/vebugger.txt | 7 ++++++- plugin/vebugger.vim | 18 +++++++++++++++++- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/autoload/vebugger/gdb.vim b/autoload/vebugger/gdb.vim index 4915fc4..8fa8d6d 100644 --- a/autoload/vebugger/gdb.vim +++ b/autoload/vebugger/gdb.vim @@ -1,10 +1,3 @@ -function! vebugger#gdb#searchAndAttach(binaryFile) - let l:processId=vebugger#util#selectProcessOfFile(a:binaryFile) - if 0 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. diff --git a/plugin/vebugger.vim b/plugin/vebugger.vim index 6ea2076..6f9449d 100644 --- a/plugin/vebugger.vim +++ b/plugin/vebugger.vim @@ -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([][0],{'args':[][1:]}) -command! -nargs=1 -complete=file VBGattachGDB call vebugger#gdb#searchAndAttach() +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() command! -nargs=+ -complete=file VBGstartRDebug call vebugger#rdebug#start([][0],{'args':[][1:]}) command! -nargs=+ -complete=file VBGstartPDB call vebugger#pdb#start([][0],{'args':[][1:]}) command! -nargs=+ -complete=file VBGstartPDB2 call vebugger#pdb#start([][0],{'args':[][1:],'version':'2'})