xavierd / clang_complete

Vim plugin that use clang for completing C/C++ code.
http://www.vim.org/scripts/script.php?script_id=3302
1.96k stars 308 forks source link

SEGV when scrolling buffer #457

Closed nickdesaulniers closed 9 years ago

nickdesaulniers commented 9 years ago

so I narrowed this issue down to just this plugin. STR:

  1. open a c++ file buffer in vim 7.3 OSX 10.10.5
  2. press up arrow key

expected: buffer not to scroll

actual:

➜  ~  vim 3.cpp
Vim: Caught deadly signal SEGV
Vim: Finished.
[1]    54763 segmentation fault  vim 3.cpp

How can I start debugging this?

nickdesaulniers commented 9 years ago

the same thing happens when I hold the down arrow key, as soon as I would navigate "off the end" of the file.

xaizek commented 9 years ago

Yuu could try setting:

let g:clang_debug = 1

And see the output (maybe crash won't let you see it). Things like CursorMovedI auto-commands also come to my mind, but they are for insert mode. One can also comment out pieces of the plugin and see what's going on.

nickdesaulniers commented 9 years ago

let g:clang_debug = 1 doesn't add any info

If I comment out all augroups in clang_complete/plugin/clang_complete.vim that have the phrase Cursor in them, I still get the crash.

xaizek commented 9 years ago

Does it crash if you use gvim?

Another thing worth trying might be putting return here. In case libclang causes the crash (bindings are outdated, so this is not unlikely).

nickdesaulniers commented 9 years ago

no issues with gvim, though it's based on vim 7.4.769. Maybe 7.3 that's distributed with OSX 10.10.5 is missing a patch or clang_complete has some incompatibility?

With the added return:

def run(self):
  return
  with libclangLock:

I still get the segfault, but typing :: says -- User defined completion (^U^N^P) Pattern not found

nickdesaulniers commented 9 years ago

I just used homebrew to upgrade to vim 7.4.889, same problem (SEGV)

nickdesaulniers commented 9 years ago

Also, after the segfault, my terminal colors are messed up (background is set to light grey). Not sure that is relevant though.

xaizek commented 9 years ago

Also, after the segfault, my terminal colors are messed up (background is set to light grey). Not sure that is relevant though.

It might be, see #453, that's why I asked whether gvim works. Try to start Vim with redirected stderr like this vim 2>/dev/null ... as described there. If the issue disappears, it must be the same problem.

Messed up colors can also be caused by abnormal termination, though.

nickdesaulniers commented 9 years ago

Try to start Vim with redirected stderr like this vim 2>/dev/null ... as described there. If the issue disappears, it must be the same problem.

Yep, vim 2>/dev/null works. I'll set a simple alias in my shell for now.