forked from aniani/vim
patch 8.0.1668: terminal debugger: can't re-open source code window
Problem: Terminal debugger: can't re-open source code window. Solution: Add the :Source command. Also create the window if needed when gdb stops at a source line.
This commit is contained in:
@@ -731,6 +731,11 @@ to have the 'mouse' option set to enable mouse clicks.
|
|||||||
You can add the window toolbar in other windows you open with: >
|
You can add the window toolbar in other windows you open with: >
|
||||||
:Winbar
|
:Winbar
|
||||||
|
|
||||||
|
If gdb stops at a source line and there is no window currently showing the
|
||||||
|
source code, a new window will be created for the source code. This also
|
||||||
|
happens if the buffer in the source code window has been modified and can't be
|
||||||
|
abandoned.
|
||||||
|
|
||||||
|
|
||||||
Inspecting variables ~
|
Inspecting variables ~
|
||||||
*termdebug-variables*
|
*termdebug-variables*
|
||||||
@@ -747,6 +752,8 @@ Other commands ~
|
|||||||
*termdebug-commands*
|
*termdebug-commands*
|
||||||
:Gdb jump to the gdb window
|
:Gdb jump to the gdb window
|
||||||
:Program jump to the window with the running program
|
:Program jump to the window with the running program
|
||||||
|
:Source jump to the window with the source code, create it if there
|
||||||
|
isn't one
|
||||||
|
|
||||||
|
|
||||||
Communication ~
|
Communication ~
|
||||||
|
@@ -246,6 +246,7 @@ func s:InstallCommands()
|
|||||||
command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>)
|
command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>)
|
||||||
command Gdb call win_gotoid(s:gdbwin)
|
command Gdb call win_gotoid(s:gdbwin)
|
||||||
command Program call win_gotoid(s:ptywin)
|
command Program call win_gotoid(s:ptywin)
|
||||||
|
command Source call s:GotoStartwinOrCreateIt()
|
||||||
command Winbar call s:InstallWinbar()
|
command Winbar call s:InstallWinbar()
|
||||||
|
|
||||||
" TODO: can the K mapping be restored?
|
" TODO: can the K mapping be restored?
|
||||||
@@ -269,6 +270,7 @@ let s:winbar_winids = []
|
|||||||
|
|
||||||
" Install the window toolbar in the current window.
|
" Install the window toolbar in the current window.
|
||||||
func s:InstallWinbar()
|
func s:InstallWinbar()
|
||||||
|
if has('menu') && &mouse != ''
|
||||||
nnoremenu WinBar.Step :Step<CR>
|
nnoremenu WinBar.Step :Step<CR>
|
||||||
nnoremenu WinBar.Next :Over<CR>
|
nnoremenu WinBar.Next :Over<CR>
|
||||||
nnoremenu WinBar.Finish :Finish<CR>
|
nnoremenu WinBar.Finish :Finish<CR>
|
||||||
@@ -276,6 +278,7 @@ func s:InstallWinbar()
|
|||||||
nnoremenu WinBar.Stop :Stop<CR>
|
nnoremenu WinBar.Stop :Stop<CR>
|
||||||
nnoremenu WinBar.Eval :Evaluate<CR>
|
nnoremenu WinBar.Eval :Evaluate<CR>
|
||||||
call add(s:winbar_winids, win_getid(winnr()))
|
call add(s:winbar_winids, win_getid(winnr()))
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Delete installed debugger commands in the current window.
|
" Delete installed debugger commands in the current window.
|
||||||
@@ -450,6 +453,14 @@ func s:HandleError(msg)
|
|||||||
echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
|
echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func s:GotoStartwinOrCreateIt()
|
||||||
|
if !win_gotoid(s:startwin)
|
||||||
|
new
|
||||||
|
let s:startwin = win_getid(winnr())
|
||||||
|
call s:InstallWinbar()
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Handle stopping and running message from gdb.
|
" Handle stopping and running message from gdb.
|
||||||
" Will update the sign that shows the current position.
|
" Will update the sign that shows the current position.
|
||||||
func s:HandleCursor(msg)
|
func s:HandleCursor(msg)
|
||||||
@@ -461,7 +472,8 @@ func s:HandleCursor(msg)
|
|||||||
let s:stopped = 0
|
let s:stopped = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if win_gotoid(s:startwin)
|
call s:GotoStartwinOrCreateIt()
|
||||||
|
|
||||||
let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '')
|
let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '')
|
||||||
if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname)
|
if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname)
|
||||||
let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
|
let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
|
||||||
@@ -471,6 +483,7 @@ func s:HandleCursor(msg)
|
|||||||
" TODO: find existing window
|
" TODO: find existing window
|
||||||
exe 'split ' . fnameescape(fname)
|
exe 'split ' . fnameescape(fname)
|
||||||
let s:startwin = win_getid(winnr())
|
let s:startwin = win_getid(winnr())
|
||||||
|
call s:InstallWinbar()
|
||||||
else
|
else
|
||||||
exe 'edit ' . fnameescape(fname)
|
exe 'edit ' . fnameescape(fname)
|
||||||
endif
|
endif
|
||||||
@@ -485,7 +498,6 @@ func s:HandleCursor(msg)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
call win_gotoid(wid)
|
call win_gotoid(wid)
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Handle setting a breakpoint
|
" Handle setting a breakpoint
|
||||||
|
@@ -762,6 +762,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1668,
|
||||||
/**/
|
/**/
|
||||||
1667,
|
1667,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user