annotate runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @ 28517:f73a9bdff3a3

Update runtime files Commit: https://github.com/vim/vim/commit/75ab590f8504a8912ca0b8c58f6b897bb7a34f07 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 18 15:36:40 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Mon, 18 Apr 2022 16:45:03 +0200
parents dce918af0c00
children b96ceb97e896
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
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"
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
5 " Last Change: 2022 Apr 16
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
6 "
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
7 " WORK IN PROGRESS - The basics works stable, more to come
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
8 " Note: In general you need at least GDB 7.12 because this provides the
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
9 " frame= response in MI thread-selected events we need to sync stack to file.
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
10 " The one included with "old" MingW is too old (7.6.1), you may upgrade it or
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
11 " use a newer version from http://www.equation.com/servlet/equation.cmd?fa=gdb
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
12 "
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
13 " 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
14 " - 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
15 " 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
16 " - Using a "prompt" buffer; may use a terminal window for the program
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 "
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
18 " 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
19 " 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
20 "
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
21 " 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
22 "
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
23 " 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
24 " 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
25 " 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
26 " 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
27 "
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
28 " 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
29 "
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
30 " 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
31 " 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
32 " 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
33 " 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
34 "
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
35 " 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
36 " https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
38 " In case this gets sourced twice.
12499
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
39 if exists(':Termdebug')
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
40 finish
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
41 endif
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12487
diff changeset
42
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
43 " 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
44 " 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
45 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
46 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
47 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
48 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
49 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
50 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
51 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
52 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
53 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
54 endif
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 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
56 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
57 finish
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
58 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
59
14356
9339e4dbf6bf patch 8.1.0193: terminal debugger buttons don't always work
Christian Brabandt <cb@256bit.org>
parents: 14165
diff changeset
60 let s:keepcpo = &cpo
9339e4dbf6bf patch 8.1.0193: terminal debugger buttons don't always work
Christian Brabandt <cb@256bit.org>
parents: 14165
diff changeset
61 set cpo&vim
9339e4dbf6bf patch 8.1.0193: terminal debugger buttons don't always work
Christian Brabandt <cb@256bit.org>
parents: 14165
diff changeset
62
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
63 " 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
64 " 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
65 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
66 command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(<bang>0, <f-args>)
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
68 " Name of the gdb command, defaults to "gdb".
18217
40344f717010 patch 8.1.2103: wrong error message if "termdebugger" is not executable
Bram Moolenaar <Bram@vim.org>
parents: 18130
diff changeset
69 if !exists('g:termdebugger')
40344f717010 patch 8.1.2103: wrong error message if "termdebugger" is not executable
Bram Moolenaar <Bram@vim.org>
parents: 18130
diff changeset
70 let g:termdebugger = 'gdb'
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 endif
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
73 let s:pc_id = 12
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
74 let s:asm_id = 13
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
75 let s:break_id = 14 " 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
76 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
77
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
78 let s:parsing_disasm_msg = 0
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
79 let s:asm_lines = []
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
80 let s:asm_addr = ''
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
81
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
82 " Take a breakpoint number as used by GDB and turn it into an integer.
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
83 " The breakpoint may contain a dot: 123.4 -> 123004
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
84 " The main breakpoint has a zero subid.
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
85 func s:Breakpoint2SignNumber(id, subid)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
86 return s:break_id + a:id * 1000 + a:subid
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
87 endfunction
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
88
14127
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
89 func s:Highlight(init, old, new)
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
90 let default = a:init ? 'default ' : ''
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
91 if a:new ==# 'light' && a:old !=# 'light'
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
92 exe "hi " . default . "debugPC term=reverse ctermbg=lightblue guibg=lightblue"
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
93 elseif a:new ==# 'dark' && a:old !=# 'dark'
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
94 exe "hi " . default . "debugPC term=reverse ctermbg=darkblue guibg=darkblue"
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
95 endif
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
96 endfunc
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
97
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
98 call s:Highlight(1, '', &background)
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
99 hi default debugBreakpoint term=reverse ctermbg=red guibg=red
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
100 hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
101
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
102 func s:GetCommand()
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
103 return type(g:termdebugger) == v:t_list ? copy(g:termdebugger) : [g:termdebugger]
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
104 endfunc
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
105
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
106 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
107 " 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
108 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
109 endfunc
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
110
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
111 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
112 " 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
113 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
114 endfunc
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
115
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
116 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
117 if exists('s:gdbwin')
18217
40344f717010 patch 8.1.2103: wrong error message if "termdebugger" is not executable
Bram Moolenaar <Bram@vim.org>
parents: 18130
diff changeset
118 echoerr 'Terminal debugger already running, cannot run two'
13682
fc660a6ef37d patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents: 13592
diff changeset
119 return
fc660a6ef37d patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents: 13592
diff changeset
120 endif
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
121 let gdbcmd = s:GetCommand()
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
122 if !executable(gdbcmd[0])
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
123 echoerr 'Cannot execute debugger program "' .. gdbcmd[0] .. '"'
18217
40344f717010 patch 8.1.2103: wrong error message if "termdebugger" is not executable
Bram Moolenaar <Bram@vim.org>
parents: 18130
diff changeset
124 return
40344f717010 patch 8.1.2103: wrong error message if "termdebugger" is not executable
Bram Moolenaar <Bram@vim.org>
parents: 18130
diff changeset
125 endif
40344f717010 patch 8.1.2103: wrong error message if "termdebugger" is not executable
Bram Moolenaar <Bram@vim.org>
parents: 18130
diff changeset
126
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
127 let s:ptywin = 0
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
128 let s:pid = 0
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
129 let s:asmwin = 0
13682
fc660a6ef37d patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents: 13592
diff changeset
130
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
131 if exists('#User#TermdebugStartPre')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
132 doauto <nomodeline> User TermdebugStartPre
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
133 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
134
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
135 " 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
136 " 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
137
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
138 let s:sourcewin = win_getid(winnr())
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
139
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
140 " Remember the old value of 'signcolumn' for each buffer that it's set in, so
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
141 " that we can restore the value for all buffers.
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
142 let b:save_signcolumn = &signcolumn
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
143 let s:signcolumn_buflist = [bufnr()]
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
144
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12499
diff changeset
145 let s:save_columns = 0
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
146 let s:allleft = 0
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12499
diff changeset
147 if exists('g:termdebug_wide')
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12499
diff changeset
148 if &columns < g:termdebug_wide
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12499
diff changeset
149 let s:save_columns = &columns
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12499
diff changeset
150 let &columns = g:termdebug_wide
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
151 " If we make the Vim window wider, use the whole left half for the debug
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
152 " windows.
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
153 let s:allleft = 1
12559
34c8ec888122 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12499
diff changeset
154 endif
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
155 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
156 else
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
157 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
158 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
159
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
160 " 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
161 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
162 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
163 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
164 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
165 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
166 endif
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
167
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
168 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
169 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
170 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
171 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
172 endif
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
173
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
174 if exists('g:termdebug_disasm_window')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
175 if g:termdebug_disasm_window
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
176 let curwinid = win_getid(winnr())
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
177 call s:GotoAsmwinOrCreateIt()
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
178 call win_gotoid(curwinid)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
179 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
180 endif
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
181
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
182 if exists('#User#TermdebugStartPost')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
183 doauto <nomodeline> User TermdebugStartPost
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
184 endif
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
185 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
186
15223
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
187 " Use when debugger didn't start or ended.
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
188 func s:CloseBuffers()
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
189 exe 'bwipe! ' . s:ptybuf
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
190 exe 'bwipe! ' . s:commbuf
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
191 unlet! s:gdbwin
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
192 endfunc
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
193
24751
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
194 func s:CheckGdbRunning()
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
195 let gdbproc = term_getjob(s:gdbbuf)
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
196 if gdbproc == v:null || job_status(gdbproc) !=# 'run'
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
197 echoerr string(s:GetCommand()[0]) . ' exited unexpectedly'
24751
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
198 call s:CloseBuffers()
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
199 return ''
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
200 endif
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
201 return 'ok'
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
202 endfunc
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
203
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
204 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
205 " 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
206 let s:ptybuf = term_start('NONE', {
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
207 \ 'term_name': 'debugged program',
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
208 \ 'vertical': s:vertical,
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
209 \ })
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
210 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
211 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
212 return
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
213 endif
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
214 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
215 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
216 if s:vertical
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
217 " 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
218 " 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
219 exe (&columns / 2 - 1) . "wincmd |"
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
220 if s:allleft
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
221 " use the whole left column
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
222 wincmd H
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 15223
diff changeset
223 endif
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
224 endif
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
225
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
226 " 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
227 let s:commbuf = term_start('NONE', {
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
228 \ 'term_name': 'gdb communication',
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
229 \ 'out_cb': function('s:CommOutput'),
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
230 \ 'hidden': 1,
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
231 \ })
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
232 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
233 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
234 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
235 return
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
236 endif
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
237 let commpty = job_info(term_getjob(s:commbuf))['tty_out']
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
239 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
240 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
241
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
242 let gdb_cmd = s:GetCommand()
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
243 " Add -quiet to avoid the intro message causing a hit-enter prompt.
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
244 let gdb_cmd += ['-quiet']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
245 " Disable pagination, it causes everything to stop at the gdb
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
246 let gdb_cmd += ['-iex', 'set pagination off']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
247 " Interpret commands while the target is running. This should usually only
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
248 " be exec-interrupt, since many commands don't work properly while the
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
249 " target is running (so execute during startup).
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
250 let gdb_cmd += ['-iex', 'set mi-async on']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
251 " Open a terminal window to run the debugger.
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
252 let gdb_cmd += ['-tty', pty]
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
253 " Command executed _after_ startup is done, provides us with the necessary feedback
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
254 let gdb_cmd += ['-ex', 'echo startupdone\n']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
255
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
256 " Adding arguments requested by the user
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
257 let gdb_cmd += gdb_args
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
258
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
259 call ch_log('executing "' . join(gdb_cmd) . '"')
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
260 let s:gdbbuf = term_start(gdb_cmd, {
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
261 \ 'term_finish': 'close',
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
262 \ })
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
263 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
264 echoerr 'Failed to open the gdb terminal window'
15223
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
265 call s:CloseBuffers()
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
266 return
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
267 endif
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
268 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
269
24751
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
270 " Wait for the "startupdone" message before sending any commands.
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
271 let try_count = 0
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
272 while 1
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
273 if s:CheckGdbRunning() != 'ok'
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
274 return
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
275 endif
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
276
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
277 for lnum in range(1, 200)
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
278 if term_getline(s:gdbbuf, lnum) =~ 'startupdone'
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
279 let try_count = 9999
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
280 break
24751
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
281 endif
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
282 endfor
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
283 let try_count += 1
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
284 if try_count > 300
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
285 " done or give up after five seconds
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
286 break
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
287 endif
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
288 sleep 10m
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
289 endwhile
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
290
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
291 " Set arguments to be run.
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
292 if len(proc_args)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
293 call term_sendkeys(s:gdbbuf, 'server set args ' . join(proc_args) . "\r")
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
294 endif
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
295
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
296 " Connect gdb to the communication pty, using the GDB/MI interface.
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
297 " Prefix "server" to avoid adding this to the history.
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
298 call term_sendkeys(s:gdbbuf, 'server new-ui mi ' . commpty . "\r")
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
299
13450
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
300 " 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
301 " 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
302 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
303 while 1
24751
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
304 if s:CheckGdbRunning() != 'ok'
15223
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
305 return
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
306 endif
0e7615548cef patch 8.1.0621: terminal debugger does not handle unexpected debugger exit
Bram Moolenaar <Bram@vim.org>
parents: 15129
diff changeset
307
13450
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
308 let response = ''
17962
58bebe21f0ef patch 8.1.1977: terminal debugger plugin may hang
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
309 for lnum in range(1, 200)
58bebe21f0ef patch 8.1.1977: terminal debugger plugin may hang
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
310 let line1 = term_getline(s:gdbbuf, lnum)
58bebe21f0ef patch 8.1.1977: terminal debugger plugin may hang
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
311 let line2 = term_getline(s:gdbbuf, lnum + 1)
58bebe21f0ef patch 8.1.1977: terminal debugger plugin may hang
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
312 if line1 =~ 'new-ui mi '
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
313 " response can be in the same line or the next line
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
314 let response = line1 . line2
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
315 if response =~ 'Undefined command'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
316 echoerr 'Sorry, your gdb is too old, gdb 7.12 is required'
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
317 " CHECKME: possibly send a "server show version" here
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
318 call s:CloseBuffers()
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
319 return
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
320 endif
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
321 if response =~ 'New UI allocated'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
322 " Success!
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
323 break
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
324 endif
17962
58bebe21f0ef patch 8.1.1977: terminal debugger plugin may hang
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
325 elseif line1 =~ 'Reading symbols from' && line2 !~ 'new-ui mi '
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
326 " Reading symbols might take a while, try more times
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
327 let try_count -= 1
13450
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
328 endif
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
329 endfor
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
330 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
331 break
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
332 endif
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
333 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
334 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
335 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
336 break
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
337 endif
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
338 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
339 endwhile
a7a88403ccb1 patch 8.0.1599: no error message when gdb does not support debugger
Christian Brabandt <cb@256bit.org>
parents: 13377
diff changeset
340
24751
e69e7133c9cf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
341 call job_setoptions(term_getjob(s:gdbbuf), {'exit_cb': function('s:EndTermDebug')})
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
342
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
343 " Set the filetype, this can be used to add mappings.
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
344 set filetype=termdebug
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
345
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
346 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
347 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
348
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
349 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
350 " 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
351 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
352 vertical new
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
353 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
354 new
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
355 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
356 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
357 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
358 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
359 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
360 file gdb
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
361 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
362 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
363
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
364 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
365 " 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
366 " 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
367 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
368 endif
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 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
371 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
372
26708
f0d7cb510ce3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
373 let gdb_cmd = s:GetCommand()
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
374 " Add -quiet to avoid the intro message causing a hit-enter prompt.
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
375 let gdb_cmd += ['-quiet']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
376 " Disable pagination, it causes everything to stop at the gdb, needs to be run early
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
377 let gdb_cmd += ['-iex', 'set pagination off']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
378 " Interpret commands while the target is running. This should usually only
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
379 " be exec-interrupt, since many commands don't work properly while the
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
380 " target is running (so execute during startup).
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
381 let gdb_cmd += ['-iex', 'set mi-async on']
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
382 " directly communicate via mi2
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
383 let gdb_cmd += ['--interpreter=mi2']
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
384
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
385 " Adding arguments requested by the user
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
386 let gdb_cmd += gdb_args
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
387
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
388 call ch_log('executing "' . join(gdb_cmd) . '"')
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
389 let s:gdbjob = job_start(gdb_cmd, {
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
390 \ 'exit_cb': function('s:EndPromptDebug'),
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
391 \ 'out_cb': function('s:GdbOutCallback'),
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
392 \ })
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
393 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
394 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
395 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
396 return
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
397 endif
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
398 " Mark the buffer modified so that it's not easy to close.
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
399 set modified
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
400 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
401
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
402 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
403 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
404 " 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
405 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
406 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
407 " 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
408 " gdb window.
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
409 belowright let s:ptybuf = term_start('NONE', {
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
410 \ 'term_name': 'debugged program',
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
411 \ })
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
412 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
413 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
414 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
415 return
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
416 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
417 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
418 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
419 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
420
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
421 " 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
422 " 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
423 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
424 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
425 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
426 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
427 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
428 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
429 else
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
430 " TODO: open a new terminal, get the tty name, pass on to gdb
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
431 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
432 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
433 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
434 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
435
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
436 " 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
437 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
438 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
439 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
440
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
441 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
442 startinsert
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
443 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
444
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
445 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
446 " 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
447 " There can be only one.
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
448 call sign_define('debugPC', #{linehl: 'debugPC'})
12455
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
449
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
450 " 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
451 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
452 call s:InstallCommands()
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
453 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
454
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
455 " 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
456 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
457 set balloonexpr=TermDebugBalloonExpr()
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
458 if has("balloon_eval")
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
459 set ballooneval
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
460 endif
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
461 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
462 set balloonevalterm
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
463 endif
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
464 endif
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
465
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
466 " Contains breakpoints that have been placed, key is a string with the GDB
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
467 " breakpoint number.
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
468 " Each entry is a dict, containing the sub-breakpoints. Key is the subid.
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
469 " For a breakpoint that is just a number the subid is zero.
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
470 " For a breakpoint "123.4" the id is "123" and subid is "4".
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
471 " Example, when breakpoint "44", "123", "123.1" and "123.2" exist:
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
472 " {'44': {'0': entry}, '123': {'0': entry, '1': entry, '2': entry}}
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
473 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
474
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
475 " Contains breakpoints by file/lnum. The key is "fname:lnum".
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
476 " Each entry is a list of breakpoint IDs at that position.
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
477 let s:breakpoint_locations = {}
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
478
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
479 augroup TermDebug
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
480 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
481 au BufUnload * call s:BufUnloaded()
14127
d2b14df7e439 patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Christian Brabandt <cb@256bit.org>
parents: 14126
diff changeset
482 au OptionSet background call s:Highlight(0, v:option_old, v:option_new)
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
483 augroup END
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
484
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
485 " 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
486 " window.
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
487 if get(a:dict, 'bang', 0)
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
488 call s:SendResumingCommand('-exec-run')
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
diff changeset
489 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
490 endif
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
491 endfunc
13706
bfd9249f72e0 patch 8.0.1725: terminal debugger doesn't handle command arguments
Christian Brabandt <cb@256bit.org>
parents: 13682
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 " 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
494 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
495 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
496 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
497 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
498 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
499 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
500 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
501 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
502
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
503 " 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
504 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
505 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
506 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
507 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
508 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
509 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
510 let do_continue = 1
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
511 Stop
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
512 sleep 10m
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
513 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
514 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
515 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
516 Continue
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
517 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
518 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
519 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
520
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
521 " Send a command that resumes the program. If the program isn't stopped the
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
522 " command is not sent (to avoid a repeated command to cause trouble).
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
523 " If the command is sent then reset s:stopped.
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
524 func s:SendResumingCommand(cmd)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
525 if s:stopped
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
526 " reset s:stopped here, it may take a bit of time before we get a response
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
527 let s:stopped = 0
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
528 call ch_log('assume that program is running after this command')
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
529 call s:SendCommand(a:cmd)
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
530 else
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
531 call ch_log('dropping command, program is running: ' . a:cmd)
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
532 endif
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
533 endfunc
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
534
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
535 " 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
536 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
537 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
538 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
539
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
540 " Function called when pressing CTRL-C in the prompt buffer and when placing a
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
541 " breakpoint.
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
542 func s:PromptInterrupt()
14151
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
543 call ch_log('Interrupting gdb')
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
544 if has('win32')
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
545 " Using job_stop() does not work on MS-Windows, need to send SIGTRAP to
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
546 " the debugger program so that gdb responds again.
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
547 if s:pid == 0
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
548 echoerr 'Cannot interrupt gdb, did not find a process ID'
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
549 else
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
550 call debugbreak(s:pid)
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
551 endif
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
552 else
14151
2404459a8639 patch 8.1.0093: non-MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14147
diff changeset
553 call job_stop(s:gdbjob, 'int')
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
554 endif
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 endfunc
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
557 " 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
558 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
559 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
560
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
561 " 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
562 " Drop status and echo'd commands.
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
563 if a:text == '(gdb) ' || a:text == '^done' || a:text[0] == '&'
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
564 return
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
565 endif
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
566 if a:text =~ '^\^error,msg='
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
567 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
568 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
569 " 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
570 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
571 return
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
572 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
573 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
574 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
575 else
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
576 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
577 return
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
578 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
579
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
580 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
581 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
582
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
583 " 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
584 call append(line('$') - 1, text)
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
585 set modified
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
586
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
587 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
588 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
589
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
590 " Decode a message from gdb. quotedText starts with a ", return the text up
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
591 " to the next ", unescaping characters:
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
592 " - remove line breaks
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
593 " - change \\t to \t
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
594 " - change \0xhh to \xhh (disabled for now)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
595 " - change \ooo to octal
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
596 " - change \\ to \
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
597 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
598 if a:quotedText[0] != '"'
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
599 echoerr 'DecodeMessage(): missing quote in ' . a:quotedText
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
600 return
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
601 endif
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
602 return a:quotedText
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
603 \ ->substitute('^"\|".*\|\\n', '', 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
604 \ ->substitute('\\t', "\t", 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
605 " multi-byte characters arrive in octal form
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
606 " NULL-values must be kept encoded as those break the string otherwise
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
607 \ ->substitute('\\000', s:NullRepl, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
608 \ ->substitute('\\\o\o\o', {-> eval('"' .. submatch(0) .. '"')}, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
609 " Note: GDB docs also mention hex encodings - the translations below work
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
610 " but we keep them out for performance-reasons until we actually see
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
611 " those in mi-returns
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
612 " \ ->substitute('\\0x\(\x\x\)', {-> eval('"\x' .. submatch(1) .. '"')}, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
613 " \ ->substitute('\\0x00', s:NullRepl, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
614 \ ->substitute('\\\\', '\', 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
615 \ ->substitute(s:NullRepl, '\\000', 'g')
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
616 endfunc
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
617 const s:NullRepl = 'XXXNULLXXX'
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
618
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
619 " Extract the "name" value from a gdb message with fullname="name".
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
620 func s:GetFullname(msg)
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
621 if a:msg !~ 'fullname'
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
622 return ''
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
623 endif
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
624 let name = s:DecodeMessage(substitute(a:msg, '.*fullname=', '', ''))
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
625 if has('win32') && name =~ ':\\\\'
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
626 " sometimes the name arrives double-escaped
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
627 let name = substitute(name, '\\\\', '\\', 'g')
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
628 endif
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
629 return name
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
630 endfunc
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
631
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
632 " Extract the "addr" value from a gdb message with addr="0x0001234".
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
633 func s:GetAsmAddr(msg)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
634 if a:msg !~ 'addr='
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
635 return ''
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
636 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
637 let addr = s:DecodeMessage(substitute(a:msg, '.*addr=', '', ''))
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
638 return addr
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
639 endfunc
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
640
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
641 func s:EndTermDebug(job, status)
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
642 if exists('#User#TermdebugStopPre')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
643 doauto <nomodeline> User TermdebugStopPre
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
644 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
645
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
646 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
647 unlet s:gdbwin
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
648
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
649 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
650 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
651
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
652 func s:EndDebugCommon()
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
653 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
654
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
655 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
656 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
657 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
658
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
659 " Restore 'signcolumn' in all buffers for which it was set.
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
660 call win_gotoid(s:sourcewin)
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
661 let was_buf = bufnr()
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
662 for bufnr in s:signcolumn_buflist
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
663 if bufexists(bufnr)
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
664 exe bufnr .. "buf"
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
665 if exists('b:save_signcolumn')
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
666 let &signcolumn = b:save_signcolumn
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
667 unlet b:save_signcolumn
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
668 endif
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
669 endif
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
670 endfor
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
671 if bufexists(was_buf)
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
672 exe was_buf .. "buf"
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
673 endif
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
674
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
675 call s:DeleteCommands()
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
676
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
677 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
678
12455
85ddf8e00595 patch 8.0.1107: terminal debugger jumps to non-existing file
Christian Brabandt <cb@256bit.org>
parents: 12425
diff changeset
679 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
680 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
681 endif
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
682
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
683 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
684 set balloonexpr=
12883
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
685 if has("balloon_eval")
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
686 set noballooneval
058e93aee621 patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents: 12865
diff changeset
687 endif
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
688 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
689 set noballoonevalterm
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
690 endif
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
691 endif
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
692
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
693 if exists('#User#TermdebugStopPost')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
694 doauto <nomodeline> User TermdebugStopPost
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
695 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
696
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
697 au! TermDebug
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
698 endfunc
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
699
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
700 func s:EndPromptDebug(job, status)
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
701 if exists('#User#TermdebugStopPre')
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
702 doauto <nomodeline> User TermdebugStopPre
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
703 endif
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24751
diff changeset
704
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
705 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
706 call win_gotoid(s:gdbwin)
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
707 set nomodified
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
708 close
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
709 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
710 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
711 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
712
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
713 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
714 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
715 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
716 endfunc
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
717
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
718 " Disassembly window - added by Michael Sartain
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
719 "
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
720 " - CommOutput: disassemble $pc
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
721 " - CommOutput: &"disassemble $pc\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
722 " - CommOutput: ~"Dump of assembler code for function main(int, char**):\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
723 " - CommOutput: ~" 0x0000555556466f69 <+0>:\tpush rbp\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
724 " ...
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
725 " - CommOutput: ~" 0x0000555556467cd0:\tpop rbp\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
726 " - CommOutput: ~" 0x0000555556467cd1:\tret \n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
727 " - CommOutput: ~"End of assembler dump.\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
728 " - CommOutput: ^done
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
729
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
730 " - CommOutput: disassemble $pc
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
731 " - CommOutput: &"disassemble $pc\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
732 " - CommOutput: &"No function contains specified address.\n"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
733 " - CommOutput: ^error,msg="No function contains specified address."
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
734 func s:HandleDisasmMsg(msg)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
735 if a:msg =~ '^\^done'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
736 let curwinid = win_getid(winnr())
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
737 if win_gotoid(s:asmwin)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
738 silent normal! gg0"_dG
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
739 call setline(1, s:asm_lines)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
740 set nomodified
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
741 set filetype=asm
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
742
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
743 let lnum = search('^' . s:asm_addr)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
744 if lnum != 0
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
745 call sign_unplace('TermDebug', #{id: s:asm_id})
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
746 call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
747 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
748
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
749 call win_gotoid(curwinid)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
750 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
751
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
752 let s:parsing_disasm_msg = 0
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
753 let s:asm_lines = []
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
754 elseif a:msg =~ '^\^error,msg='
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
755 if s:parsing_disasm_msg == 1
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
756 " Disassemble call ran into an error. This can happen when gdb can't
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
757 " find the function frame address, so let's try to disassemble starting
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
758 " at current PC
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
759 call s:SendCommand('disassemble $pc,+100')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
760 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
761 let s:parsing_disasm_msg = 0
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
762 elseif a:msg =~ '\&\"disassemble \$pc'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
763 if a:msg =~ '+100'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
764 " This is our second disasm attempt
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
765 let s:parsing_disasm_msg = 2
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
766 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
767 else
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
768 let value = substitute(a:msg, '^\~\"[ ]*', '', '')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
769 let value = substitute(value, '^=>[ ]*', '', '')
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
770 let value = substitute(value, '\\n\"\r$', '', '')
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
771 let value = substitute(value, '\\n\"$', '', '')
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
772 let value = substitute(value, '\r', '', '')
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
773 let value = substitute(value, '\\t', ' ', 'g')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
774
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
775 if value != '' || !empty(s:asm_lines)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
776 call add(s:asm_lines, value)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
777 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
778 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
779 endfunc
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
780
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
781 " 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
782 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
783 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
784
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
785 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
786 " 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
787 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
788 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
789 endif
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
790
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
791 if s:parsing_disasm_msg
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
792 call s:HandleDisasmMsg(msg)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
793 elseif msg != ''
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
794 if msg =~ '^\(\*stopped\|\*running\|=thread-selected\)'
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
795 call s:HandleCursor(msg)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
796 elseif msg =~ '^\^done,bkpt=' || msg =~ '^=breakpoint-created,'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
797 call s:HandleNewBreakpoint(msg, 0)
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
798 elseif msg =~ '^=breakpoint-modified,'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
799 call s:HandleNewBreakpoint(msg, 1)
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
800 elseif msg =~ '^=breakpoint-deleted,'
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
801 call s:HandleBreakpointDelete(msg)
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
802 elseif msg =~ '^=thread-group-started'
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
803 call s:HandleProgramRun(msg)
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
804 elseif msg =~ '^\^done,value='
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
805 call s:HandleEvaluate(msg)
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
806 elseif msg =~ '^\^error,msg='
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
807 call s:HandleError(msg)
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
808 elseif msg =~ '^disassemble'
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
809 let s:parsing_disasm_msg = 1
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
810 let s:asm_lines = []
12395
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
811 endif
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
812 endif
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
813 endfor
39e1087e7094 patch 8.0.1077: no debugger making use of the terminal window
Christian Brabandt <cb@256bit.org>
parents: 12254
diff changeset
814 endfunc
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
815
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
816 func s:GotoProgram()
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
817 if has('win32')
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
818 if executable('powershell')
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
819 call system(printf('powershell -Command "add-type -AssemblyName microsoft.VisualBasic;[Microsoft.VisualBasic.Interaction]::AppActivate(%d);"', s:pid))
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
820 endif
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
821 else
18878
ef90e5bbb971 Minor runtime file updates.
Bram Moolenaar <Bram@vim.org>
parents: 18750
diff changeset
822 call win_gotoid(s:ptywin)
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
823 endif
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
824 endfunc
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
825
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
826 " 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
827 func s:InstallCommands()
14360
e91659ae6614 patch 8.1.0195: terminal debugger commands don't always work
Christian Brabandt <cb@256bit.org>
parents: 14356
diff changeset
828 let save_cpo = &cpo
e91659ae6614 patch 8.1.0195: terminal debugger commands don't always work
Christian Brabandt <cb@256bit.org>
parents: 14356
diff changeset
829 set cpo&vim
e91659ae6614 patch 8.1.0195: terminal debugger commands don't always work
Christian Brabandt <cb@256bit.org>
parents: 14356
diff changeset
830
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
831 command -nargs=? Break call s:SetBreakpoint(<q-args>)
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
832 command Clear call s:ClearBreakpoint()
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
833 command Step call s:SendResumingCommand('-exec-step')
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
834 command Over call s:SendResumingCommand('-exec-next')
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
835 command -nargs=? Until call s:Until(<q-args>)
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
836 command Finish call s:SendResumingCommand('-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
837 command -nargs=* Run call s:Run(<q-args>)
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
838 command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . <q-args>)
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
839
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
840 if s:way == 'prompt'
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
841 command Stop call s:PromptInterrupt()
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
842 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
843 else
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
844 command Stop call s:SendCommand('-exec-interrupt')
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
845 " using -exec-continue results in CTRL-C in the gdb window not working,
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
846 " communicating via commbuf (= use of SendCommand) has the same result
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
847 "command Continue call s:SendCommand('-exec-continue')
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
848 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
849 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
850
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
851 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
852 command Gdb call win_gotoid(s:gdbwin)
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
853 command Program call s:GotoProgram()
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
854 command Source call s:GotoSourcewinOrCreateIt()
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
855 command Asm call s:GotoAsmwinOrCreateIt()
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
856 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
857
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
858 if !exists('g:termdebug_map_K') || g:termdebug_map_K
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
859 let s:k_map_saved = maparg('K', 'n', 0, 1)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
860 nnoremap K :Evaluate<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
861 endif
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
862
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12883
diff changeset
863 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
864 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
865
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
866 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
867 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
868 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
869 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
870 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
871 an 1.220 PopUp.Clear\ breakpoint :Clear<CR>
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
872 an 1.230 PopUp.Run\ until :Until<CR>
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
873 an 1.240 PopUp.Evaluate :Evaluate<CR>
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
874 endif
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
875 endif
14360
e91659ae6614 patch 8.1.0195: terminal debugger commands don't always work
Christian Brabandt <cb@256bit.org>
parents: 14356
diff changeset
876
e91659ae6614 patch 8.1.0195: terminal debugger commands don't always work
Christian Brabandt <cb@256bit.org>
parents: 14356
diff changeset
877 let &cpo = save_cpo
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
878 endfunc
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
879
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
880 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
881
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
882 " 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
883 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
884 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
885 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
886 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
887 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
888 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
889 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
890 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
891 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
892 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
893 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
894
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
895 " 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
896 func s:DeleteCommands()
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
897 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
898 delcommand Clear
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
899 delcommand Step
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
900 delcommand Over
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
901 delcommand Until
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
902 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
903 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
904 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
905 delcommand Stop
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
906 delcommand Continue
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
907 delcommand Evaluate
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
908 delcommand Gdb
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
909 delcommand Program
13682
fc660a6ef37d patch 8.0.1713: terminal debugger doesn't handle arguments
Christian Brabandt <cb@256bit.org>
parents: 13592
diff changeset
910 delcommand Source
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
911 delcommand Asm
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
912 delcommand Winbar
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
913
23164
99ef85ff1af4 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22824
diff changeset
914 if exists('s:k_map_saved')
99ef85ff1af4 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22824
diff changeset
915 if empty(s:k_map_saved)
99ef85ff1af4 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22824
diff changeset
916 nunmap K
99ef85ff1af4 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22824
diff changeset
917 else
99ef85ff1af4 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22824
diff changeset
918 call mapset('n', 0, s:k_map_saved)
99ef85ff1af4 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22824
diff changeset
919 endif
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
920 unlet s:k_map_saved
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
921 endif
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
922
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
923 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
924 " 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
925 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
926 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
927 if win_gotoid(winid)
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
928 aunmenu WinBar.Step
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
929 aunmenu WinBar.Next
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
930 aunmenu WinBar.Finish
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
931 aunmenu WinBar.Cont
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
932 aunmenu WinBar.Stop
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
933 aunmenu WinBar.Eval
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
934 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
935 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
936 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
937 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
938
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
939 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
940 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
941 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
942 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
943 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
944 aunmenu PopUp.Clear\ breakpoint
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
945 aunmenu PopUp.Run\ until
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
946 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
947 endif
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
948 endif
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
949
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
950 call sign_unplace('TermDebug')
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
951 unlet s:breakpoints
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
952 unlet s:breakpoint_locations
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
953
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
954 call sign_undefine('debugPC')
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
955 call sign_undefine(s:BreakpointSigns->map("'debugBreakpoint' .. v:val"))
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
956 let s:BreakpointSigns = []
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
957 endfunc
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
958
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
959 " :Until - Execute until past a specified position or current line
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
960 func s:Until(at)
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
961 if s:stopped
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
962 " reset s:stopped here, it may take a bit of time before we get a response
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
963 let s:stopped = 0
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
964 call ch_log('assume that program is running after this command')
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
965 " Use the fname:lnum format
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
966 let at = empty(a:at) ?
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
967 \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
968 call s:SendCommand('-exec-until ' . at)
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
969 else
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
970 call ch_log('dropping command, program is running: exec-until')
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
971 endif
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
972 endfunc
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
973
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
974 " :Break - Set a breakpoint at the cursor position.
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
975 func s:SetBreakpoint(at)
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
976 " 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
977 " 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
978 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
979 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
980 let do_continue = 1
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
981 Stop
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
982 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
983 endif
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
984
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
985 " Use the fname:lnum format, older gdb can't handle --source.
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
986 let at = empty(a:at) ?
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
987 \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
18130
1e5672da6a69 Updte runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17962
diff changeset
988 call s:SendCommand('-break-insert ' . at)
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
989 if do_continue
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
990 Continue
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
991 endif
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
992 endfunc
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
993
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
994 " :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
995 func s:ClearBreakpoint()
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
996 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
997 let lnum = line('.')
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
998 let bploc = printf('%s:%d', fname, lnum)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
999 if has_key(s:breakpoint_locations, bploc)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1000 let idx = 0
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1001 let nr = 0
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1002 for id in s:breakpoint_locations[bploc]
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1003 if has_key(s:breakpoints, id)
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1004 " Assume this always works, the reply is simply "^done".
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1005 call s:SendCommand('-break-delete ' . id)
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1006 for subid in keys(s:breakpoints[id])
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1007 call sign_unplace('TermDebug',
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1008 \ #{id: s:Breakpoint2SignNumber(id, subid)})
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1009 endfor
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1010 unlet s:breakpoints[id]
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1011 unlet s:breakpoint_locations[bploc][idx]
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1012 let nr = id
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1013 break
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1014 else
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1015 let idx += 1
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1016 endif
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1017 endfor
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1018 if nr != 0
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1019 if empty(s:breakpoint_locations[bploc])
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1020 unlet s:breakpoint_locations[bploc]
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1021 endif
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1022 echomsg 'Breakpoint ' . id . ' cleared from line ' . lnum . '.'
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1023 else
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1024 echoerr 'Internal error trying to remove breakpoint at line ' . lnum . '!'
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1025 endif
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1026 else
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1027 echomsg 'No breakpoint to remove at line ' . lnum . '.'
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1028 endif
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1029 endfunc
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1030
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1031 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
1032 if a:args != ''
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
1033 call s:SendResumingCommand('-exec-arguments ' . a:args)
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1034 endif
26438
c725b8e17f1f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26304
diff changeset
1035 call s:SendResumingCommand('-exec-run')
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1036 endfunc
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1037
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1038 func s:SendEval(expr)
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1039 " check for "likely" boolean expressions, in which case we take it as lhs
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1040 if a:expr =~ "[=!<>]="
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1041 let exprLHS = a:expr
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1042 else
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1043 " remove text that is likely an assignment
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1044 let exprLHS = substitute(a:expr, ' *=.*', '', '')
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1045 endif
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1046
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1047 " encoding expression to prevent bad errors
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
1048 let expr = a:expr
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1049 let expr = substitute(expr, '\\', '\\\\', 'g')
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1050 let expr = substitute(expr, '"', '\\"', 'g')
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
1051 call s:SendCommand('-data-evaluate-expression "' . expr . '"')
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1052 let s:evalexpr = exprLHS
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1053 endfunc
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1054
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1055 " :Evaluate - evaluate what is specified / under the cursor
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1056 func s:Evaluate(range, arg)
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1057 let expr = s:GetEvaluationExpression(a:range, a:arg)
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1058 let s:ignoreEvalError = 0
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1059 call s:SendEval(expr)
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1060 endfunc
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1061
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1062 " get what is specified / under the cursor
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1063 func s:GetEvaluationExpression(range, arg)
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1064 if a:arg != ''
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1065 " user supplied evaluation
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1066 let expr = s:CleanupExpr(a:arg)
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1067 " DSW: replace "likely copy + paste" assignment
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1068 let expr = substitute(expr, '"\([^"]*\)": *', '\1=', 'g')
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1069 elseif a:range == 2
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1070 " no evaluation but provided but range set
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1071 let pos = getcurpos()
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1072 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
1073 let regt = getregtype('v')
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1074 normal! gv"vy
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1075 let expr = s:CleanupExpr(@v)
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1076 call setpos('.', pos)
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1077 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
1078 else
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1079 " no evaluation provided: get from C-expression under cursor
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1080 " TODO: allow filetype specific lookup #9057
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1081 let expr = expand('<cexpr>')
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1082 endif
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1083 return expr
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1084 endfunc
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1085
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
1086 " clean up expression that may get in because of range
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1087 " (newlines and surrounding whitespace)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1088 " As it can also be specified via ex-command for assignments this function
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
1089 " may not change the "content" parts (like replacing contained spaces)
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1090 func s:CleanupExpr(expr)
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1091 " replace all embedded newlines/tabs/...
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1092 let expr = substitute(a:expr, '\_s', ' ', 'g')
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1093
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1094 if &filetype ==# 'cobol'
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1095 " extra cleanup for COBOL:
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1096 " - a semicolon nmay be used instead of a space
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1097 " - a trailing comma or period is ignored as it commonly separates/ends
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1098 " multiple expr
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1099 let expr = substitute(expr, ';', ' ', 'g')
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1100 let expr = substitute(expr, '[,.]\+ *$', '', '')
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1101 endif
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1102
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1103 " get rid of leading and trailing spaces
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1104 let expr = substitute(expr, '^ *', '', '')
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1105 let expr = substitute(expr, ' *$', '', '')
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1106 return expr
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1107 endfunc
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1108
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
1109 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
1110 let s:evalFromBalloonExpr = 0
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1111
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1112 " 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
1113 func s:HandleEvaluate(msg)
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1114 let value = a:msg
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1115 \ ->substitute('.*value="\(.*\)"', '\1', '')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1116 \ ->substitute('\\"', '"', 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1117 \ ->substitute('\\\\', '\\', 'g')
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
1118 "\ multi-byte characters arrive in octal form, replace everything but NULL values
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1119 \ ->substitute('\\000', s:NullRepl, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1120 \ ->substitute('\\\o\o\o', {-> eval('"' .. submatch(0) .. '"')}, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1121 "\ Note: GDB docs also mention hex encodings - the translations below work
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1122 "\ but we keep them out for performance-reasons until we actually see
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1123 "\ those in mi-returns
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1124 "\ ->substitute('\\0x00', s:NullRep, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1125 "\ ->substitute('\\0x\(\x\x\)', {-> eval('"\x' .. submatch(1) .. '"')}, 'g')
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
1126 \ ->substitute(s:NullRepl, '\\000', 'g')
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1127 if s:evalFromBalloonExpr
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1128 if s:evalFromBalloonExprResult == ''
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1129 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
1130 else
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1131 let s:evalFromBalloonExprResult .= ' = ' . value
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1132 endif
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1133 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
1134 else
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1135 echomsg '"' . s:evalexpr . '": ' . value
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1136 endif
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1137
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12773
diff changeset
1138 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
1139 " Looks like a pointer, also display what it points to.
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
1140 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
1141 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
1142 else
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1143 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
1144 endif
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1145 endfunc
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1146
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1147 " 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
1148 " if there is any.
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1149 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
1150 if v:beval_winid != s:sourcewin
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16808
diff changeset
1151 return ''
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
1152 endif
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
1153 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
1154 " 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
1155 " mouse triggers a balloon.
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16808
diff changeset
1156 return ''
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1157 endif
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1158 let s:evalFromBalloonExpr = 1
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1159 let s:evalFromBalloonExprResult = ''
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
1160 let s:ignoreEvalError = 1
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1161 let expr = s:CleanupExpr(v:beval_text)
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1162 call s:SendEval(expr)
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1163 return ''
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1164 endfunc
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1165
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1166 " Handle an error.
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1167 func s:HandleError(msg)
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
1168 if s:ignoreEvalError
12865
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1169 " Result of s:SendEval() failed, ignore.
13341
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
1170 let s:ignoreEvalError = 0
acd7eaa13d2b Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
1171 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
1172 return
ebb4f6c93598 patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents: 12833
diff changeset
1173 endif
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
1174 let msgVal = substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
1175 echoerr substitute(msgVal, '\\"', '"', 'g')
12425
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1176 endfunc
29d21591ad6b patch 8.0.1092: terminal debugger can't evaluate expressions
Christian Brabandt <cb@256bit.org>
parents: 12411
diff changeset
1177
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
1178 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
1179 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
1180 new
14107
274c9f1fbfd2 patch 8.1.0071: terminal debugger only works with the terminal feature
Christian Brabandt <cb@256bit.org>
parents: 13706
diff changeset
1181 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
1182 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
1183 endif
a64485061f75 patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents: 13564
diff changeset
1184 endfunc
a64485061f75 patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents: 13564
diff changeset
1185
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1186 func s:GotoAsmwinOrCreateIt()
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1187 if !win_gotoid(s:asmwin)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1188 if win_gotoid(s:sourcewin)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1189 exe 'rightbelow new'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1190 else
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1191 exe 'new'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1192 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1193
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1194 let s:asmwin = win_getid(winnr())
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1195
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1196 setlocal nowrap
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1197 setlocal number
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1198 setlocal noswapfile
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1199 setlocal buftype=nofile
26148
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26100
diff changeset
1200 setlocal modifiable
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1201
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1202 let asmbuf = bufnr('Termdebug-asm-listing')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1203 if asmbuf > 0
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1204 exe 'buffer' . asmbuf
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1205 else
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1206 exe 'file Termdebug-asm-listing'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1207 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1208
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1209 if exists('g:termdebug_disasm_window')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1210 if g:termdebug_disasm_window > 1
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1211 exe 'resize ' . g:termdebug_disasm_window
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1212 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1213 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1214 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1215
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1216 if s:asm_addr != ''
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1217 let lnum = search('^' . s:asm_addr)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1218 if lnum == 0
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1219 if s:stopped
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1220 call s:SendCommand('disassemble $pc')
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1221 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1222 else
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1223 call sign_unplace('TermDebug', #{id: s:asm_id})
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1224 call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1225 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1226 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1227 endfunc
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1228
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1229 " 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
1230 " 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
1231 func s:HandleCursor(msg)
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1232 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
1233
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1234 if a:msg =~ '^\*stopped'
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1235 call ch_log('program stopped')
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1236 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
1237 elseif a:msg =~ '^\*running'
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1238 call ch_log('program running')
12833
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1239 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
1240 endif
db9ffed7e1fc patch 8.0.1293: setting a breakpoint in the terminal debugger sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
1241
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1242 if a:msg =~ 'fullname='
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1243 let fname = s:GetFullname(a:msg)
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1244 else
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1245 let fname = ''
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1246 endif
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1247
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1248 if a:msg =~ 'addr='
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1249 let asm_addr = s:GetAsmAddr(a:msg)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1250 if asm_addr != ''
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1251 let s:asm_addr = asm_addr
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1252
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1253 let curwinid = win_getid(winnr())
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1254 if win_gotoid(s:asmwin)
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1255 let lnum = search('^' . s:asm_addr)
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1256 if lnum == 0
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1257 call s:SendCommand('disassemble $pc')
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1258 else
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1259 call sign_unplace('TermDebug', #{id: s:asm_id})
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1260 call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1261 endif
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1262
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1263 call win_gotoid(curwinid)
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1264 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1265 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1266 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23164
diff changeset
1267
13592
a64485061f75 patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents: 13564
diff changeset
1268 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
1269 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
1270 if lnum =~ '^[0-9]*$'
27162
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1271 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
1272 if expand('%:p') != fnamemodify(fname, ':p')
27321
3649b5a6b1b6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
1273 echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname, ':p') .. '"'
27162
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1274 augroup Termdebug
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1275 " Always open a file read-only instead of showing the ATTENTION
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1276 " prompt, since we are unlikely to want to edit the file.
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1277 " The file may be changed but not saved, warn for that.
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1278 au SwapExists * echohl WarningMsg
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1279 \ | echo 'Warning: file is being edited elsewhere'
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1280 \ | echohl None
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
1281 \ | let v:swapchoice = '0'
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1282 augroup END
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1283 if &modified
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1284 " TODO: find existing window
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1285 exe 'split ' . fnameescape(fname)
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1286 let s:sourcewin = win_getid(winnr())
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1287 call s:InstallWinbar()
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1288 else
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1289 exe 'edit ' . fnameescape(fname)
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1290 endif
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1291 augroup Termdebug
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1292 au! SwapExists
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1293 augroup END
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1294 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
1295 exe lnum
26148
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26100
diff changeset
1296 normal! zv
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1297 call sign_unplace('TermDebug', #{id: s:pc_id})
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1298 call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1299 \ #{lnum: lnum, priority: 110})
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
1300 if !exists('b:save_signcolumn')
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1301 let b:save_signcolumn = &signcolumn
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1302 call add(s:signcolumn_buflist, bufnr())
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
1303 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
1304 setlocal signcolumn=yes
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1305 endif
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1306 elseif !s:stopped || fname != ''
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1307 call sign_unplace('TermDebug', #{id: 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
1308 endif
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1309
13592
a64485061f75 patch 8.0.1668: terminal debugger: can't re-open source code window
Christian Brabandt <cb@256bit.org>
parents: 13564
diff changeset
1310 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
1311 endfunc
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1312
14143
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1313 let s:BreakpointSigns = []
2aec369c4fc3 patch 8.1.0089: error when ending the terminal debugger
Christian Brabandt <cb@256bit.org>
parents: 14127
diff changeset
1314
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1315 func s:CreateBreakpoint(id, subid, enabled)
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1316 let nr = printf('%d.%d', a:id, a:subid)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1317 if index(s:BreakpointSigns, nr) == -1
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1318 call add(s:BreakpointSigns, nr)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1319 if a:enabled == "n"
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1320 let hiName = "debugBreakpointDisabled"
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1321 else
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1322 let hiName = "debugBreakpoint"
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1323 endif
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1324 call sign_define('debugBreakpoint' .. nr,
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1325 \ #{text: substitute(nr, '\..*', '', ''),
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1326 \ texthl: hiName})
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
1327 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
1328 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
1329
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1330 func! s:SplitMsg(s)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1331 return split(a:s, '{.\{-}}\zs')
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1332 endfunction
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1333
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1334 " Handle setting a breakpoint
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1335 " Will update the sign that shows the breakpoint
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1336 func s:HandleNewBreakpoint(msg, modifiedFlag)
14165
5b5364d0729d patch 8.1.0100: terminal debugger: error when setting a watch point
Christian Brabandt <cb@256bit.org>
parents: 14151
diff changeset
1337 if a:msg !~ 'fullname='
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1338 " a watch or a pending breakpoint does not have a file name
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1339 if a:msg =~ 'pending='
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1340 let nr = substitute(a:msg, '.*number=\"\([0-9.]*\)\".*', '\1', '')
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1341 let target = substitute(a:msg, '.*pending=\"\([^"]*\)\".*', '\1', '')
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1342 echomsg 'Breakpoint ' . nr . ' (' . target . ') pending.'
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1343 endif
14165
5b5364d0729d patch 8.1.0100: terminal debugger: error when setting a watch point
Christian Brabandt <cb@256bit.org>
parents: 14151
diff changeset
1344 return
5b5364d0729d patch 8.1.0100: terminal debugger: error when setting a watch point
Christian Brabandt <cb@256bit.org>
parents: 14151
diff changeset
1345 endif
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1346 for msg in s:SplitMsg(a:msg)
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1347 let fname = s:GetFullname(msg)
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1348 if empty(fname)
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1349 continue
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1350 endif
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1351 let nr = substitute(msg, '.*number="\([0-9.]*\)\".*', '\1', '')
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1352 if empty(nr)
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1353 return
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1354 endif
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1355
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1356 " If "nr" is 123 it becomes "123.0" and subid is "0".
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1357 " If "nr" is 123.4 it becomes "123.4.0" and subid is "4"; "0" is discarded.
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1358 let [id, subid; _] = map(split(nr . '.0', '\.'), 'v:val + 0')
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1359 let enabled = substitute(msg, '.*enabled="\([yn]\)".*', '\1', '')
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1360 call s:CreateBreakpoint(id, subid, enabled)
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1361
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1362 if has_key(s:breakpoints, id)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1363 let entries = s:breakpoints[id]
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1364 else
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1365 let entries = {}
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1366 let s:breakpoints[id] = entries
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1367 endif
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1368 if has_key(entries, subid)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1369 let entry = entries[subid]
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1370 else
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1371 let entry = {}
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1372 let entries[subid] = entry
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1373 endif
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1374
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1375 let lnum = substitute(msg, '.*line="\([^"]*\)".*', '\1', '')
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1376 let entry['fname'] = fname
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1377 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
1378
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1379 let bploc = printf('%s:%d', fname, lnum)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1380 if !has_key(s:breakpoint_locations, bploc)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1381 let s:breakpoint_locations[bploc] = []
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1382 endif
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1383 let s:breakpoint_locations[bploc] += [id]
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1384
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1385 if bufloaded(fname)
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1386 call s:PlaceSign(id, subid, entry)
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1387 let posMsg = ' at line ' . lnum . '.'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1388 else
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1389 let posMsg = ' in ' . fname . ' at line ' . lnum . '.'
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1390 endif
26304
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1391 if !a:modifiedFlag
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1392 let actionTaken = 'created'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1393 elseif enabled == 'n'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1394 let actionTaken = 'disabled'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1395 else
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1396 let actionTaken = 'enabled'
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1397 endif
bb2175e5ccee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26219
diff changeset
1398 echomsg 'Breakpoint ' . nr . ' ' . actionTaken . posMsg
15093
8690318105ee patch 8.1.0557: Termdebug: gdb may use X.Y for breakpoint number
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
1399 endfor
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1400 endfunc
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1401
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1402 func s:PlaceSign(id, subid, entry)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1403 let nr = printf('%d.%d', a:id, a:subid)
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1404 call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1405 \ 'debugBreakpoint' .. nr, a:entry['fname'],
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1406 \ #{lnum: a:entry['lnum'], priority: 110})
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1407 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
1408 endfunc
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1409
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1410 " Handle deleting a breakpoint
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1411 " 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
1412 func s:HandleBreakpointDelete(msg)
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1413 let id = substitute(a:msg, '.*id="\([0-9]*\)\".*', '\1', '') + 0
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1414 if empty(id)
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1415 return
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1416 endif
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1417 if has_key(s:breakpoints, id)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1418 for [subid, entry] in items(s:breakpoints[id])
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1419 if has_key(entry, 'placed')
28517
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1420 call sign_unplace('TermDebug',
f73a9bdff3a3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28141
diff changeset
1421 \ #{id: s:Breakpoint2SignNumber(id, subid)})
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1422 unlet entry['placed']
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1423 endif
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1424 endfor
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1425 unlet s:breakpoints[id]
26219
786b2a8ec970 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26148
diff changeset
1426 echomsg 'Breakpoint ' . id . ' cleared.'
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1427 endif
12411
5d4d744151c2 patch 8.0.1085: terminal debugger can't set breakpoints
Christian Brabandt <cb@256bit.org>
parents: 12395
diff changeset
1428 endfunc
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1429
14147
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1430 " Handle the debugged program starting to run.
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1431 " Will store the process ID in s:pid
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1432 func s:HandleProgramRun(msg)
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1433 let nr = substitute(a:msg, '.*pid="\([0-9]*\)\".*', '\1', '') + 0
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1434 if nr == 0
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1435 return
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1436 endif
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1437 let s:pid = nr
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1438 call ch_log('Detected process ID: ' . s:pid)
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1439 endfunc
de75c249723d patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents: 14143
diff changeset
1440
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1441 " 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
1442 func s:BufRead()
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1443 let fname = expand('<afile>:p')
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1444 for [id, entries] in items(s:breakpoints)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1445 for [subid, entry] in items(entries)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1446 if entry['fname'] == fname
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1447 call s:PlaceSign(id, subid, entry)
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1448 endif
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1449 endfor
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1450 endfor
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1451 endfunc
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1452
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1453 " 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
1454 func s:BufUnloaded()
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1455 let fname = expand('<afile>:p')
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1456 for [id, entries] in items(s:breakpoints)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1457 for [subid, entry] in items(entries)
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1458 if entry['fname'] == fname
28141
dce918af0c00 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27321
diff changeset
1459 let entry['placed'] = 0
15129
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1460 endif
2090f267b311 patch 8.1.0575: Termdebug: clearing multi-breakpoint does not work
Bram Moolenaar <Bram@vim.org>
parents: 15093
diff changeset
1461 endfor
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1462 endfor
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents: 12455
diff changeset
1463 endfunc
14356
9339e4dbf6bf patch 8.1.0193: terminal debugger buttons don't always work
Christian Brabandt <cb@256bit.org>
parents: 14165
diff changeset
1464
9339e4dbf6bf patch 8.1.0193: terminal debugger buttons don't always work
Christian Brabandt <cb@256bit.org>
parents: 14165
diff changeset
1465 let &cpo = s:keepcpo
9339e4dbf6bf patch 8.1.0193: terminal debugger buttons don't always work
Christian Brabandt <cb@256bit.org>
parents: 14165
diff changeset
1466 unlet s:keepcpo