Mercurial > vim
annotate runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @ 14126:1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
commit https://github.com/vim/vim/commit/de1a83147a28d3db8f9fca415ffc8fa04218eac2
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 19 16:59:54 2018 +0200
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Problem: Can't see the breakpoint number in the terminal debugger.
Solution: Use the breakpoint number for the sign. (Christian Brabandt)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Jun 2018 17:00:07 +0200 |
parents | 274c9f1fbfd2 |
children | d2b14df7e439 |
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 " |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
3 " Author: Bram Moolenaar |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
4 " Copyright: Vim license applies, see ":help license" |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
5 " Last Update: 2018 Jun 3 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
6 " |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
7 " WORK IN PROGRESS - Only the basics work |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
8 " Note: On MS-Windows you need a recent version of gdb. The one included with |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
9 " MingW is too old (7.6.1). |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
10 " I used version 7.12 from http://www.equation.com/servlet/equation.cmd?fa=gdb |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
11 " |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
12 " There are two ways to run gdb: |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
13 " - In a terminal window; used if possible, does not work on MS-Windows |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
14 " Not used when g:termdebug_use_prompt is set to 1. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
15 " - Using a "prompt" buffer; may use a terminal window for the program |
12254 | 16 " |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
17 " For both the current window is used to view source code and shows the |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
18 " current statement from gdb. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
19 " |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
20 " USING A TERMINAL WINDOW |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
21 " |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
22 " Opens two visible terminal windows: |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
23 " 1. runs a pty for the debugged program, as with ":term NONE" |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
24 " 2. runs gdb, passing the pty of 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
|
25 " 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
|
26 " |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
27 " USING A PROMPT BUFFER |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
28 " |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
29 " Opens a window with a prompt buffer to communicate with gdb. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
30 " Gdb is run as a job with callbacks for I/O. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
31 " On Unix another terminal window is opened to run the debugged program |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
32 " On MS-Windows a separate console is opened to run the debugged program |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
33 " |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
34 " 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
|
35 " https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html |
12254 | 36 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
37 " In case this gets sourced twice. |
12499 | 38 if exists(':Termdebug') |
39 finish | |
40 endif | |
41 | |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
42 " Need either the +terminal feature or +channel and the prompt buffer. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
43 " The terminal feature does not work with gdb on win32. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
44 if has('terminal') && !has('win32') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
45 let s:way = 'terminal' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
46 elseif has('channel') && exists('*prompt_setprompt') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
47 let s:way = 'prompt' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
48 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
49 if has('terminal') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
50 let s:err = 'Cannot debug, missing prompt buffer support' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
51 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
52 let s:err = 'Cannot debug, +channel feature is not supported' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
53 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
54 command -nargs=* -complete=file -bang Termdebug echoerr s:err |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
55 command -nargs=+ -complete=file -bang TermdebugCommand echoerr s:err |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
56 finish |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
57 endif |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
58 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
59 " 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
|
60 " To end type "quit" in the gdb window. |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
61 command -nargs=* -complete=file -bang Termdebug call s:StartDebug(<bang>0, <f-args>) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
62 command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(<bang>0, <f-args>) |
12254 | 63 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
64 " 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
|
65 if !exists('termdebugger') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
66 let termdebugger = 'gdb' |
12254 | 67 endif |
68 | |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
69 let s:pc_id = 12 |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
70 let s:break_id = 13 " breakpoint number is added to this |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
71 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
|
72 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
73 if &background == 'light' |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
74 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
|
75 else |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
76 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
|
77 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
78 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
|
79 |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
80 func s:StartDebug(bang, ...) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
81 " First argument is the command to debug, second core file or process ID. |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
82 call s:StartDebug_internal({'gdb_args': a:000, 'bang': a:bang}) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
83 endfunc |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
84 |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
85 func s:StartDebugCommand(bang, ...) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
86 " First argument is the command to debug, rest are run arguments. |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
87 call s:StartDebug_internal({'gdb_args': [a:1], 'proc_args': a:000[1:], 'bang': a:bang}) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
88 endfunc |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
89 |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
90 func s:StartDebug_internal(dict) |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
91 if exists('s:gdbwin') |
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
92 echoerr 'Terminal debugger already running' |
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
93 return |
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
94 endif |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
95 let s:ptywin = 0 |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
96 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
97 " Uncomment this line to write logging in "debuglog". |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
98 " call ch_logfile('debuglog', 'w') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
99 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
100 let s:sourcewin = 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
|
101 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
|
102 |
12559 | 103 let s:save_columns = 0 |
104 if exists('g:termdebug_wide') | |
105 if &columns < g:termdebug_wide | |
106 let s:save_columns = &columns | |
107 let &columns = g:termdebug_wide | |
108 endif | |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
109 let s:vertical = 1 |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
110 else |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
111 let s:vertical = 0 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
112 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
113 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
114 " Override using a terminal window by setting g:termdebug_use_prompt to 1. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
115 let use_prompt = exists('g:termdebug_use_prompt') && g:termdebug_use_prompt |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
116 if has('terminal') && !has('win32') && !use_prompt |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
117 let s:way = 'terminal' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
118 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
119 let s:way = 'prompt' |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
120 endif |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
121 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
122 if s:way == 'prompt' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
123 call s:StartDebug_prompt(a:dict) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
124 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
125 call s:StartDebug_term(a:dict) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
126 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
127 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
128 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
129 func s:StartDebug_term(dict) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
130 " Open a terminal window without a job, to run the debugged program in. |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
131 let s:ptybuf = term_start('NONE', { |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
132 \ 'term_name': 'debugged program', |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
133 \ 'vertical': s:vertical, |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
134 \ }) |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
135 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
|
136 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
|
137 return |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
138 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
139 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
|
140 let s:ptywin = win_getid(winnr()) |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
141 if s:vertical |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
142 " 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
|
143 " 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
|
144 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
|
145 endif |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
146 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
147 " 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
|
148 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
|
149 \ '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
|
150 \ '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
|
151 \ 'hidden': 1, |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
152 \ }) |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 return |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
157 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
158 let commpty = job_info(term_getjob(s:commbuf))['tty_out'] |
12254 | 159 |
160 " 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
|
161 " Add -quiet to avoid the intro message causing a hit-enter prompt. |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
162 let gdb_args = get(a:dict, 'gdb_args', []) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
163 let proc_args = get(a:dict, 'proc_args', []) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
164 |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
165 let cmd = [g:termdebugger, '-quiet', '-tty', pty] + gdb_args |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
166 call ch_log('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
|
167 let s:gdbbuf = term_start(cmd, { |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
168 \ 'exit_cb': function('s:EndTermDebug'), |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
169 \ 'term_finish': 'close', |
12254 | 170 \ }) |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 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
|
175 return |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
176 endif |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
177 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
|
178 |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
179 " Set arguments to be run |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
180 if len(proc_args) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
181 call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r") |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
182 endif |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
183 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
184 " 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
|
185 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
|
186 |
13450
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
187 " 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
|
188 " 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
|
189 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
|
190 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
|
191 let response = '' |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
192 for lnum in range(1,200) |
13450
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
193 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
|
194 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
|
195 if response =~ 'Undefined command' |
13564
a036c2cf4024
patch 8.0.1655: outdated gdb message in terminal debugger unclear
Christian Brabandt <cb@256bit.org>
parents:
13450
diff
changeset
|
196 echoerr 'Sorry, your gdb is too old, gdb 7.12 is required' |
13450
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
197 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
|
198 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
|
199 return |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
200 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
201 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
|
202 " Success! |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
203 break |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
204 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
205 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
206 endfor |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
207 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
|
208 break |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
209 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
210 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
|
211 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
|
212 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
|
213 break |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
214 endif |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
215 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
|
216 endwhile |
a7a88403ccb1
patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents:
13377
diff
changeset
|
217 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
218 " 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
|
219 " 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
|
220 " running. |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
221 call s:SendCommand('-gdb-set mi-async on') |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
222 " Older gdb uses a different command. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
223 call s:SendCommand('-gdb-set target-async on') |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
224 |
13564
a036c2cf4024
patch 8.0.1655: outdated gdb message in terminal debugger unclear
Christian Brabandt <cb@256bit.org>
parents:
13450
diff
changeset
|
225 " Disable pagination, it causes everything to stop at the gdb |
a036c2cf4024
patch 8.0.1655: outdated gdb message in terminal debugger unclear
Christian Brabandt <cb@256bit.org>
parents:
13450
diff
changeset
|
226 " "Type <return> to continue" prompt. |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
227 call s:SendCommand('set pagination off') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
228 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
229 call s:StartDebugCommon(a:dict) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
230 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
231 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
232 func s:StartDebug_prompt(dict) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
233 " Open a window with a prompt buffer to run gdb in. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
234 if s:vertical |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
235 vertical new |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
236 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
237 new |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
238 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
239 let s:gdbwin = win_getid(winnr()) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
240 let s:promptbuf = bufnr('') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
241 call prompt_setprompt(s:promptbuf, 'gdb> ') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
242 set buftype=prompt |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
243 file gdb |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
244 call prompt_setcallback(s:promptbuf, function('s:PromptCallback')) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
245 call prompt_setinterrupt(s:promptbuf, function('s:PromptInterrupt')) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
246 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
247 if s:vertical |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
248 " Assuming the source code window will get a signcolumn, use two more |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
249 " columns for that, thus one less for the terminal window. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
250 exe (&columns / 2 - 1) . "wincmd |" |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
251 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
252 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
253 " Add -quiet to avoid the intro message causing a hit-enter prompt. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
254 let gdb_args = get(a:dict, 'gdb_args', []) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
255 let proc_args = get(a:dict, 'proc_args', []) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
256 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
257 let cmd = [g:termdebugger, '-quiet', '--interpreter=mi2'] + gdb_args |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
258 call ch_log('executing "' . join(cmd) . '"') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
259 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
260 let s:gdbjob = job_start(cmd, { |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
261 \ 'exit_cb': function('s:EndPromptDebug'), |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
262 \ 'out_cb': function('s:GdbOutCallback'), |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
263 \ }) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
264 if job_status(s:gdbjob) != "run" |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
265 echoerr 'Failed to start gdb' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
266 exe 'bwipe! ' . s:promptbuf |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
267 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
268 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
269 let s:gdb_channel = job_getchannel(s:gdbjob) |
13564
a036c2cf4024
patch 8.0.1655: outdated gdb message in terminal debugger unclear
Christian Brabandt <cb@256bit.org>
parents:
13450
diff
changeset
|
270 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
271 " Interpret commands while the target is running. This should usualy only |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
272 " be exec-interrupt, since many commands don't work properly while the |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
273 " target is running. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
274 call s:SendCommand('-gdb-set mi-async on') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
275 " Older gdb uses a different command. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
276 call s:SendCommand('-gdb-set target-async on') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
277 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
278 let s:ptybuf = 0 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
279 if has('win32') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
280 " MS-Windows: run in a new console window for maximum compatibility |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
281 call s:SendCommand('set new-console on') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
282 elseif has('terminal') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
283 " Unix: Run the debugged program in a terminal window. Open it below the |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
284 " gdb window. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
285 belowright let s:ptybuf = term_start('NONE', { |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
286 \ 'term_name': 'debugged program', |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
287 \ }) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
288 if s:ptybuf == 0 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
289 echoerr 'Failed to open the program terminal window' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
290 call job_stop(s:gdbjob) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
291 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
292 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
293 let s:ptywin = win_getid(winnr()) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
294 let pty = job_info(term_getjob(s:ptybuf))['tty_out'] |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
295 call s:SendCommand('tty ' . pty) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
296 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
297 " Since GDB runs in a prompt window, the environment has not been set to |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
298 " match a terminal window, need to do that now. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
299 call s:SendCommand('set env TERM = xterm-color') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
300 call s:SendCommand('set env ROWS = ' . winheight(s:ptywin)) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
301 call s:SendCommand('set env LINES = ' . winheight(s:ptywin)) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
302 call s:SendCommand('set env COLUMNS = ' . winwidth(s:ptywin)) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
303 call s:SendCommand('set env COLORS = ' . &t_Co) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
304 call s:SendCommand('set env VIM_TERMINAL = ' . v:version) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
305 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
306 " TODO: open a new terminal get get the tty name, pass on to gdb |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
307 call s:SendCommand('show inferior-tty') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
308 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
309 call s:SendCommand('set print pretty on') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
310 call s:SendCommand('set breakpoint pending on') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
311 " Disable pagination, it causes everything to stop at the gdb |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
312 call s:SendCommand('set pagination off') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
313 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
314 " Set arguments to be run |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
315 if len(proc_args) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
316 call s:SendCommand('set args ' . join(proc_args)) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
317 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
318 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
319 call s:StartDebugCommon(a:dict) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
320 startinsert |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
321 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
322 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
323 func s:StartDebugCommon(dict) |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
324 " 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
|
325 " 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
|
326 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
|
327 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
328 " Install debugger commands in the text window. |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
329 call win_gotoid(s:sourcewin) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
330 call s:InstallCommands() |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
331 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
|
332 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
333 " 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
|
334 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
|
335 set balloonexpr=TermDebugBalloonExpr() |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
336 if has("balloon_eval") |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
337 set ballooneval |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
338 endif |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
339 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
|
340 set balloonevalterm |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
341 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
342 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
343 |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
344 " Contains breakpoints that have been placed, key is the number. |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
345 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
|
346 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
347 augroup TermDebug |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
348 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
|
349 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
|
350 augroup END |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
351 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
352 " Run the command if the bang attribute was given and got to the debug |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
353 " window. |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
354 if get(a:dict, 'bang', 0) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
355 call s:SendCommand('-exec-run') |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
356 call win_gotoid(s:ptywin) |
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
357 endif |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
358 endfunc |
13706
bfd9249f72e0
patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents:
13682
diff
changeset
|
359 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
360 " Send a command to gdb. "cmd" is the string without line terminator. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
361 func s:SendCommand(cmd) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
362 call ch_log('sending to gdb: ' . a:cmd) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
363 if s:way == 'prompt' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
364 call ch_sendraw(s:gdb_channel, a:cmd . "\n") |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
365 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
366 call term_sendkeys(s:commbuf, a:cmd . "\r") |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
367 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
368 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
369 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
370 " This is global so that a user can create their mappings with this. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
371 func TermDebugSendCommand(cmd) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
372 if s:way == 'prompt' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
373 call ch_sendraw(s:gdb_channel, a:cmd . "\n") |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
374 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
375 let do_continue = 0 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
376 if !s:stopped |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
377 let do_continue = 1 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
378 call s:SendCommand('-exec-interrupt') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
379 sleep 10m |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
380 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
381 call term_sendkeys(s:gdbbuf, a:cmd . "\r") |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
382 if do_continue |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
383 Continue |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
384 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
385 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
386 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
387 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
388 " Function called when entering a line in the prompt buffer. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
389 func s:PromptCallback(text) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
390 call s:SendCommand(a:text) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
391 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
392 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
393 " Function called when pressing CTRL-C in the prompt buffer. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
394 func s:PromptInterrupt() |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
395 call ch_log('Interrupting gdb') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
396 call job_stop(s:gdbjob, 'int') |
12254 | 397 endfunc |
398 | |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
399 " Function called when gdb outputs text. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
400 func s:GdbOutCallback(channel, text) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
401 call ch_log('received from gdb: ' . a:text) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
402 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
403 " Drop the gdb prompt, we have our own. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
404 " Drop status and echo'd commands. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
405 if a:text == '(gdb) ' || a:text == '^done' || a:text[0] == '&' || a:text[0] == '=' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
406 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
407 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
408 if a:text =~ '^^error,msg=' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
409 let text = s:DecodeMessage(a:text[11:]) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
410 if exists('s:evalexpr') && text =~ 'A syntax error in expression, near\|No symbol .* in current context' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
411 " Silently drop evaluation errors. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
412 unlet s:evalexpr |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
413 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
414 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
415 elseif a:text[0] == '~' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
416 let text = s:DecodeMessage(a:text[1:]) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
417 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
418 call s:CommOutput(a:channel, a:text) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
419 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
420 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
421 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
422 let curwinid = win_getid(winnr()) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
423 call win_gotoid(s:gdbwin) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
424 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
425 " Add the output above the current prompt. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
426 call append(line('$') - 1, text) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
427 set nomodified |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
428 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
429 call win_gotoid(curwinid) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
430 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
431 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
432 " Decode a message from gdb. quotedText starts with a ", return the text up |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
433 " to the next ", unescaping characters. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
434 func s:DecodeMessage(quotedText) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
435 if a:quotedText[0] != '"' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
436 echoerr 'DecodeMessage(): missing quote' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
437 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
438 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
439 let result = '' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
440 let i = 1 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
441 while a:quotedText[i] != '"' && i < len(a:quotedText) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
442 if a:quotedText[i] == '\' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
443 let i += 1 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
444 if a:quotedText[i] == 'n' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
445 " drop \n |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
446 let i += 1 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
447 continue |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
448 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
449 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
450 let result .= a:quotedText[i] |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
451 let i += 1 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
452 endwhile |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
453 return result |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
454 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
455 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
456 func s:EndTermDebug(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
|
457 exe 'bwipe! ' . s:commbuf |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
458 unlet s:gdbwin |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
459 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
460 call s:EndDebugCommon() |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
461 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
462 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
463 func s:EndDebugCommon() |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
464 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
|
465 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
466 if exists('s:ptybuf') && s:ptybuf |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
467 exe 'bwipe! ' . s:ptybuf |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
468 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
469 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
470 call win_gotoid(s:sourcewin) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
471 let &signcolumn = s:startsigncolumn |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
472 call s:DeleteCommands() |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
473 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
474 call win_gotoid(curwinid) |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
475 |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
476 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
|
477 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
|
478 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
479 |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
480 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
|
481 set balloonexpr= |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
482 if has("balloon_eval") |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
483 set noballooneval |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
484 endif |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
485 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
|
486 set noballoonevalterm |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
487 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
488 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
489 |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
490 au! TermDebug |
12254 | 491 endfunc |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
492 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
493 func s:EndPromptDebug(job, status) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
494 let curwinid = win_getid(winnr()) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
495 call win_gotoid(s:gdbwin) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
496 close |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
497 if curwinid != s:gdbwin |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
498 call win_gotoid(curwinid) |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
499 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
500 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
501 call s:EndDebugCommon() |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
502 unlet s:gdbwin |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
503 call ch_log("Returning from EndPromptDebug()") |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
504 endfunc |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
505 |
12395
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
506 " 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
|
507 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
|
508 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
|
509 |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
510 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
|
511 " 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
|
512 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
|
513 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
|
514 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
515 if msg != '' |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
516 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
|
517 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
|
518 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
|
519 call s:HandleNewBreakpoint(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
520 elseif msg =~ '^=breakpoint-deleted,' |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
521 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
|
522 elseif msg =~ '^\^done,value=' |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
523 call s:HandleEvaluate(msg) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
524 elseif msg =~ '^\^error,msg=' |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
525 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
|
526 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
527 endif |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
528 endfor |
39e1087e7094
patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents:
12254
diff
changeset
|
529 endfunc |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
530 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
531 " 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
|
532 func s:InstallCommands() |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 command Stop call s:SendCommand('-exec-interrupt') |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
541 |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
542 " using -exec-continue results in CTRL-C in gdb window not working |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
543 if s:way == 'prompt' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
544 command Continue call s:SendCommand('continue') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
545 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
546 command Continue call term_sendkeys(s:gdbbuf, "continue\r") |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
547 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
548 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
549 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
|
550 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
|
551 command Program call win_gotoid(s:ptywin) |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
552 command Source call s:GotoSourcewinOrCreateIt() |
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
|
553 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
|
554 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
555 " 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
|
556 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
|
557 |
13051 | 558 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
|
559 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
|
560 |
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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
569 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
570 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
571 |
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
|
572 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
|
573 |
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
|
574 " 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
|
575 func s:InstallWinbar() |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
576 if has('menu') && &mouse != '' |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
577 nnoremenu WinBar.Step :Step<CR> |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
578 nnoremenu WinBar.Next :Over<CR> |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
579 nnoremenu WinBar.Finish :Finish<CR> |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
580 nnoremenu WinBar.Cont :Continue<CR> |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
581 nnoremenu WinBar.Stop :Stop<CR> |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
582 nnoremenu WinBar.Eval :Evaluate<CR> |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
583 call add(s:winbar_winids, win_getid(winnr())) |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
584 endif |
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
|
585 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
|
586 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
587 " 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
|
588 func s:DeleteCommands() |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
589 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
|
590 delcommand Clear |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
591 delcommand Step |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
592 delcommand Over |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
593 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
|
594 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
|
595 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
|
596 delcommand Stop |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
597 delcommand Continue |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
598 delcommand Evaluate |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
599 delcommand Gdb |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
600 delcommand Program |
13682
fc660a6ef37d
patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents:
13592
diff
changeset
|
601 delcommand Source |
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
|
602 delcommand Winbar |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
603 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
604 nunmap K |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
605 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
606 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
|
607 " 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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 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
|
616 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
|
617 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
|
618 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
|
619 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
|
620 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
|
621 |
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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 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
|
627 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
|
628 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
|
629 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
630 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
631 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
632 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
|
633 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
|
634 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
|
635 endfor |
12455
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
636 sign undefine debugPC |
85ddf8e00595
patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents:
12425
diff
changeset
|
637 sign undefine debugBreakpoint |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
638 unlet s:breakpoints |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
639 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
640 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
641 " :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
|
642 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
|
643 " 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
|
644 " 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
|
645 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
|
646 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
|
647 let do_continue = 1 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
648 if s:way == 'prompt' |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
649 " Need to send a signal to get the UI to listen. Strangely this is only |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
650 " needed once. |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
651 call job_stop(s:gdbjob, 'int') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
652 else |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
653 call s:SendCommand('-exec-interrupt') |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
654 endif |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
655 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
|
656 endif |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
657 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
|
658 \ . 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
|
659 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
|
660 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
|
661 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
662 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
663 |
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
|
664 " :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
|
665 func s:ClearBreakpoint() |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
666 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
|
667 let lnum = line('.') |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
668 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
|
669 if val['fname'] == fname && val['lnum'] == lnum |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
670 call s:SendCommand('-break-delete ' . key) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
671 " 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
|
672 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
|
673 unlet s:breakpoints[key] |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
674 break |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
675 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
676 endfor |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
677 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
678 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
679 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
|
680 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
|
681 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
|
682 endif |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
683 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
|
684 endfunc |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
685 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
686 func s:SendEval(expr) |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
687 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
|
688 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
|
689 endfunc |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
690 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
691 " :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
|
692 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
|
693 if a:arg != '' |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
694 let expr = a:arg |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
695 elseif a:range == 2 |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
696 let pos = getcurpos() |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
697 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
|
698 let regt = getregtype('v') |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
699 normal! gv"vy |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
700 let expr = @v |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
701 call setpos('.', pos) |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
702 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
|
703 else |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
704 let expr = expand('<cexpr>') |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
705 endif |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
706 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
|
707 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
|
708 endfunc |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
709 |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
710 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
|
711 let s:evalFromBalloonExpr = 0 |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
712 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
713 " 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
|
714 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
|
715 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
|
716 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
|
717 if s:evalFromBalloonExpr |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
718 if s:evalFromBalloonExprResult == '' |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
719 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
|
720 else |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
721 let s:evalFromBalloonExprResult .= ' = ' . value |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
722 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
723 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
|
724 else |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
725 echomsg '"' . s:evalexpr . '": ' . value |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
726 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
727 |
12826 | 728 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
|
729 " Looks like a pointer, also display what it points to. |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
730 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
|
731 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
|
732 else |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
733 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
|
734 endif |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
735 endfunc |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
736 |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
737 " 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
|
738 " if there is any. |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
739 func TermDebugBalloonExpr() |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
740 if v:beval_winid != s:sourcewin |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
741 return |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
742 endif |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
743 if !s:stopped |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
744 " Only evaluate when stopped, otherwise setting a breakpoint using the |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
745 " mouse triggers a balloon. |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
746 return |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
747 endif |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
748 let s:evalFromBalloonExpr = 1 |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
749 let s:evalFromBalloonExprResult = '' |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
750 let s:ignoreEvalError = 1 |
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
751 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
|
752 return '' |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
753 endfunc |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
754 |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
755 " Handle an error. |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
756 func s:HandleError(msg) |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
757 if s:ignoreEvalError |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
758 " Result of s:SendEval() failed, ignore. |
13341
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
759 let s:ignoreEvalError = 0 |
acd7eaa13d2b
Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents:
13051
diff
changeset
|
760 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
|
761 return |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12833
diff
changeset
|
762 endif |
12425
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
763 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
|
764 endfunc |
29d21591ad6b
patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents:
12411
diff
changeset
|
765 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
766 func s:GotoSourcewinOrCreateIt() |
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
767 if !win_gotoid(s:sourcewin) |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
768 new |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
769 let s:sourcewin = win_getid(winnr()) |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
770 call s:InstallWinbar() |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
771 endif |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
772 endfunc |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
773 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
774 " 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
|
775 " 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
|
776 func s:HandleCursor(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
777 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
|
778 |
12833
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
779 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
|
780 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
|
781 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
|
782 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
|
783 endif |
db9ffed7e1fc
patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
12826
diff
changeset
|
784 |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
785 call s:GotoSourcewinOrCreateIt() |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
786 |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
787 let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '') |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
788 if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname) |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
789 let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '') |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
790 if lnum =~ '^[0-9]*$' |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
791 if expand('%:p') != fnamemodify(fname, ':p') |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
792 if &modified |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
793 " TODO: find existing window |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
794 exe 'split ' . fnameescape(fname) |
14107
274c9f1fbfd2
patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents:
13706
diff
changeset
|
795 let s:sourcewin = win_getid(winnr()) |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
796 call s:InstallWinbar() |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
797 else |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
798 exe 'edit ' . fnameescape(fname) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
799 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
800 endif |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
801 exe lnum |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
802 exe 'sign unplace ' . s:pc_id |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
803 exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
804 setlocal signcolumn=yes |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
805 endif |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
806 else |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
807 exe 'sign unplace ' . s:pc_id |
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
808 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
809 |
13592
a64485061f75
patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents:
13564
diff
changeset
|
810 call win_gotoid(wid) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
811 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
812 |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
813 func s:CreateBreakpoint(nr) |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
814 if !exists("s:BreakpointSigns") |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
815 let s:BreakpointSigns = [] |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
816 endif |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
817 if index(s:BreakpointSigns, a:nr) == -1 |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
818 call add(s:BreakpointSigns, a:nr) |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
819 exe "sign define debugBreakpoint". a:nr . " text=" . a:nr . " texthl=debugBreakpoint" |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
820 endif |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
821 endfunc |
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
822 |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
823 " Handle setting a breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
824 " 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
|
825 func s:HandleNewBreakpoint(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
826 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
|
827 if nr == 0 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
828 return |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
829 endif |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
830 call s:CreateBreakpoint(nr) |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
831 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
832 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
|
833 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
|
834 else |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
835 let entry = {} |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
836 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
|
837 endif |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
838 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
839 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
|
840 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
|
841 let entry['fname'] = fname |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
842 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
|
843 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
844 if bufloaded(fname) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
845 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
|
846 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
847 endfunc |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
848 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
849 func s:PlaceSign(nr, entry) |
14126
1ce45478cbf1
patch 8.1.0080: can't see the breakpoint number in the terminal debugger
Christian Brabandt <cb@256bit.org>
parents:
14107
diff
changeset
|
850 exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . a:nr . ' file=' . a:entry['fname'] |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
851 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
|
852 endfunc |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
853 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
854 " Handle deleting a breakpoint |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
855 " 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
|
856 func s:HandleBreakpointDelete(msg) |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
857 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
|
858 if nr == 0 |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
859 return |
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
860 endif |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
861 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
|
862 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
|
863 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
|
864 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
|
865 unlet entry['placed'] |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
866 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
867 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
|
868 endif |
12411
5d4d744151c2
patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents:
12395
diff
changeset
|
869 endfunc |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
870 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
871 " 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
|
872 func s:BufRead() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
873 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
|
874 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
|
875 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
|
876 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
|
877 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
878 endfor |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
879 endfunc |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
880 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
881 " 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
|
882 func s:BufUnloaded() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
883 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
|
884 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
|
885 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
|
886 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
|
887 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
888 endfor |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
889 endfunc |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12455
diff
changeset
|
890 |