Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breakadd expr broken? #3687

Open
dhduvall opened this issue Dec 11, 2018 · 2 comments
Open

breakadd expr broken? #3687

dhduvall opened this issue Dec 11, 2018 · 2 comments

Comments

@dhduvall
Copy link
Contributor

I was trying to use vim debugging to investigate fatih/vim-go#2090, to find where &cpo was being changed. This is what my session looks like:

$ vim -D foo.go
Entering Debug mode.  Type "cont" to continue.
/usr/share/vim/vimrc
line 10: runtime! debian.vim
>breakadd expr &cpo
>cont
Breakpoint in "/usr/share/vim/vimrc" line 11
Oldval = "'aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;'"
Newval = "'aABceFs'"
/usr/share/vim/vimrc
line 56: if filereadable("/etc/vim/vimrc.local")
>cont
Oldval = "'aABceFs'"
Newval = "'aABceFs$'"
/home/duvall/.vim/autoload/pathogen.vim
line 13: if exists("g:loaded_pathogen") || &cp
>
Breakpoint in "/home/duvall/.vim/bundle/arcanist.vim/ftdetect/arcanist.vim" line 1
Oldval = "'aABceFs$'"
Newval = "'aABceFs'"
/home/duvall/.vim/bundle/arcanist.vim/ftdetect/arcanist.vim
line 1: if !empty($TMPDIR)
>
Breakpoint in "/usr/share/vim/vim81/ftplugin.vim" line 1
Oldval = "'aABceFs'"
Newval = "'aABceFs$'"
/usr/share/vim/vim81/ftplugin.vim
line 6: if exists("did_load_ftplugin")
>
Breakpoint in "<SNR>26_checkVersion" line 1
Oldval = "'aABceFs$'"
Newval = "'aABceFs'"
function <SNR>26_checkVersion
line 9: let l:unsupported = 0
>
Breakpoint in "/home/duvall/.vim/bundle/vim-indent-guides/plugin/indent_guides.vim" line 1
Oldval = "'aABceFs'"
Newval = "'aABceFs$'"
/home/duvall/.vim/bundle/vim-indent-guides/plugin/indent_guides.vim
line 5: if (v:version == 701 && !exists('*matchadd')) || (v:version < 701)
>

Then the screen clears, and I get (hitting return between each line to repeat cont):

line 7: if exists("g:current_compiler")
line 2: command! -nargs=? -complete=customlist,go#rename#Complete GoRename call go#rename#Rename(<bang>0, <f-args>)
line 1: return get(g:, 'go_snippet_engine', 'automatic')
line 6: if !executable('ctags')

and the next return dumps me into the file.

I know that &cpo was changed many more times than this (such as in my .vimrc!). It doesn't appear that &cpo was changed at any of the locations where the breakpoint was triggered, even though the old and new values presented are pretty much what I'd expect, bouncing back and forth between the value I set and the default, as scripts save and restore it.

Did I do something wrong, or am I reading this poorly? Or is there something broken?

@chrisbra
Copy link
Member

Hm, Is there something special for those lines where the break expression did not halt?
For example, I remember when implementing it, that the watchexpr did initially not stop if the value was changed at the last line of a function, the watchexpr code would only later notice it, trigger and stop program execution (at what looks like a totally unrelated position).

Perhaps something similar is happening here.

@dhduvall
Copy link
Contributor Author

Not as far as I can tell. My .vimrc simply has

set cpoptions+=$

a few lines down from the top of the file. The ones in vim-go simply look like

let s:cpo_save = &cpo
set cpo&vim
...
let &cpo = s:cpo_save
unlet s:cpo_save

Nothing special there. The places it does break where I wouldn't expect it (all the places in the original comment) on seem to be the first statement in the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants