Bram Moolenaar | 779b74b | 2006-04-10 14:55:34 +0000 | [diff] [blame] | 1 | *debug.txt* For Vim version 7.0d. Last change: 2005 Dec 17 |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
| 5 | |
| 6 | |
| 7 | Debugging Vim *debug-vim* |
| 8 | |
| 9 | This is for debugging Vim itself, when it doesn't work properly. |
Bram Moolenaar | acf5345 | 2005-12-17 22:06:52 +0000 | [diff] [blame] | 10 | For debugging Vim scripts, functions, etc. see |debug-scripts| |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 11 | |
| 12 | 1. Location of a crash, using gcc and gdb |debug-gcc| |
| 13 | 2. Windows Bug Reporting |debug-win32| |
| 14 | |
| 15 | ============================================================================== |
| 16 | |
| 17 | 1. Location of a crash, using gcc and gdb *debug-gcc* |
| 18 | |
| 19 | When Vim crashes in one of the test files, and you are using gcc for |
| 20 | compilation, here is what you can do to find out exactly where Vim crashes. |
| 21 | This also applies when using the MingW tools. |
| 22 | |
| 23 | 1. Compile Vim with the "-g" option (there is a line in the Makefile for this, |
| 24 | which you can uncomment). |
| 25 | |
| 26 | 2. Execute these commands (replace "11" with the test that fails): > |
| 27 | cd testdir |
| 28 | gdb ../vim |
| 29 | run -u unix.vim -U NONE -s dotest.in test11.in |
| 30 | |
| 31 | 3. Check where Vim crashes, gdb should give a message for this. |
| 32 | |
| 33 | 4. Get a stack trace from gdb with this command: > |
| 34 | where |
| 35 | < You can check out different places in the stack trace with: > |
| 36 | frame 3 |
| 37 | < Replace "3" with one of the numbers in the stack trace. |
| 38 | |
| 39 | ============================================================================== |
| 40 | |
| 41 | 2. Windows Bug Reporting *debug-win32* |
| 42 | |
| 43 | If the Windows version of Vim crashes in a reproducible manner, |
| 44 | you can take some steps to provide a useful bug report. |
| 45 | |
| 46 | First, you must obtain the debugger symbols (PDB) file for your executable: |
| 47 | gvim.pdb for gvim.exe, or vim.pdb for vim.exe. It should be available |
| 48 | from the same place that you obtained the executable. Be sure to use |
| 49 | the PDB that matches the EXE. |
| 50 | |
| 51 | If you built the executable yourself with the Microsoft Visual C++ compiler, |
| 52 | then the PDB was built with the EXE. |
| 53 | |
| 54 | You can download the Microsoft Visual C++ Toolkit from |
| 55 | http://msdn.microsoft.com/visualc/vctoolkit2003/ |
| 56 | This contains the command-line tools, but not the Visual Studio IDE. |
| 57 | |
| 58 | The Debugging Tools for Windows can be downloaded from |
| 59 | http://www.microsoft.com/whdc/devtools/debugging/default.mspx |
| 60 | This includes the WinDbg debugger. |
| 61 | |
| 62 | If you have Visual Studio, use that instead of the VC Toolkit |
| 63 | and WinDbg. |
| 64 | |
Bram Moolenaar | acf5345 | 2005-12-17 22:06:52 +0000 | [diff] [blame] | 65 | For other compilers, you should always use the corresponding debugger: TD for |
| 66 | a Vim executable compiled with the Borland compiler; gdb (see above |
| 67 | |debug-gcc|) for the Cygwin and MinGW compilers. |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 68 | |
| 69 | ========================================================================= |
| 70 | vim:tw=78:ts=8:ft=help:norl: |