runtime(termdebug: Fix errors in using the latest termdebug.vim
Commit:
https://github.com/vim/vim/commit/03a3df15ca8bdae27b609eed815132fb79365fb0
Author: Yegappan Lakshmanan <[email protected]>
Date: Sun Jun 9 16:42:45 2024 +0200
runtime(termdebug: Fix errors in using the latest termdebug.vim
closes: https://github.com/vim/vim/issues/14941
Signed-off-by: Yegappan Lakshmanan <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 78a601457..d083b7ec9 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -193,7 +193,7 @@ enddef
def StartDebugCommand(bang: bool, ...args: list<string>)
# First argument is the command to debug, rest are run arguments.
- StartDebug_internal({'gdb_args': [args[0]], 'proc_args': args[1:], 'bang':
bang})
+ StartDebug_internal({'gdb_args': [args[0]], 'proc_args': args[1 : ], 'bang':
bang})
enddef
@@ -618,6 +618,27 @@ def SendCommand(cmd: string)
endif
enddef
+# Interrupt or stop the program
+def StopCommand()
+ if way == 'prompt'
+ PromptInterrupt()
+ else
+ SendCommand('-exec-interrupt')
+ endif
+enddef
+
+# Continue the program
+def ContinueCommand()
+ if way == 'prompt'
+ SendCommand('continue')
+ else
+ # using -exec-continue results in CTRL-C in the gdb window not working,
+ # communicating via commbuf (= use of SendCommand) has the same result
+ SendCommand('-exec-continue')
+ # command Continue term_sendkeys(gdbbuf, "continue
")
+ endif
+enddef
+
# This is global so that a user can create their mappings with this.
def TermDebugSendCommand(cmd: string)
if way == 'prompt'
@@ -626,13 +647,13 @@ def TermDebugSendCommand(cmd: string)
var do_continue = 0
if !stopped
do_continue = 1
- Stop
+ StopCommand()
sleep 10m
endif
# TODO: should we prepend CTRL-U to clear the command?
term_sendkeys(gdbbuf, cmd .. "
")
if do_continue
- Continue
+ ContinueCommand()
endif
endif
enddef
@@ -1037,17 +1058,8 @@ def InstallCommands()
command Finish SendResumingCommand('-exec-finish')
command -nargs=* Run Run(<q-args>)
command -nargs=* Arguments SendResumingCommand('-exec-arguments ' ..
<q-args>)
-
- if way == 'prompt'
- command Stop PromptInterrupt()
- command Continue SendCommand('continue')
- else
- command Stop SendCommand('-exec-interrupt')
- # using -exec-continue results in CTRL-C in the gdb window not working,
- # communicating via commbuf (= use of SendCommand) has the same result
- command Continue SendCommand('-exec-continue')
- # command Continue term_sendkeys(gdbbuf, "continue
")
- endif
+ command Stop StopCommand()
+ command Continue ContinueCommand()
command -nargs=* Frame Frame(<q-args>)
command -count=1 Up Up(<count>)
@@ -1211,11 +1223,15 @@ def DeleteCommands()
if exists('saved_mousemodel')
&mousemodel = saved_mousemodel
saved_mousemodel = null_string
- aunmenu PopUp.-SEP3-
- aunmenu PopUp.Set\ breakpoint
- aunmenu PopUp.Clear\ breakpoint
- aunmenu PopUp.Run\ until
- aunmenu PopUp.Evaluate
+ try
+ aunmenu PopUp.-SEP3-
+ aunmenu PopUp.Set\ breakpoint
+ aunmenu PopUp.Clear\ breakpoint
+ aunmenu PopUp.Run\ until
+ aunmenu PopUp.Evaluate
+ catch
+ # ignore any errors in removing the PopUp menu
+ endtry
endif
endif
@@ -1253,7 +1269,7 @@ def SetBreakpoint(at: string, tbreak=false)
var do_continue = 0
if !stopped
do_continue = 1
- Stop
+ StopCommand()
sleep 10m
endif
@@ -1270,7 +1286,7 @@ def SetBreakpoint(at: string, tbreak=false)
# echom "cmsd: " .. cmd
SendCommand(cmd)
if do_continue
- Continue
+ ContinueCommand()
endif
enddef
@@ -1327,13 +1343,13 @@ def Frame(arg: string)
# already parsed and allows for more formats
if arg =~ '^\d\+$' || arg == ''
# specify frame by number
- SendCommand('-interpreter-exec mi "frame ' .. arg ..'"')
+ SendCommand('-interpreter-exec mi "frame ' .. arg .. '"')
elseif arg =~ '^0x[0-9a-fA-F]\+$'
# specify frame by stack address
- SendCommand('-interpreter-exec mi "frame address ' .. arg ..'"')
+ SendCommand('-interpreter-exec mi "frame address ' .. arg .. '"')
else
# specify frame by function name
- SendCommand('-interpreter-exec mi "frame function ' .. arg ..'"')
+ SendCommand('-interpreter-exec mi "frame function ' .. arg .. '"')
endif
enddef
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1sGJnA-002ICd-K8%40256bit.org.