Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capture Vim's error output before it crashes

This is related to debugging the issue mentioned in: Plugin (vim-latex) crashing gVim on startup

After installing latex-suite, every time I open a .tex file, whether it's from gVim or terminal vim, whether it contains a \begin statement or not, Vim immediately crashes.

After repeatedly making it crash I was able to read a Python Traceback string in the status line, which mentioned line 530 in C:\Python27\lib\site.py (which only contains known_paths = addusersitepackages(known_paths)), but the rest of the traceback is not viewable since the statusline display truncates it and this only appears for a moment anyway before automatically crashing.

Is there a way I could capture this Traceback output in a more permanent and complete way, along with how things go from this plugin to Python, etc.?

(I tried the -V15filename.log option but it's (as usual) useless, containing some partial log upto an ancient point in the vim startup process.)

Edit: Apologies for not mentioning the OS previously (other than indirectly through the C:\ path), this problem is on Windows. And from the other linked question it seems like almost everyone who tries latex-suite on Windows runs into this problem.

Update: Just a FTR - setting verbosefile doesn't help (presumably because the writes are buffered per the doc), and :redir doesn't capture this either, ends with whatever operation happened before this error and crash.

like image 258
Sundar R Avatar asked Jan 20 '14 02:01

Sundar R


3 Answers

OK, I put here as an answer.

This answer could be kind of work around for solving your latex plugin problem in windows vim. However if your question sticks to "getting error message before crashing" , it may not give you help. I don't have much experience with windows OS.

Latex Suite plugin uses python to generate some formatted text. It could bring better performance. However the plugin provides no-python ways for that as well, to let user without installing python runtime or with very old python version use the plugin too.

Since you mentioned that your problem was in python codes. You can try disabling python in that plugin, and test if the performance was acceptable.

The plugin provided a variable for that, you could add this line in your vimrc

let g:Tex_UsePython=0

Nice to see it helped.

like image 60
Kent Avatar answered Nov 11 '22 18:11

Kent


Did you try to run with redirected stderr?

vim file.tex &> errors.log

or

vim file.tex 2> errors.log
like image 1
Daniel W. Avatar answered Nov 11 '22 16:11

Daniel W.


1) If you are able to compile Vim from the source (using MinGW as you are on Windows), you could run it with gdb. Then you could set some breakpoints/check the stack trace until you detect a line near the crash. The instructions to run Vim with the gdb and read the stack traces are found in :help debug-gcc.

At the end of that help file (:help get-ms-debuggers) you can find instructions on how to obtain some debug tools for Windows.

These tools can be used on the following alternatives, explained in detail on :help debug-win32:

2) In case you didn't compile Vim, obtain the debug symbols (PDB), which should be available from the same place that you obtained the executable. Attach Visual Studio to the Vim process, reproduce the crash, then read the stack trace through Visual Studio's dialog reporting the crash.

3) Same as 2) but using WinDbg instead of Visual Studio.

4) Inspect the Minidump file, in case your crash generate one. In addition to the referenced help section, you may find useful information on the following links:

  • Where to find mini dmp files in windows 7
  • How to read the small memory dump file
like image 1
mMontu Avatar answered Nov 11 '22 16:11

mMontu