4

I assume this is coming from a Vim plugin, but I get no leads on where to look. What's the best way of debugging it?

Vim: Caught deadly signal SEGV
Vim: Finished.

[1]    8119 segmentation fault 
  • Maybe that's not the ideal solution in your case but vim has a debug mode which can be useful sometimes. :h debug-mode. – statox Apr 11 '16 at 11:57
  • Interesting -- and this should catch plugins? – Sauce McBoss Apr 12 '16 at 2:51
  • I think it does catch plugins but I may be wrong (That's why I mentioned it in a comment and not in an answer). – statox Apr 12 '16 at 8:04
1

This has been here for four hours, I'll give you what help I can. The classical way of debugging programs is with gdb:

$ ulimit -c unlimited
$ # [do whatever generates the segmentation fault]
$ ls -ld *core* # see new core file that I'll call $core
$ file $core # see program name that I'll call $program
$ gdb $program $core
(gdb) bt

That should hopefully give a backtrace of function calls. If you're unlucky you'll get lots of ??, which means that debugging symbols are not enabled. You could get around that with access to the original program objects, but I don't suppose you'd have those.

Instead, one might also run

$ gdb $program
(gdb) run arg1 arg2 argetc

However my experience with this is almost only with non-UI programs. I have no idea if either method will work when the segmentation fault happens inside a vim plugin . . .

  • Thanks for the answer -- I imagine that Vim would have specific hooks for debugging, but I suppose that gdb would be a valid approach. I guess I was thinking that plugins would need something more specific. Has anyone else used gdb to debug Vim plugins? – Sauce McBoss Apr 11 '16 at 1:27
  • you most likely need debug symbols, otherwise this is not really helpful. Another hint might be to use catchsegv program to find why it is segfaulting. – Christian Brabandt Jul 21 '16 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.