File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
runtime/pack/dist/opt/termdebug/plugin Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -105,9 +105,39 @@ func s:StartDebug(cmd)
105
105
let s: gdbwin = win_getid (winnr ())
106
106
107
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
108
call term_sendkeys (s: gdbbuf , ' new-ui mi ' . commpty . " \r " )
110
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 10 m
139
+ endwhile
140
+
111
141
" Interpret commands while the target is running. This should usualy only be
112
142
" exec-interrupt, since many commands don't work properly while the target is
113
143
" running.
Original file line number Diff line number Diff line change @@ -766,6 +766,8 @@ static char *(features[]) =
766
766
767
767
static int included_patches [] =
768
768
{ /* Add new patch number below this line */
769
+ /**/
770
+ 1599 ,
769
771
/**/
770
772
1598 ,
771
773
/**/
You can’t perform that action at this time.
0 commit comments