The default compiler in Mac is clang/clang++
That's why debugger chose Lldb.
Want to use with Macvim together, so found the vim-lldb this plugin, quite powerful
?
This plugin supports Vundle, so it's easier to install.
But I found in the installation process vim hints Python Fatal error,
I finally found out that I used brew to install a third-party python,
So there are two python in the system: Native Python and third-party python, causing the error
The solution is to uninstall or unlink, with a brew-mounted python
Brew Uninstall Python
Or
Brew Unlink Python
Note that this may cause problems with your other programs that are compiled by third parties, so be cautious.
The worst case scenario is to compile the python again with the system's own ... 233333
?
How to use:
1. In terminal, the CPP file is compiled with debug mode, and the A.out file is generated by default
clang++-G test.cpp
2. Open the Test.cpp file with Vim/macvim and specify the target executable file
Vim Test.cpp
In Vim, enter
: Ltarget a.out
It will then mediate a bunch of windows, including locals, breakpoints and so on.
3. In Vim, enter
: Lstart
Start debugging, this time, because you do not set a breakpoint, so the program ran out
4. In vim, where you need to set a breakpoint, enter
: Lbreakpoint
You can set a breakpoint at the cursor position.
5. Re-execute: The Lstart command can be stopped at the breakpoint.
?
The shortcut keys I defined in the. vimrc file are as follows
" vim-lldb Settings
let g:lldb_map_Lstart = “<F5>"
let g:lldb_map_Lcontinue = “<F6>"
let g:lldb_map_Lbreakpoint = “<F9>"
let g:lldb_map_Lnext = “<F10>"
let g:lldb_map_Lstep = “F11"
?
Other commands to see the help in vim: he lldb
?
?
?
OSX Macvim + vim-lldb configuration and usage experience