0
0
mirror of https://github.com/vim/vim.git synced 2025-10-21 08:24:06 -04:00

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:
bennyyip
2025-09-14 04:33:07 -04:00
committed by Christian Brabandt
parent c37f25c651
commit c975d62473
5 changed files with 122 additions and 3 deletions

View File

@@ -606,4 +606,87 @@ function Test_termdebug_config_types()
unlet g:termdebug_config
endfunction
func Test_termdebug_toggle_break()
let g:test_is_flaky = 1
let bin_name = 'XTD_tbreak'
let src_name = bin_name .. '.c'
eval s:generate_files(bin_name)
execute 'edit ' .. src_name
execute 'Termdebug ./' .. bin_name
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
call WaitForAssert({-> assert_equal(3, winnr('$'))})
let gdb_buf = winbufnr(1)
wincmd b
let bp_line = 22 " 'return' statement in main
execute "normal! " .. bp_line .. "G"
execute "ToggleBreak"
call term_wait(gdb_buf)
redraw!
call assert_equal([
\ {'lnum': bp_line, 'id': 1014, 'name': 'debugBreakpoint1.0',
\ 'priority': 110, 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)
RunOrContinue
call term_wait(gdb_buf, 400)
redraw!
call WaitForAssert({-> assert_equal([
\ {'lnum': bp_line, 'id': 12, 'name': 'debugPC', 'priority': 110,
\ 'group': 'TermDebug'},
\ {'lnum': bp_line, 'id': 1014, 'name': 'debugBreakpoint1.0',
\ 'priority': 110, 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
" Add one break point
execute "normal! " .. bp_line .. "G"
execute "ToggleBreak"
call term_wait(gdb_buf)
redraw!
call WaitForAssert({-> assert_equal([
\ {'lnum': bp_line, 'id': 12, 'name': 'debugPC', 'priority': 110,
\ 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
" Remove one break point
execute "normal! " .. bp_line .. "G"
execute "ToggleBreak"
call term_wait(gdb_buf)
redraw!
call WaitForAssert({-> assert_equal([
\ {'lnum': bp_line, 'id': 2014, 'name': 'debugBreakpoint2.0',
\ 'priority': 110, 'group': 'TermDebug'},
\ {'lnum': bp_line, 'id': 12, 'name': 'debugPC', 'priority': 110,
\ 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
" Remove multiple break points
execute "Break"
execute "Break"
execute "Break"
execute "Break"
call term_wait(gdb_buf, 400)
execute "ToggleBreak"
call term_wait(gdb_buf)
redraw!
call WaitForAssert({-> assert_equal([
\ {'lnum': bp_line, 'id': 12, 'name': 'debugPC', 'priority': 110,
\ 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
wincmd t
quit!
redraw!
call WaitForAssert({-> assert_equal(1, winnr('$'))})
call assert_equal([], sign_getplaced('', #{group: 'TermDebug'})[0].signs)
eval s:cleanup_files(bin_name)
%bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1756,
/**/
1755,
/**/