diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-03-11 20:51:52 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-03-11 20:51:52 +0100 |
commit | 3e4b84d0b55936ac017d20df6651ddd05e38f58f (patch) | |
tree | 498443f3a1836791b1408ee60014abc896b3d65e | |
parent | c48369c3fc507f398abbc933a60f653c6abe6701 (diff) | |
download | vim-git-3e4b84d0b55936ac017d20df6651ddd05e38f58f.tar.gz |
patch 8.0.1599: no error message when gdb does not support debuggerv8.0.1599
Problem: No error message when gdb does not support the terminal debugger.
Solution: Check for the response to open the Machine Interface.
-rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 32 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index add0de981..65765bb31 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -105,9 +105,39 @@ func s:StartDebug(cmd) 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") + " 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. diff --git a/src/version.c b/src/version.c index 4c192717f..eabf6fb31 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1599, +/**/ 1598, /**/ 1597, |