To: vim_dev@googlegroups.com Subject: Patch 8.1.0080 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0080 Problem: Can't see the breakpoint number in the terminal debugger. Solution: Use the breakpoint number for the sign. (Christian Brabandt) Files: runtime/doc/terminal.txt, runtime/pack/dist/opt/termdebug/plugin/termdebug.vim *** ../vim-8.1.0079/runtime/doc/terminal.txt 2018-06-17 22:19:07.267202961 +0200 --- runtime/doc/terminal.txt 2018-06-19 16:55:43.126412132 +0200 *************** *** 19,26 **** Resizing |terminal-resizing| Terminal Modes |Terminal-mode| Cursor style |terminal-cursor-style| - Special keys |terminal-special-keys| Session |terminal-session| Unix |terminal-unix| MS-Windows |terminal-ms-windows| 2. Terminal communication |terminal-communication| --- 19,26 ---- Resizing |terminal-resizing| Terminal Modes |Terminal-mode| Cursor style |terminal-cursor-style| Session |terminal-session| + Special keys |terminal-special-keys| Unix |terminal-unix| MS-Windows |terminal-ms-windows| 2. Terminal communication |terminal-communication| *************** *** 116,124 **** < *options-in-terminal* After opening the terminal window and setting 'buftype' to "terminal" the ! BufWinEnter autocommand event is triggered. This makes it possible to set options specifically for the window and buffer. Example: > ! au BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif Mouse events (click and drag) are passed to the terminal. Mouse move events are only passed when Vim itself is receiving them. For a terminal that is --- 116,127 ---- < *options-in-terminal* After opening the terminal window and setting 'buftype' to "terminal" the ! TerminalOpen autocommand event is triggered. This makes it possible to set options specifically for the window and buffer. Example: > ! au TerminalOpen * if &buftype == 'terminal' | setlocal bufhidden=hide | endif ! The is set to the terminal buffer, but if there is no window (hidden ! terminal) then setting options will happen in the wrong buffer, therefore the ! check for &buftype in the example. Mouse events (click and drag) are passed to the terminal. Mouse move events are only passed when Vim itself is receiving them. For a terminal that is *************** *** 449,455 **** of the terminal and {argument}, the decoded JSON argument. The function name must start with "Tapi_" to avoid accidentally calling a function not meant to be used for the ! terminal API The user function should sanity check the argument. The function can use |term_sendkeys()| to send back a reply. Example in JSON: > --- 452,458 ---- of the terminal and {argument}, the decoded JSON argument. The function name must start with "Tapi_" to avoid accidentally calling a function not meant to be used for the ! terminal API. The user function should sanity check the argument. The function can use |term_sendkeys()| to send back a reply. Example in JSON: > *************** *** 702,712 **** Vim will start running in the program window. Put focus there and type: > :help gui Gdb will run into the ex_help breakpoint. The source window now shows the ! ex_cmds.c file. A ">>" marker will appear where the breakpoint was set. The ! line where the debugger stopped is highlighted. You can now step through the ! program. Let's use the mouse: click on the "Next" button in the window ! toolbar. You will see the highlighting move as the debugger executes a line ! of source code. Click "Next" a few times until the for loop is highlighted. Put the cursor on the end of "eap->arg", then click "Eval" in the toolbar. You will see this --- 705,715 ---- Vim will start running in the program window. Put focus there and type: > :help gui Gdb will run into the ex_help breakpoint. The source window now shows the ! ex_cmds.c file. A red "1 " marker will appear in the signcolumn where the ! breakpoint was set. The line where the debugger stopped is highlighted. You ! can now step through the program. Let's use the mouse: click on the "Next" ! button in the window toolbar. You will see the highlighting move as the ! debugger executes a line of source code. Click "Next" a few times until the for loop is highlighted. Put the cursor on the end of "eap->arg", then click "Eval" in the toolbar. You will see this *************** *** 785,790 **** --- 788,800 ---- happens if the buffer in the source code window has been modified and can't be abandoned. + Gdb gives each breakpoint a number. In Vim the number shows up in the sign + column, with a red background. You can use these gdb commands: + - info break list breakpoints + - delete N delete breakpoint N + You can also use the `:Clear` command if the cursor is in the line with the + breakpoint, or use the "Clear breakpoint" right-click menu entry. + Inspecting variables ~ *termdebug-variables* *:Evaluate* *************** *** 828,833 **** --- 838,850 ---- gdb. The buffer name is "gdb communication". Do not delete this buffer, it will break the debugger. + Gdb has some weird behavior, the plugin does its best to work around that. + For example, after typing "continue" in the gdb window a CTRL-C can be used to + interrupt the running program. But after using the MI command + "-exec-continue" pressing CTRL-C does not interrupt. Therefore you will see + "continue" being used for the `:Continue` command, instead of using the + communication channel. + Customizing ~ *************** *** 885,891 **** let g:termdebug_wide = 163 This will set &columns to 163 when :Termdebug is used. The value is restored when quitting the debugger. ! If g:termdebug_wide is set and &Columns is already larger than g:termdebug_wide then a vertical split will be used without changing &columns. Set it to 1 to get a vertical split without every changing &columns (useful for when the terminal can't be resized by Vim). --- 902,908 ---- let g:termdebug_wide = 163 This will set &columns to 163 when :Termdebug is used. The value is restored when quitting the debugger. ! If g:termdebug_wide is set and &columns is already larger than g:termdebug_wide then a vertical split will be used without changing &columns. Set it to 1 to get a vertical split without every changing &columns (useful for when the terminal can't be resized by Vim). *** ../vim-8.1.0079/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-06-17 21:34:08.277873656 +0200 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-06-19 16:59:18.185759005 +0200 *************** *** 67,73 **** endif let s:pc_id = 12 ! let s:break_id = 13 let s:stopped = 1 if &background == 'light' --- 67,73 ---- endif let s:pc_id = 12 ! let s:break_id = 13 " breakpoint number is added to this let s:stopped = 1 if &background == 'light' *************** *** 325,334 **** " There can be only one. sign define debugPC linehl=debugPC - " Sign used to indicate a breakpoint. - " Can be used multiple times. - sign define debugBreakpoint text=>> texthl=debugBreakpoint - " Install debugger commands in the text window. call win_gotoid(s:sourcewin) call s:InstallCommands() --- 325,330 ---- *************** *** 345,350 **** --- 341,347 ---- endif endif + " Contains breakpoints that have been placed, key is the number. let s:breakpoints = {} augroup TermDebug *************** *** 813,818 **** --- 810,825 ---- call win_gotoid(wid) endfunc + func s:CreateBreakpoint(nr) + if !exists("s:BreakpointSigns") + let s:BreakpointSigns = [] + endif + if index(s:BreakpointSigns, a:nr) == -1 + call add(s:BreakpointSigns, a:nr) + exe "sign define debugBreakpoint". a:nr . " text=" . a:nr . " texthl=debugBreakpoint" + endif + endfunc + " Handle setting a breakpoint " Will update the sign that shows the breakpoint func s:HandleNewBreakpoint(msg) *************** *** 820,825 **** --- 827,833 ---- if nr == 0 return endif + call s:CreateBreakpoint(nr) if has_key(s:breakpoints, nr) let entry = s:breakpoints[nr] *************** *** 839,845 **** endfunc func s:PlaceSign(nr, entry) ! exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint file=' . a:entry['fname'] let a:entry['placed'] = 1 endfunc --- 847,853 ---- endfunc func s:PlaceSign(nr, entry) ! exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . a:nr . ' file=' . a:entry['fname'] let a:entry['placed'] = 1 endfunc *** ../vim-8.1.0079/src/version.c 2018-06-19 14:45:33.583620880 +0200 --- src/version.c 2018-06-19 16:57:00.654200256 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 80, /**/ -- hundred-and-one symptoms of being an internet addict: 90. Instead of calling you to dinner, your spouse sends e-mail. /// Bram Moolenaar -- Bram@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 ///