Patch 8.0.1725
Problem:    Terminal debugger doesn't handle command arguments.
Solution:   Add the :TermdebugCommand command.  Use a ! to execute right away.
            (Christian Brabandt)
Files:      runtime/pack/dist/opt/termdebug/plugin/termdebug.vim,
            runtime/doc/terminal.txt


*** ../vim-8.0.1724/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim        
2018-04-14 18:59:45.928174961 +0200
--- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim        2018-04-16 
16:16:51.848971612 +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(<f-args>)
  
  " Name of the gdb command, defaults to "gdb".
  if !exists('termdebugger')
--- 25,32 ----
  
  " The command that starts debugging, e.g. ":Termdebug vim".
  " To end type "quit" in the gdb window.
! command -nargs=* -complete=file -bang Termdebug call s:StartDebug(<bang>0, 
<f-args>)
! command -nargs=+ -complete=file -bang TermdebugCommand call 
s:StartDebugCommand(<bang>0, <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(...)
    if exists('s:gdbwin')
      echoerr 'Terminal debugger already running'
      return
--- 44,60 ----
  endif
  hi default debugBreakpoint term=reverse ctermbg=red guibg=red
  
! func s:StartDebug(bang, ...)
!   " First argument is the command to debug, second core file or process ID.
!   call s:StartDebug_internal({'gdb_args': a:000, 'bang': a:bang})
! endfunc
! 
! func s:StartDebugCommand(bang, ...)
!   " First argument is the command to debug, rest are run arguments.
!   call s:StartDebug_internal({'gdb_args': [a:1], 'proc_args': a:000[1:], 
'bang': a:bang})
! endfunc
! 
! func s:StartDebug_internal(dict)
    if exists('s:gdbwin')
      echoerr 'Terminal debugger already running'
      return
***************
*** 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'),
--- 106,115 ----
  
    " Open a terminal window to run the debugger.
    " Add -quiet to avoid the intro message causing a hit-enter prompt.
!   let gdb_args = get(a:dict, 'gdb_args', [])
!   let proc_args = get(a:dict, 'proc_args', [])
! 
!   let cmd = [g:termdebugger, '-quiet', '-tty', pty] + gdb_args
    echomsg 'executing "' . join(cmd) . '"'
    let s:gdbbuf = term_start(cmd, {
        \ 'exit_cb': function('s:EndDebug'),
***************
*** 109,114 ****
--- 123,133 ----
    endif
    let s:gdbwin = win_getid(winnr())
  
+   " Set arguments to be run
+   if len(proc_args)
+     call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r")
+   endif
+ 
    " Connect gdb to the communication pty, using the GDB/MI interface
    call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r")
  
***************
*** 182,187 ****
--- 201,214 ----
      au BufRead * call s:BufRead()
      au BufUnload * call s:BufUnloaded()
    augroup END
+ 
+   " Run the command if the bang attribute was given
+   " and got to the window
+   if get(a:dict, 'bang', 0)
+     call s:SendCommand('-exec-run')
+     call win_gotoid(s:ptywin)
+   endif
+ 
  endfunc
  
  func s:EndDebug(job, status)
*** ../vim-8.0.1724/runtime/doc/terminal.txt    2018-04-14 18:59:45.932174933 
+0200
--- runtime/doc/terminal.txt    2018-04-16 16:08:23.384925575 +0200
***************
*** 623,629 ****
  Load the plugin with this command: >
        packadd termdebug
  <                                                     *:Termdebug*
! To start debugging use `:Termdebug` followed by the command name, for 
example: >
        :Termdebug vim
  
  This opens two windows:
--- 623,630 ----
  Load the plugin with this command: >
        packadd termdebug
  <                                                     *:Termdebug*
! To start debugging use `:Termdebug` or `:TermdebugCommand`` followed by the
! command name, for example: >
        :Termdebug vim
  
  This opens two windows:
***************
*** 641,647 ****
  highlight the current position, using highlight group debugPC.         
  
  If the buffer in the current window is modified, another window will be opened
! to display the current gdb position.
  
  Focus the terminal of the executed program to interact with it.  This works
  the same as any command running in a terminal window.
--- 642,649 ----
  highlight the current position, using highlight group debugPC.         
  
  If the buffer in the current window is modified, another window will be opened
! to display the current gdb position.  You can use `:Winbar` to add a window
! toolbar there.
  
  Focus the terminal of the executed program to interact with it.  This works
  the same as any command running in a terminal window.
***************
*** 650,661 ****
  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*
--- 652,676 ----
  opened windows are closed.
  
  Only one debugger can be active at a time.
+                                                       *:TermdebugCommand*
+ If you want to give specific commands to the command being debugged, you can
+ use the `:TermdebugCommand` command followed by the command name and
+ additional parameters. >
+       :TermdebugCommand vim --clean -c ':set nu'
+ 
+ Both the `:Termdebug` and `:TermdebugCommand` support an optional "!" bang
+ argument to start the command right away, without pausing at the gdb window
+ (and cursor will be in the debugged window).  For example: >
+       :TermdebugCommand! vim --clean
  
! To attach gdb to an already running executable or use a core file, pass extra
  arguments.  E.g.: >
        :Termdebug vim core
        :Termdebug vim 98343
  
+ If no argument is given, you'll end up in a gdb window, in which you need to
+ specify which command to run using e.g. the gdb `file` command.
+ 
  
  Example session ~
                                                        *termdebug-example*
***************
*** 728,745 ****
  - frame N     go to the Nth stack frame
  - continue    continue execution
  
! In the window showing the source code these commands can be used to control 
gdb:
   `:Run` [args]            run the program with [args] or the previous 
arguments
   `:Arguments` {args}  set arguments for the next `:Run`
  
!  `:Break`     set a breakpoint at the current line; a sign will be displayed
!  `:Clear`     delete the breakpoint at the current line
  
!  `:Step`      execute the gdb "step" command
!  `:Over`      execute the gdb "next" command (`:Next` is a Vim command)
!  `:Finish`    execute the gdb "finish" command
!  `:Continue`  execute the gdb "continue" command
!  `:Stop`      interrupt the program
  
  If 'mouse' is set the plugin adds a window toolbar with these entries:
    Step                `:Step`
--- 743,762 ----
  - frame N     go to the Nth stack frame
  - continue    continue execution
  
!                                               *:Run* *:Arguments*
! In the window showing the source code these commands can be used to control
! gdb:
   `:Run` [args]            run the program with [args] or the previous 
arguments
   `:Arguments` {args}  set arguments for the next `:Run`
  
!  *:Break*     set a breakpoint at the current line; a sign will be displayed
!  *:Clear*     delete the breakpoint at the current line
  
!  *:Step*      execute the gdb "step" command
!  *:Over*      execute the gdb "next" command (`:Next` is a Vim command)
!  *:Finish*    execute the gdb "finish" command
!  *:Continue*  execute the gdb "continue" command
!  *:Stop*      interrupt the program
  
  If 'mouse' is set the plugin adds a window toolbar with these entries:
    Step                `:Step`
***************
*** 750,756 ****
    Eval                `:Evaluate`
  This way you can use the mouse to perform the most common commands.  You need
  to have the 'mouse' option set to enable mouse clicks.
! 
  You can add the window toolbar in other windows you open with: >
    :Winbar
  
--- 767,773 ----
    Eval                `:Evaluate`
  This way you can use the mouse to perform the most common commands.  You need
  to have the 'mouse' option set to enable mouse clicks.
!                                                               *:Winbar*
  You can add the window toolbar in other windows you open with: >
    :Winbar
  
***************
*** 761,767 ****
  
  
  Inspecting variables ~
!                                                       *termdebug-variables*
   `:Evaluate`      evaluate the expression under the cursor
   `K`              same
   `:Evaluate` {expr}   evaluate {expr}
--- 778,784 ----
  
  
  Inspecting variables ~
!                                       *termdebug-variables* *:Evaluate*
   `:Evaluate`      evaluate the expression under the cursor
   `K`              same
   `:Evaluate` {expr}   evaluate {expr}
***************
*** 773,781 ****
  
  Other commands ~
                                                        *termdebug-commands*
!  :Gdb      jump to the gdb window
!  :Program    jump to the window with the running program
!  :Source     jump to the window with the source code, create it if there
             isn't one
  
  
--- 790,798 ----
  
  Other commands ~
                                                        *termdebug-commands*
!  *:Gdb*            jump to the gdb window
!  *:Program*    jump to the window with the running program
!  *:Source*     jump to the window with the source code, create it if there
             isn't one
  
  
*** ../vim-8.0.1724/src/version.c       2018-04-16 15:40:46.804497985 +0200
--- src/version.c       2018-04-16 16:20:35.131304810 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1725,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
197. Your desk collapses under the weight of your computer peripherals.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui