To: vim_dev@googlegroups.com Subject: Patch 8.0.1599 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1599 Problem: No error message when gdb does not support the terminal debugger. Solution: Check for the response to open the Machine Interface. Files: runtime/pack/dist/opt/termdebug/plugin/termdebug.vim *** ../vim-8.0.1598/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-03-03 20:46:28.755725320 +0100 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2018-03-11 20:47:56.295727423 +0100 *************** *** 105,113 **** let s:gdbwin = win_getid(winnr()) " Connect gdb to the communication pty, using the GDB/MI interface - " If you get an error "undefined command" your GDB is too old. call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r") " Interpret commands while the target is running. This should usualy only be " exec-interrupt, since many commands don't work properly while the target is " running. --- 105,143 ---- let s:gdbwin = win_getid(winnr()) " Connect gdb to the communication pty, using the GDB/MI interface call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r") + " Wait for the response to show up, users may not notice the error and wonder + " why the debugger doesn't work. + 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' + echoerr 'Your gdb does not support the Machine Interface feature' + exe 'bwipe! ' . s:ptybuf + exe 'bwipe! ' . s:commbuf + return + endif + if response =~ 'New UI allocated' + " Success! + break + endif + endif + endfor + if response =~ 'New UI allocated' + break + endif + let try_count += 1 + if try_count > 100 + echoerr 'Cannot check if your gdb works, continuing anyway' + break + endif + sleep 10m + endwhile + " Interpret commands while the target is running. This should usualy only be " exec-interrupt, since many commands don't work properly while the target is " running. *** ../vim-8.0.1598/src/version.c 2018-03-11 19:30:40.132142717 +0100 --- src/version.c 2018-03-11 20:49:05.767296356 +0100 *************** *** 768,769 **** --- 768,771 ---- { /* Add new patch number below this line */ + /**/ + 1599, /**/ -- I think that you'll agree that engineers are very effective in their social interactions. It's the "normal" people who are nuts. (Scott Adams - The Dilbert principle) /// 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 ///