Allow GDB to work with Dlang executables

This is done by allowing to choose differet entry points to start the
program at.
This commit is contained in:
IdanArye 2014-06-24 00:05:51 +03:00
parent 36eacb3379
commit b0be0c92b7
3 changed files with 14 additions and 5 deletions

View File

@ -22,7 +22,13 @@ function! vebugger#gdb#start(binaryFile,args)
if !has('win32') if !has('win32')
call vebugger#std#openShellBuffer(l:debugger) call vebugger#std#openShellBuffer(l:debugger)
endif endif
if has_key(a:args,'entry')
call l:debugger.writeLine('tbreak '.a:args.entry)
call l:debugger.writeLine('run')
else
call l:debugger.writeLine('start') call l:debugger.writeLine('start')
endif
end end
@ -66,8 +72,7 @@ endfunction
function! s:readWhere(pipeName,line,readResult,debugger) function! s:readWhere(pipeName,line,readResult,debugger)
if 'out'==a:pipeName if 'out'==a:pipeName
"let l:matches=matchlist(a:line,'\v#(\d+)\s+(\S+)\s+\(.*\)\s+at\s+([^:]+):(\d+)') let l:matches=matchlist(a:line,'\v^\~"#(\d+)\s+(.+)\s+\(.*\)\s+at\s+([^:]+):(\d+)')
let l:matches=matchlist(a:line,'\v^\~"#(\d+)\s+(\S+)\s+\(.*\)\s+at\s+([^:]+):(\d+)')
if 4<len(l:matches) if 4<len(l:matches)
let l:file=l:matches[3] let l:file=l:matches[3]
let l:file=fnamemodify(l:file,':~:.') let l:file=fnamemodify(l:file,':~:.')

View File

@ -4,7 +4,7 @@
Author: Idan Arye <https://github.com/idanarye/> Author: Idan Arye <https://github.com/idanarye/>
License: Same terms as Vim itself (see |license|) License: Same terms as Vim itself (see |license|)
Version: 1.1.2 Version: 1.1.2 +
INTRODUCTION *vebugger* INTRODUCTION *vebugger*
@ -108,7 +108,8 @@ GDB can be launched with *vebuger#gdb#start*
The supported extra arguments are: The supported extra arguments are:
* "args": Command line arguments for the debugged program * "args": Command line arguments for the debugged program
* "pid": Process id to attach to * "pid": Process id to attach to
You can't specify both "args" and "pid". * "entry": The entry
You can't specify both ("args" and/or "entry") and "pid".
GDB can also be launched with the *VBGstartGDB* command: GDB can also be launched with the *VBGstartGDB* command:
> >
@ -119,6 +120,8 @@ attach to, and attaches to them:
> >
VBGattachGDB a.out VBGattachGDB a.out
< <
The *VBGstartGDBForD* command is the same as VBGstartGDB but for Dlang
programs.
LAUNCHING JDB *vebugger-jdb* LAUNCHING JDB *vebugger-jdb*

View File

@ -25,6 +25,7 @@ command! -nargs=+ -complete=file VBGstartGDB call vebugger#gdb#start([<f-args>][
command! -nargs=1 -complete=file VBGattachGDB call vebugger#gdb#searchAndAttach(<q-args>) command! -nargs=1 -complete=file VBGattachGDB call vebugger#gdb#searchAndAttach(<q-args>)
command! -nargs=+ -complete=file VBGstartRDebug call vebugger#rdebug#start([<f-args>][0],{'args':[<f-args>][1:]}) 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 VBGstartPDB call vebugger#pdb#start([<f-args>][0],{'args':[<f-args>][1:]})
command! -nargs=+ -complete=file VBGstartGDBForD call vebugger#gdb#start([<f-args>][0],{'args':[<f-args>][1:],'entry':'_Dmain'})
if exists('g:vebugger_leader') if exists('g:vebugger_leader')
if !empty(g:vebugger_leader) if !empty(g:vebugger_leader)