Mercurial > vim
annotate 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 |
rev | line source |
---|---|
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
1 " Debugger plugin using gdb. |
12254 | 2 " |
3 " WORK IN PROGRESS - much doesn't work yet | |
4 " | |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
5 " Open two visible terminal windows: |
12254 | 6 " 1. run a pty, as with ":term NONE" |
7 " 2. run gdb, passing the pty | |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
8 " The current window is used to view source code and follows gdb. |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
9 " |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
10 " A third terminal window is hidden, it is used for communication with gdb. |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
11 " |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
12 " The communication with gdb uses GDB/MI. See: |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
13 " https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html |
12254 | 14 " |
15 " Author: Bram Moolenaar | |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
16 " Copyright: Vim license applies, see ":help license" |
12254 | 17 |
12499 | 18 " In case this gets loaded twice. |
19 if exists(':Termdebug') | |
20 finish | |
21 endif | |
22 | |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
23 " Uncomment this line to write logging in "debuglog". |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
24 " call ch_logfile('debuglog', 'w') |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
25 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
26 " The command that starts debugging, e.g. ":Termdebug vim". |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
27 " To end type "quit" in the gdb window. |
12254 | 28 command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>) |
29 | |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
30 " Name of the gdb command, defaults to "gdb". |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
31 if !exists('termdebugger') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
32 let termdebugger = 'gdb' |
12254 | 33 endif |
34 | |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
35 let s:pc_id = 12 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
36 let s:break_id = 13 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
37 let s:stopped = 1 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
38 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
39 if &background == 'light' |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
40 hi default debugPC term=reverse ctermbg=lightblue guibg=lightblue |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
41 else |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
42 hi default debugPC term=reverse ctermbg=darkblue guibg=darkblue |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
43 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
44 hi default debugBreakpoint term=reverse ctermbg=red guibg=red |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
45 |
12254 | 46 func s:StartDebug(cmd) |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
47 let s:startwin = win_getid(winnr()) |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
48 let s:startsigncolumn = &signcolumn |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
49 |
12559 | 50 let s:save_columns = 0 |
51 if exists('g:termdebug_wide') | |
52 if &columns < g:termdebug_wide | |
53 let s:save_columns = &columns | |
54 let &columns = g:termdebug_wide | |
55 endif | |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
56 let vertical = 1 |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
57 else |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
58 let vertical = 0 |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
59 endif |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
60 |
12254 | 61 " Open a terminal window without a job, to run the debugged program |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
62 let s:ptybuf = term_start('NONE', { |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
63 \ 'term_name': 'gdb program', |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
64 \ 'vertical': vertical, |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
65 \ }) |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
66 if s:ptybuf == 0 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
67 echoerr 'Failed to open the program terminal window' |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
68 return |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
69 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
70 let pty = job_info(term_getjob(s:ptybuf))['tty_out'] |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
71 let s:ptywin = win_getid(winnr()) |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
72 if vertical |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
73 " Assuming the source code window will get a signcolumn, use two more |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
74 " columns for that, thus one less for the terminal window. |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
75 exe (&columns / 2 - 1) . "wincmd |" |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
76 endif |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
77 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
78 " Create a hidden terminal window to communicate with gdb |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
79 let s:commbuf = term_start('NONE', { |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
80 \ 'term_name': 'gdb communication', |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
81 \ 'out_cb': function('s:CommOutput'), |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
82 \ 'hidden': 1, |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
83 \ }) |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
84 if s:commbuf == 0 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
85 echoerr 'Failed to open the communication terminal window' |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
86 exe 'bwipe! ' . s:ptybuf |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
87 return |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
88 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
89 let commpty = job_info(term_getjob(s:commbuf))['tty_out'] |
12254 | 90 |
91 " Open a terminal window to run the debugger. | |
12773
d9067dad4ac6
patch 8.0.1264: terminal debugger gets stuck in small window
Christian Brabandt <cb@256bit.org>
parents:
12756
diff
changeset
|
92 " Add -quiet to avoid the intro message causing a hit-enter prompt. |
d9067dad4ac6
patch 8.0.1264: terminal debugger gets stuck in small window
Christian Brabandt <cb@256bit.org>
parents:
12756
diff
changeset
|
93 let cmd = [g:termdebugger, '-quiet', '-tty', pty, a:cmd] |
12254 | 94 echomsg 'executing "' . join(cmd) . '"' |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
95 let s:gdbbuf = term_start(cmd, { |
12254 | 96 \ 'exit_cb': function('s:EndDebug'), |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
97 \ 'term_finish': 'close', |
12254 | 98 \ }) |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
99 if s:gdbbuf == 0 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
100 echoerr 'Failed to open the gdb terminal window' |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
101 exe 'bwipe! ' . s:ptybuf |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
102 exe 'bwipe! ' . s:commbuf |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
103 return |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
104 endif |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
105 let s:gdbwin = win_getid(winnr()) |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
106 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
107 " Connect gdb to the communication pty, using the GDB/MI interface |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
108 call term_sendkeys(s:gdbbuf, 'new-ui mi ' . commpty . "\r") |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
109 |
13450
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
110 " Wait for the response to show up, users may not notice the error and wonder |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
111 " why the debugger doesn't work. |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
112 let try_count = 0 |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
113 while 1 |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
114 let response = '' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
115 for lnum in range(1,20) |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
116 if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi ' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
117 let response = term_getline(s:gdbbuf, lnum + 1) |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
118 if response =~ 'Undefined command' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
119 echoerr 'Your gdb does not support the Machine Interface feature' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
120 exe 'bwipe! ' . s:ptybuf |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
121 exe 'bwipe! ' . s:commbuf |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
122 return |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
123 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
124 if response =~ 'New UI allocated' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
125 " Success! |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
126 break |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
127 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
128 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
129 endfor |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
130 if response =~ 'New UI allocated' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
131 break |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
132 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
133 let try_count += 1 |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
134 if try_count > 100 |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
135 echoerr 'Cannot check if your gdb works, continuing anyway' |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
136 break |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
137 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
138 sleep 10m |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
139 endwhile |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
140 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
141 " Interpret commands while the target is running. This should usualy only be |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
142 " exec-interrupt, since many commands don't work properly while the target is |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
143 " running. |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
144 call s:SendCommand('-gdb-set mi-async on') |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
145 |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
146 " Sign used to highlight the line where the program has stopped. |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
147 " There can be only one. |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
148 sign define debugPC linehl=debugPC |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
149 |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
150 " Sign used to indicate a breakpoint. |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
151 " Can be used multiple times. |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
152 sign define debugBreakpoint text=>> texthl=debugBreakpoint |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
153 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
154 " Install debugger commands in the text window. |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
155 call win_gotoid(s:startwin) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
156 call s:InstallCommands() |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
157 call win_gotoid(s:gdbwin) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
158 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
159 " Enable showing a balloon with eval info |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
160 if has("balloon_eval") || has("balloon_eval_term") |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
161 set balloonexpr=TermDebugBalloonExpr() |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
162 if has("balloon_eval") |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
163 set ballooneval |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
164 endif |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
165 if has("balloon_eval_term") |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
166 set balloonevalterm |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
167 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
168 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
169 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
170 let s:breakpoints = {} |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
171 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
172 augroup TermDebug |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
173 au BufRead * call s:BufRead() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
174 au BufUnload * call s:BufUnloaded() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
175 augroup END |
12254 | 176 endfunc |
177 | |
178 func s:EndDebug(job, status) | |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
179 exe 'bwipe! ' . s:ptybuf |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
180 exe 'bwipe! ' . s:commbuf |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
181 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
182 let curwinid = win_getid(winnr()) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
183 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
184 call win_gotoid(s:startwin) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
185 let &signcolumn = s:startsigncolumn |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
186 call s:DeleteCommands() |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
187 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
188 call win_gotoid(curwinid) |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
189 if s:save_columns > 0 |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
190 let &columns = s:save_columns |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
191 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
192 |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
193 if has("balloon_eval") || has("balloon_eval_term") |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
194 set balloonexpr= |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
195 if has("balloon_eval") |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
196 set noballooneval |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
197 endif |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
198 if has("balloon_eval_term") |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
199 set noballoonevalterm |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
200 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
201 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
202 |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
203 au! TermDebug |
12254 | 204 endfunc |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
205 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
206 " Handle a message received from gdb on the GDB/MI interface. |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
207 func s:CommOutput(chan, msg) |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
208 let msgs = split(a:msg, "\r") |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
209 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
210 for msg in msgs |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
211 " remove prefixed NL |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
212 if msg[0] == "\n" |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
213 let msg = msg[1:] |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
214 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
215 if msg != '' |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
216 if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)' |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
217 call s:HandleCursor(msg) |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
218 elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,' |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
219 call s:HandleNewBreakpoint(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
220 elseif msg =~ '^=breakpoint-deleted,' |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
221 call s:HandleBreakpointDelete(msg) |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
222 elseif msg =~ '^\^done,value=' |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
223 call s:HandleEvaluate(msg) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
224 elseif msg =~ '^\^error,msg=' |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
225 call s:HandleError(msg) |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
226 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
227 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
228 endfor |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
229 endfunc |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
230 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
231 " Install commands in the current window to control the debugger. |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
232 func s:InstallCommands() |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
233 command Break call s:SetBreakpoint() |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
234 command Clear call s:ClearBreakpoint() |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
235 command Step call s:SendCommand('-exec-step') |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
236 command Over call s:SendCommand('-exec-next') |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
237 command Finish call s:SendCommand('-exec-finish') |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
238 command -nargs=* Run call s:Run(<q-args>) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
239 command -nargs=* Arguments call s:SendCommand('-exec-arguments ' . <q-args>) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
240 command Stop call s:SendCommand('-exec-interrupt') |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
241 command Continue call s:SendCommand('-exec-continue') |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
242 command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
243 command Gdb call win_gotoid(s:gdbwin) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
244 command Program call win_gotoid(s:ptywin) |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
245 command Winbar call s:InstallWinbar() |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
246 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
247 " TODO: can the K mapping be restored? |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
248 nnoremap K :Evaluate<CR> |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
249 |
13051 | 250 if has('menu') && &mouse != '' |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
251 call s:InstallWinbar() |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
252 |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
253 if !exists('g:termdebug_popup') || g:termdebug_popup != 0 |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
254 let s:saved_mousemodel = &mousemodel |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
255 let &mousemodel = 'popup_setpos' |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
256 an 1.200 PopUp.-SEP3- <Nop> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
257 an 1.210 PopUp.Set\ breakpoint :Break<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
258 an 1.220 PopUp.Clear\ breakpoint :Clear<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
259 an 1.230 PopUp.Evaluate :Evaluate<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
260 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
261 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
262 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
263 |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
264 let s:winbar_winids = [] |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
265 |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
266 " Install the window toolbar in the current window. |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
267 func s:InstallWinbar() |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
268 nnoremenu WinBar.Step :Step<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
269 nnoremenu WinBar.Next :Over<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
270 nnoremenu WinBar.Finish :Finish<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
271 nnoremenu WinBar.Cont :Continue<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
272 nnoremenu WinBar.Stop :Stop<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
273 nnoremenu WinBar.Eval :Evaluate<CR> |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
274 call add(s:winbar_winids, win_getid(winnr())) |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
275 endfunc |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
276 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
277 " Delete installed debugger commands in the current window. |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
278 func s:DeleteCommands() |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
279 delcommand Break |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
280 delcommand Clear |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
281 delcommand Step |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
282 delcommand Over |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
283 delcommand Finish |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
284 delcommand Run |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
285 delcommand Arguments |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
286 delcommand Stop |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
287 delcommand Continue |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
288 delcommand Evaluate |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
289 delcommand Gdb |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
290 delcommand Program |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
291 delcommand Winbar |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
292 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
293 nunmap K |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
294 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
295 if has('menu') |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
296 " Remove the WinBar entries from all windows where it was added. |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
297 let curwinid = win_getid(winnr()) |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
298 for winid in s:winbar_winids |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
299 if win_gotoid(winid) |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
300 aunmenu WinBar.Step |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
301 aunmenu WinBar.Next |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
302 aunmenu WinBar.Finish |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
303 aunmenu WinBar.Cont |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
304 aunmenu WinBar.Stop |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
305 aunmenu WinBar.Eval |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
306 endif |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
307 endfor |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
308 call win_gotoid(curwinid) |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
309 let s:winbar_winids = [] |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
310 |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
311 if exists('s:saved_mousemodel') |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
312 let &mousemodel = s:saved_mousemodel |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
313 unlet s:saved_mousemodel |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
314 aunmenu PopUp.-SEP3- |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
315 aunmenu PopUp.Set\ breakpoint |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
316 aunmenu PopUp.Clear\ breakpoint |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
317 aunmenu PopUp.Evaluate |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
318 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
319 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
320 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
321 exe 'sign unplace ' . s:pc_id |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
322 for key in keys(s:breakpoints) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
323 exe 'sign unplace ' . (s:break_id + key) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
324 endfor |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
325 sign undefine debugPC |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
326 sign undefine debugBreakpoint |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
327 unlet s:breakpoints |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
328 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
329 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
330 " :Break - Set a breakpoint at the cursor position. |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
331 func s:SetBreakpoint() |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
332 " Setting a breakpoint may not work while the program is running. |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
333 " Interrupt to make it work. |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
334 let do_continue = 0 |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
335 if !s:stopped |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
336 let do_continue = 1 |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
337 call s:SendCommand('-exec-interrupt') |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
338 sleep 10m |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
339 endif |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
340 call s:SendCommand('-break-insert --source ' |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
341 \ . fnameescape(expand('%:p')) . ' --line ' . line('.')) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
342 if do_continue |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
343 call s:SendCommand('-exec-continue') |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
344 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
345 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
346 |
13377
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
347 " :Clear - Delete a breakpoint at the cursor position. |
1ffba37fd222
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mouse
Christian Brabandt <cb@256bit.org>
parents:
13341
diff
changeset
|
348 func s:ClearBreakpoint() |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
349 let fname = fnameescape(expand('%:p')) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
350 let lnum = line('.') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
351 for [key, val] in items(s:breakpoints) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
352 if val['fname'] == fname && val['lnum'] == lnum |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
353 call term_sendkeys(s:commbuf, '-break-delete ' . key . "\r") |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
354 " Assume this always wors, the reply is simply "^done". |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
355 exe 'sign unplace ' . (s:break_id + key) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
356 unlet s:breakpoints[key] |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
357 break |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
358 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
359 endfor |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
360 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
361 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
362 " :Next, :Continue, etc - send a command to gdb |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
363 func s:SendCommand(cmd) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
364 call term_sendkeys(s:commbuf, a:cmd . "\r") |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
365 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
366 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
367 func s:Run(args) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
368 if a:args != '' |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
369 call s:SendCommand('-exec-arguments ' . a:args) |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
370 endif |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
371 call s:SendCommand('-exec-run') |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
372 endfunc |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
373 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
374 func s:SendEval(expr) |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
375 call s:SendCommand('-data-evaluate-expression "' . a:expr . '"') |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
376 let s:evalexpr = a:expr |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
377 endfunc |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
378 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
379 " :Evaluate - evaluate what is under the cursor |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
380 func s:Evaluate(range, arg) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
381 if a:arg != '' |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
382 let expr = a:arg |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
383 elseif a:range == 2 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
384 let pos = getcurpos() |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
385 let reg = getreg('v', 1, 1) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
386 let regt = getregtype('v') |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
387 normal! gv"vy |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
388 let expr = @v |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
389 call setpos('.', pos) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
390 call setreg('v', reg, regt) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
391 else |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
392 let expr = expand('<cexpr>') |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
393 endif |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
394 let s:ignoreEvalError = 0 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
395 call s:SendEval(expr) |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
396 endfunc |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
397 |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
398 let s:ignoreEvalError = 0 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
399 let s:evalFromBalloonExpr = 0 |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
400 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
401 " Handle the result of data-evaluate-expression |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
402 func s:HandleEvaluate(msg) |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
403 let value = substitute(a:msg, '.*value="\(.*\)"', '\1', '') |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
404 let value = substitute(value, '\\"', '"', 'g') |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
405 if s:evalFromBalloonExpr |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
406 if s:evalFromBalloonExprResult == '' |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
407 let s:evalFromBalloonExprResult = s:evalexpr . ': ' . value |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
408 else |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
409 let s:evalFromBalloonExprResult .= ' = ' . value |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
410 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
411 call balloon_show(s:evalFromBalloonExprResult) |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
412 else |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
413 echomsg '"' . s:evalexpr . '": ' . value |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
414 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
415 |
12826 | 416 if s:evalexpr[0] != '*' && value =~ '^0x' && value != '0x0' && value !~ '"$' |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
417 " Looks like a pointer, also display what it points to. |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
418 let s:ignoreEvalError = 1 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
419 call s:SendEval('*' . s:evalexpr) |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
420 else |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
421 let s:evalFromBalloonExpr = 0 |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
422 endif |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
423 endfunc |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
424 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
425 " Show a balloon with information of the variable under the mouse pointer, |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
426 " if there is any. |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
427 func TermDebugBalloonExpr() |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
428 if v:beval_winid != s:startwin |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
429 return |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
430 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
431 let s:evalFromBalloonExpr = 1 |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
432 let s:evalFromBalloonExprResult = '' |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
433 let s:ignoreEvalError = 1 |
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
434 call s:SendEval(v:beval_text) |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
435 return '' |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
436 endfunc |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
437 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
438 " Handle an error. |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
439 func s:HandleError(msg) |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
440 if s:ignoreEvalError |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
441 " Result of s:SendEval() failed, ignore. |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
442 let s:ignoreEvalError = 0 |
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
443 let s:evalFromBalloonExpr = 0 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
444 return |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
445 endif |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
446 echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '') |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
447 endfunc |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
448 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
449 " Handle stopping and running message from gdb. |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
450 " Will update the sign that shows the current position. |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
451 func s:HandleCursor(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
452 let wid = win_getid(winnr()) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
453 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
454 if a:msg =~ '^\*stopped' |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
455 let s:stopped = 1 |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
456 elseif a:msg =~ '^\*running' |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
457 let s:stopped = 0 |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
458 endif |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
459 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
460 if win_gotoid(s:startwin) |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
461 let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
462 if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
463 let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
464 if lnum =~ '^[0-9]*$' |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
465 if expand('%:p') != fnamemodify(fname, ':p') |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
466 if &modified |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
467 " TODO: find existing window |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
468 exe 'split ' . fnameescape(fname) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
469 let s:startwin = win_getid(winnr()) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
470 else |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
471 exe 'edit ' . fnameescape(fname) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
472 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
473 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
474 exe lnum |
12756
3b26420fc639
Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents:
12559
diff
changeset
|
475 exe 'sign unplace ' . s:pc_id |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
476 exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
477 setlocal signcolumn=yes |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
478 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
479 else |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
480 exe 'sign unplace ' . s:pc_id |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
481 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
482 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
483 call win_gotoid(wid) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
484 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
485 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
486 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
487 " Handle setting a breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
488 " Will update the sign that shows the breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
489 func s:HandleNewBreakpoint(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
490 let nr = substitute(a:msg, '.*number="\([0-9]\)*\".*', '\1', '') + 0 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
491 if nr == 0 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
492 return |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
493 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
494 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
495 if has_key(s:breakpoints, nr) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
496 let entry = s:breakpoints[nr] |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
497 else |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
498 let entry = {} |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
499 let s:breakpoints[nr] = entry |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
500 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
501 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
502 let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
503 let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
504 let entry['fname'] = fname |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
505 let entry['lnum'] = lnum |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
506 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
507 if bufloaded(fname) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
508 call s:PlaceSign(nr, entry) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
509 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
510 endfunc |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
511 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
512 func s:PlaceSign(nr, entry) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
513 exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint file=' . a:entry['fname'] |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
514 let a:entry['placed'] = 1 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
515 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
516 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
517 " Handle deleting a breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
518 " Will remove the sign that shows the breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
519 func s:HandleBreakpointDelete(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
520 let nr = substitute(a:msg, '.*id="\([0-9]*\)\".*', '\1', '') + 0 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
521 if nr == 0 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
522 return |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
523 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
524 if has_key(s:breakpoints, nr) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
525 let entry = s:breakpoints[nr] |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
526 if has_key(entry, 'placed') |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
527 exe 'sign unplace ' . (s:break_id + nr) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
528 unlet entry['placed'] |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
529 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
530 unlet s:breakpoints[nr] |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
531 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
532 endfunc |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
533 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
534 " Handle a BufRead autocommand event: place any signs. |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
535 func s:BufRead() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
536 let fname = expand('<afile>:p') |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
537 for [nr, entry] in items(s:breakpoints) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
538 if entry['fname'] == fname |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
539 call s:PlaceSign(nr, entry) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
540 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
541 endfor |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
542 endfunc |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
543 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
544 " Handle a BufUnloaded autocommand event: unplace any signs. |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
545 func s:BufUnloaded() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
546 let fname = expand('<afile>:p') |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
547 for [nr, entry] in items(s:breakpoints) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
548 if entry['fname'] == fname |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
549 let entry['placed'] = 0 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
550 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
551 endfor |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
552 endfunc |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
553 |