comparison runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @ 13450:a7a88403ccb1 v8.0.1599

patch 8.0.1599: no error message when gdb does not support debugger commit https://github.com/vim/vim/commit/3e4b84d0b55936ac017d20df6651ddd05e38f58f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 11 20:51:52 2018 +0100 patch 8.0.1599: no error message when gdb does not support debugger Problem: No error message when gdb does not support the terminal debugger. Solution: Check for the response to open the Machine Interface.
author Christian Brabandt <cb@256bit.org>
date Sun, 11 Mar 2018 21:00:08 +0100
parents 1ffba37fd222
children a036c2cf4024
comparison
equal deleted inserted replaced
13449:ab94650bc5ca 13450:a7a88403ccb1
103 return 103 return
104 endif 104 endif
105 let s:gdbwin = win_getid(winnr()) 105 let s:gdbwin = win_getid(winnr())
106 106
107 " Connect gdb to the communication pty, using the GDB/MI interface 107 " Connect gdb to the communication pty, using the GDB/MI interface
108 " If you get an error "undefined command" your GDB is too old.
109 call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r") 108 call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r")
109
110 " Wait for the response to show up, users may not notice the error and wonder
111 " why the debugger doesn't work.
112 let try_count = 0
113 while 1
114 let response = ''
115 for lnum in range(1,20)
116 if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi '
117 let response = term_getline(s:gdbbuf, lnum + 1)
118 if response =~ 'Undefined command'
119 echoerr 'Your gdb does not support the Machine Interface feature'
120 exe 'bwipe! ' . s:ptybuf
121 exe 'bwipe! ' . s:commbuf
122 return
123 endif
124 if response =~ 'New UI allocated'
125 " Success!
126 break
127 endif
128 endif
129 endfor
130 if response =~ 'New UI allocated'
131 break
132 endif
133 let try_count += 1
134 if try_count > 100
135 echoerr 'Cannot check if your gdb works, continuing anyway'
136 break
137 endif
138 sleep 10m
139 endwhile
110 140
111 " Interpret commands while the target is running. This should usualy only be 141 " Interpret commands while the target is running. This should usualy only be
112 " exec-interrupt, since many commands don't work properly while the target is 142 " exec-interrupt, since many commands don't work properly while the target is
113 " running. 143 " running.
114 call s:SendCommand('-gdb-set mi-async on') 144 call s:SendCommand('-gdb-set mi-async on')