patch 9.1.1756: termdebug: Need a few more user commands
Problem: termdebug: Need a few more user commands
Solution: Add the :RunOrContinue and the :ToggleBreak user commands
(bennyyip)
closes: #18283
Signed-off-by: bennyyip <yebenmy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
c37f25c651
commit
c975d62473
@ -4,7 +4,7 @@ vim9script
|
||||
|
||||
# Author: Bram Moolenaar
|
||||
# Copyright: Vim license applies, see ":help license"
|
||||
# Last Change: 2025 Sep 02
|
||||
# Last Change: 2025 Sep 14
|
||||
# Converted to Vim9: Ubaldo Tiberi <ubaldo.tiberi@gmail.com>
|
||||
|
||||
# WORK IN PROGRESS - The basics works stable, more to come
|
||||
@ -1173,6 +1173,7 @@ def InstallCommands()
|
||||
|
||||
command -nargs=? Break SetBreakpoint(<q-args>)
|
||||
command -nargs=? Tbreak SetBreakpoint(<q-args>, true)
|
||||
command ToggleBreak ToggleBreak()
|
||||
command Clear ClearBreakpoint()
|
||||
command Step SendResumingCommand('-exec-step')
|
||||
command Over SendResumingCommand('-exec-next')
|
||||
@ -1182,6 +1183,7 @@ def InstallCommands()
|
||||
command -nargs=* Arguments SendResumingCommand('-exec-arguments ' .. <q-args>)
|
||||
command Stop StopCommand()
|
||||
command Continue ContinueCommand()
|
||||
command RunOrContinue RunOrContinue()
|
||||
|
||||
command -nargs=* Frame Frame(<q-args>)
|
||||
command -count=1 Up Up(<count>)
|
||||
@ -1296,6 +1298,8 @@ def DeleteCommands()
|
||||
delcommand Asm
|
||||
delcommand Var
|
||||
delcommand Winbar
|
||||
delcommand RunOrContinue
|
||||
delcommand ToggleBreak
|
||||
|
||||
|
||||
if !empty(saved_K_map) && !saved_K_map.buffer
|
||||
@ -1439,6 +1443,19 @@ def ClearBreakpoint()
|
||||
endif
|
||||
enddef
|
||||
|
||||
def ToggleBreak()
|
||||
var fname = fnameescape(expand('%:p'))
|
||||
var lnum = line('.')
|
||||
var bploc = printf('%s:%d', fname, lnum)
|
||||
if has_key(breakpoint_locations, bploc)
|
||||
while has_key(breakpoint_locations, bploc)
|
||||
ClearBreakpoint()
|
||||
endwhile
|
||||
else
|
||||
SetBreakpoint("")
|
||||
endif
|
||||
enddef
|
||||
|
||||
def Run(args: string)
|
||||
if args != ''
|
||||
SendResumingCommand($'-exec-arguments {args}')
|
||||
@ -1446,6 +1463,14 @@ def Run(args: string)
|
||||
SendResumingCommand('-exec-run')
|
||||
enddef
|
||||
|
||||
def RunOrContinue()
|
||||
if running
|
||||
ContinueCommand()
|
||||
else
|
||||
Run('')
|
||||
endif
|
||||
enddef
|
||||
|
||||
# :Frame - go to a specific frame in the stack
|
||||
def Frame(arg: string)
|
||||
# Note: we explicit do not use mi's command
|
||||
@ -2004,7 +2029,10 @@ def HandleNewBreakpoint(msg: string, modifiedFlag: bool)
|
||||
if !has_key(breakpoint_locations, bploc)
|
||||
breakpoint_locations[bploc] = []
|
||||
endif
|
||||
breakpoint_locations[bploc] += [id]
|
||||
if breakpoint_locations[bploc]->index(id) == -1
|
||||
# Make sure all ids are unique
|
||||
breakpoint_locations[bploc] += [id]
|
||||
endif
|
||||
|
||||
var posMsg = ''
|
||||
if bufloaded(fname)
|
||||
|
||||
Reference in New Issue
Block a user