Patch 8.0.1713
Problem:    Terminal debugger doesn't handle arguments.
Solution:   Use <f-args> and pass all the arguments to gdb, e.g. the core file
            or process number. (suggested by Christian Brabandt) Disallow
            starting the debugger twice.
Files:      runtime/pack/dist/opt/termdebug/plugin/termdebug.vim,
            runtime/doc/terminal.txt


*** ../vim-8.0.1712/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim        
2018-04-06 22:26:17.981196807 +0200
--- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim        2018-04-14 
18:47:36.861253050 +0200
***************
*** 25,31 ****
  
  " The command that starts debugging, e.g. ":Termdebug vim".
  " To end type "quit" in the gdb window.
! command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
  
  " Name of the gdb command, defaults to "gdb".
  if !exists('termdebugger')
--- 25,31 ----
  
  " The command that starts debugging, e.g. ":Termdebug vim".
  " To end type "quit" in the gdb window.
! command -nargs=* -complete=file Termdebug call s:StartDebug(<f-args>)
  
  " Name of the gdb command, defaults to "gdb".
  if !exists('termdebugger')
***************
*** 43,49 ****
  endif
  hi default debugBreakpoint term=reverse ctermbg=red guibg=red
  
! func s:StartDebug(cmd)
    let s:startwin = win_getid(winnr())
    let s:startsigncolumn = &signcolumn
  
--- 43,54 ----
  endif
  hi default debugBreakpoint term=reverse ctermbg=red guibg=red
  
! func s:StartDebug(...)
!   if exists('s:gdbwin')
!     echoerr 'Terminal debugger already running'
!     return
!   endif
! 
    let s:startwin = win_getid(winnr())
    let s:startsigncolumn = &signcolumn
  
***************
*** 90,96 ****
  
    " Open a terminal window to run the debugger.
    " Add -quiet to avoid the intro message causing a hit-enter prompt.
!   let cmd = [g:termdebugger, '-quiet', '-tty', pty, a:cmd]
    echomsg 'executing "' . join(cmd) . '"'
    let s:gdbbuf = term_start(cmd, {
        \ 'exit_cb': function('s:EndDebug'),
--- 95,101 ----
  
    " Open a terminal window to run the debugger.
    " Add -quiet to avoid the intro message causing a hit-enter prompt.
!   let cmd = [g:termdebugger, '-quiet', '-tty', pty] + a:000
    echomsg 'executing "' . join(cmd) . '"'
    let s:gdbbuf = term_start(cmd, {
        \ 'exit_cb': function('s:EndDebug'),
***************
*** 112,118 ****
    let try_count = 0
    while 1
      let response = ''
!     for lnum in range(1,20)
        if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi '
        let response = term_getline(s:gdbbuf, lnum + 1)
        if response =~ 'Undefined command'
--- 117,123 ----
    let try_count = 0
    while 1
      let response = ''
!     for lnum in range(1,200)
        if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi '
        let response = term_getline(s:gdbbuf, lnum + 1)
        if response =~ 'Undefined command'
***************
*** 182,187 ****
--- 187,193 ----
  func s:EndDebug(job, status)
    exe 'bwipe! ' . s:ptybuf
    exe 'bwipe! ' . s:commbuf
+   unlet s:gdbwin
  
    let curwinid = win_getid(winnr())
  
***************
*** 295,300 ****
--- 301,307 ----
    delcommand Evaluate
    delcommand Gdb
    delcommand Program
+   delcommand Source
    delcommand Winbar
  
    nunmap K
*** ../vim-8.0.1712/runtime/doc/terminal.txt    2018-04-14 18:13:44.375164654 
+0200
--- runtime/doc/terminal.txt    2018-04-14 18:57:58.052924516 +0200
***************
*** 649,654 ****
--- 649,661 ----
  When the debugger ends, typically by typing "quit" in the gdb window, the two
  opened windows are closed.
  
+ Only one debugger can be active at a time.
+ 
+ To attach gdb to an already running executable, or use a core file, pass extra
+ arguments.  E.g.: >
+       :Termdebug vim core
+       :Termdebug vim 98343
+ 
  
  Example session ~
                                                        *termdebug-example*
*** ../vim-8.0.1712/src/version.c       2018-04-14 18:13:44.379164629 +0200
--- src/version.c       2018-04-14 18:56:43.869440214 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1713,
  /**/

-- 
If Microsoft would build a car...
... You'd have to press the "Start" button to turn the engine off.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui