-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating to support Python3 #1
Open
67hz
wants to merge
6
commits into
lldb-tools:master
Choose a base branch
from
67hz:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
vim-lldb | ||
======== | ||
|
||
LLDB debugging in Vim. | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
### Using [vim-plug](https://github.com/junegunn/vim-plug) | ||
|
||
```vim | ||
Plug 'lldb-tools/vim-lldb' | ||
``` | ||
|
||
### Using [vundle](https://github.com/VundleVim/Vundle.Vim) | ||
|
||
```vim | ||
Plugin 'lldb-tools/vim-lldb' | ||
``` | ||
|
||
System Requirements | ||
------------------- | ||
|
||
- Vim 8.2 or above | ||
- Have [Python or Python 3 support enabled in Vim](#verifying-python-support)* | ||
|
||
*Vim can only be compiled with support for a single version of Python. It is recommended to use Python 3 as many Vim plugins only work with Python 3 support in Vim. | ||
|
||
vim-lldb Commands | ||
-------- | ||
|
||
| Command | List | | ||
| --- | --- | | ||
| `:help lldb` | plugin specific documentation | | ||
| `:Lhelp` | LLDB's built-in help system (i.e lldb 'help' command) | | ||
| `:Lscript help (lldb)` | Complete LLDB Python API reference | | ||
| `:L<tab>` | tab completion through all LLDB commands | | ||
|
||
|
||
|
||
LLDB Commands | ||
------------- | ||
|
||
All LLDB commands are available through `:L<lldb_command>`. Using lldb's documentation at `:Lhelp` along with `:L<tab>` tab completion for all available LLDB commands is a good place to start. Remember to prepend all commands with `:L`. | ||
For example: | ||
|
||
```vim | ||
" set a target file | ||
:Ltarget ./path/to/file | ||
" set a breakpoint under cursor | ||
:Lbr | ||
" run debugger | ||
:Lrun | ||
" get help for continue command | ||
:Lhelp continue | ||
``` | ||
|
||
Example commands: | ||
|
||
|
||
| Command | Function | | ||
| --- | --- | | ||
| `:Ltarget file` | specify target file | | ||
| `:Lsettings set target.input-path <file>` | specify file input (exec < file) | | ||
| `:Lbr` | set breakpoint under cursor | | ||
| `:Lrun` | run | | ||
| `:Lstep` | source level single step in current thread | | ||
| `:Lnext` | source level single step over in current thread | | ||
| `:Lthread step-in` | instruction level single step in current thread | | ||
| `:Lthread step-over` | instruction level single step-over in current thread | | ||
| `Lcontinue` | Continue execution of all threads in the current process. | | ||
| `:Lfinish` | step out of currently selected frame | | ||
| `:Lthread return <RETURN EXPRESSION>`| return immediately from currently selected frame with optional return value | | ||
| `:Lthread select 1`| select thread 1 as default thread for subsequent commands | | ||
| `:Lbt all` | thread backtrace all | | ||
| `:Lfr v` | show args and local vars for current frame | | ||
| `:Lfr v -f x bar` | show contents of variable `bar` formatted as hex | | ||
| `:Lfr v -f b bar` | same as above with binary formatting | | ||
| `:Lregister read` | show the general purpose registers for current thread | | ||
| `:Lregister read rax rsp` | show the contents of rax, rsp | | ||
| `:Lregister write rax 123` | write `123` into rax | | ||
| `:Ldisassemble --name main` | disassemble any functions named `main` | | ||
| `:Ldisassemble --line` | disassemble current source line for current frame | | ||
| `:Ldisassemble --mixed` | disassemble with mixed mode | | ||
|
||
|
||
|
||
For a complete list of commands, see [gdb to lldb map](https://lldb.llvm.org/use/map.html) | ||
|
||
|
||
Customization | ||
------------- | ||
|
||
### Global options | ||
|
||
|
||
```vim | ||
" add custom path to lldb | ||
let g:lldb_path="/absolute/path/to/lldb" | ||
``` | ||
|
||
```vim | ||
" enable lldb, default is 1 {enable}, 0 {disable} | ||
let g:lldb_enable = 1 | ||
``` | ||
|
||
```vim | ||
" set lldb to async, default is 1 {async}, 0 {sync} | ||
let g:lldb_async = 1 | ||
``` | ||
|
||
```vim | ||
" set lldb console output color | ||
:hi lldb_output ctermfg=green ctermbg=NONE guifg=green guibg=NONE | ||
" set breakpoint color | ||
:hi lldb_breakpoint ctermfg=white ctermbg=DarkGray guifg=white guibg=DarkGray | ||
``` | ||
|
||
|
||
Verifying Python Support | ||
------------------------ | ||
|
||
This plugin leverages the `LLDB` module which requires Python support in Vim. Vim's Python version must match `LLDB`'s Python interpreter version exactly. | ||
|
||
To verify Vim's Python support, run: | ||
|
||
vim --version | grep python | ||
|
||
The output must contain either `+python` or `+python3` indicating support for Python 2 or Python 3, respectively. It is recommended to use Vim compiled with Python 3 as many Vim plugins only support this option. | ||
|
||
If Vim warns that it is unable to load vim-lldb on launch, there may be mismatched versions of Python running between `LLDB` and Vim's Python interpreter. Versions must match exactly. To verify Vim's exact Python version, launch Vim and run: | ||
|
||
:pyx << EOF | ||
import sys | ||
print(sys.version) | ||
EOF | ||
|
||
" verify this version matches lldb's output below | ||
3.7.6 (default, ...) | ||
|
||
|
||
|
||
Verify LLDB's version of Python by launching the Python interpreter in LLDB: | ||
|
||
$> lldb | ||
(lldb) script | ||
Python Interactive Interpreter | ||
>>> import sys | ||
>>> print(svs.version) | ||
3.7.6 (default, ...) | ||
|
||
|
||
If Python versions are mismatched, either recompile Vim to match the exact version as LLDB or vice-versa. See [lldb caveats](https://lldb.llvm.org/resources/caveats.html) for details. | ||
|
||
See [Customization](#customization) for specifying lldb path in `vimrc`. | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/svs/sys/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also make this a one-liner:
lldb -b -o "script import sys; print(sys.version)"