dbgx / lldb.nvim Goto Github PK
View Code? Open in Web Editor NEWDebugger integration with a focus on ease-of-use.
License: Other
Debugger integration with a focus on ease-of-use.
License: Other
make
)Note: Striked-out points are irrelevant due to the generic design of configuration file.
Inspired from suggestions by @tarruda
First of all, thank you for this awesome plugin!
One inconvenience I noticed is that the log window does not scroll to bottom automatically in all cases. When a new message comes in, the log window scrolls to bottom as expected if the focus is on the log window itself. However, if the focus is on any other window (for example the code window, which gets the focus during most of the workflow), the log window won't scroll to bottom automatically.
Currently I am using NVIM 0.1.4 installed from Homebrew. (I am on MacOSX.)
Thanks again!
processPendingEvents
with a separate threaded event loopIdeas (as extension to #7):
Is there currently a way to detect what mode (debug or code) nvim is in?
I would like to have different keybindings depending on the mode.
I've installed neovim manually from master, the python-client via pip, and now lldb.nvim gives me the following error if I try to run :UpdateRemotePlugins
Encountered AttributeError loading plugin at /home/psirus/.config/nvim/plugged/lldb.nvim/rplugin/python/lldb_nvim: 'CompatibilitySession' object has no attribute '_session'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/neovim/plugin/host.py", line 121, in _load
self._discover_classes(module, handlers, path)
File "/usr/local/lib/python2.7/dist-packages/neovim/plugin/host.py", line 151, in _discover_classes
plugin = cls(self._configure_nvim_for(cls))
File "/home/psirus/.config/nvim/plugged/lldb.nvim/rplugin/python/lldb_nvim/__init__.py", line 17, in __init__
self.ctrl = Controller(VimX(vim))
File "/home/psirus/.config/nvim/plugged/lldb.nvim/rplugin/python/lldb_nvim/vim_x.py", line 9, in __init__
self._vim_test = not self._vim.session._session._is_running
AttributeError: 'CompatibilitySession' object has no attribute '_session'
Trying to get this plugin working with the system python on OS X 10.11.4. Neovim is installed via homebrew with the version being NVIM 0.1.3-dev
.
Running test/run.sh
hangs with the last log message
[CRITICAL @ controller.py:safe_call:84] 2327 - Event Loop Thread is probably dead!
Currently being lazy so I modified run.sh
to be
#!/bin/bash
set -e
TEST_DIR=$( /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python -c "from os.path import realpath
print realpath(\"$(dirname "$0")\")" ) # resolve symlinks
cd "$TEST_DIR"
gcc -g -o ab ab.c
nvim -c 'e term:///System/Library/Frameworks/Python.framework/Versions/2.7/bin/python\ -i\ test.py'
To provide some more details I started by following http://blog.rplasil.name/2016/03/how-to-debug-neovim-python-remote-plugin.html.
The section in my init.vim
for setting the python interpreter is
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
let g:python_host_prog = '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python'
endif
endif
I can echo that variable and it prints out just fine. I followed the instructions listed on that page for installing the neovim module. Launching that interpreter directly I get
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lldb
>>> import neovim
>>>
This is what my system site-packages directory looks like
[/Library/Python/2.7/site-packages]
λ l
total 296
-rw-r--r-- 1 root wheel 119B 23 Oct 20:22 README
-rw-r--r-- 1 root wheel 434B 16 Apr 12:33 easy-install.pth
drwxr-xr-x 4 root wheel 136B 16 Apr 11:26 futures-3.0.5-py2.7.egg
drwxr-xr-x 6 root wheel 204B 16 Apr 11:26 greenlet-0.4.9-py2.7-macosx-10.11-intel.egg
-rw-r--r-- 1 root wheel 141K 16 Apr 11:26 msgpack_python-0.4.7-py2.7-macosx-10.11-intel.egg
drwxr-xr-x 4 root wheel 136B 16 Apr 11:26 neovim-0.1.7-py2.7.egg
drwxr-xr-x 4 root wheel 136B 16 Apr 11:26 trollius-2.1-py2.7.egg
I have PYTHONPATH
set directly in my shell to
/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python
And I can run lldb -P
which outputs
/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python
Note that I had to install the six
module with
sudo /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python -m easy_install six
otherwise lldb -P
would complain about that missing module.
Finally, I couldn't see any discrepancies while installing the plugin and UpdateRemotePlugins
seems to exit cleanly. Here is a screenshot of what test/run.sh
looks like
Just thought you would like to know that a fork is mentioned instead.
For rust, do you use rust-lldb instead of lldb if it's installed ?
https://michaelwoerister.github.io/2015/03/27/rust-xxdb.html
Currently selected and unselected pc lines overloads the same highlighting group for the both line and the sign text. I propose these be separated into two different groups as follows:
sign define llsign_pcsel text=-> linehl=LLSelectedPCLine texthl=LLSelectedPCSign
Additionally, I propose the addition of a highlighting group for breakpoint signs:
sign define llsign_bpres text=B> texthl=LLBreakpointSign
If you see the value, I will gladly implement this.
so that eg. Debian can decide whether they can package your plugin.
Thank you!
Ability to
I have just touched vim. My English is not very good, please feel free to laugh at me.
I used lldb.nvim to debug multithreaded code when there was a bug.
First, I use the "thread select" command to select a thread, and then enter the "LL next" command, lldb.nvim will automatically switch to the main thread. I have to choose my target thread over and over again.
After testing, this bug does not appear to use lldb directly.
I captured a video as follows:
I have a weird issue where whenever I use the LLBreakSwitch command/mapping the breakpoint is placed on the line below the current cursor location. Well the breakpoint pointer / B-> character is in the wrong place but the actual lldb output shows the correct line number!?
I'm also finding that I am unable to use LL print and just receive an lldb error: use of undeclared identifier.
Any ideas ?
Other than these issues the plugin looks really promising and I'm keen to get things up and running.
I get an LLDB error:
→ (lldb) target create ...
✓ Current executable set to '...' (x86_64).
→(lldb) process launch
✓ Process 90358 launched: ...' (x86_64)
→ (lldb) process interrupt
✗error: Failed to halt process: Process is not running.
This does not happen if I set a breakpoint somewhere, make the process hit it and then try again.
NVIM v0.2.2
lldb.nvim commit: dec080a
I used Vundle to install this plugin, but LLsession is not recognized as an editor command when I open a cpp file that I compiled as part of clang++ -std=c++14 -Wall -Wextra -pedantic -g -glldb *.cpp
Running :command
shows that no LL commands are registered. Is this plugin not compatible with Vundle?
Edit: Forgot to mention I am running neovim v0.2.2
Ability to
Proposed syntax:
let g:lldb#symbol#breakpoint = "○"
let g:lldb#symbol#program_counter = "●"
See syntastic style configuration:
let g:syntastic_error_symbol = "››"
Currently this can be achieved by redefining the signs in a ~/.vim/after/plugin file. If you see the value, I would be happy to implement this.
I'm looking for a way to troubleshoot a basic problem. Neovim doesn't seem to know any of LL commands. When trying to call :LLsession, for example, I get 'not an editor command'. I use vim-plug and it seems to source lldb.nvim. I have a python 2 client installed and I can use other python 2 plugins like clang_complete without any issue. The lldb plugin is up to date. I have added an echo to the main plugin vim file after initial check and I can see it when neovim starts.
What can be done to further troubleshoot this issue?
Separate out LLDB-specific logic and define a debugger-generic event-based interface. This will enable adding support for other debuggers using output parsing (e.g. GDB support can be added by borrowing parser code from Conque-GDB).
(The plugin name along with :LL
-prefix of commands may have to be changed, after adding support for more debuggers.)
Basically, these 3 files have to be re-implemented:
autoload/lldb/remote.vim
: This is responsible for sending all events to the backend. This needs to be replaced with something which encodes these events in json and sends it to backend.rplugin/python/lldb_nvim/__init__.py
: This is the listener in the backend. This needs to be replaced with a listener which understands json from remote.vim
.rplugin/python/lldb_nvim/vim_x.py
: This in the backend is what tells Neovim to take all sorts of actions. This needs to be replaced with:
Note: There is only one RPC-like interaction from Neovim where it waits for a "response" for a "request" it sent and that is for auto-completion. Everything else is event-based, that is Neovim gets notified of stuff from backend. But RPC-like calls from the backend to Neovim are used extensively (wherever you see async=False
and use of a Queue
in vim_x.py
like this).
PS: I'm not planning on implementing this. If anyone is interested, I would be happy to help.
Command 'frame variable' (so as the locals buffer) always shows that 'size = 0', while it works well with command 'display vec'.
I test with the run.sh, and here is the report:
Note: :LL-
commands are not bound with this test instance
error: libc.so.6 0x003de11b: DW_TAG_variable has an invalid location:
DW_OP_lit13
DW_OP_const8s(0x0000000000000000)
After running :LLsession new
, there is no lldb-nvim.json
file to be found in the current folder, nor in my whole home directory. Running :LLsession show
shows me a buffer with the expected content, which hasn’t be written to disk yet. If I save it manually, it will save the session to disk.
I thought it could be due to having set hidden
in my config file, but removing it did not help. AFAIR, I already had the same issue when I tried lldb.nvim a year ago.
lldb.nvim: HEAD at 222c770
Neovim: 0.1.6
Python2: 2.7.12
python2-neovim-client: 0.1.10
Neovim config file: https://gist.github.com/pierremoreau/1fa99bdda563f7e4e6753e9dbae06613
(Distribution: Arch Linux)
It seems completely random if target.source-map
is picked up or not. Source code is not opened in the main window most of the time. All LL
commands that output source to the log work like expected.
with tab-completion and persistent history
Hi
I recently installed this plugin for debugging rust.
But it did not work.
here's my process:
LLsession new
LLmode debug( and process launch)
Then execute some LL commands ( LL r, LL c , etc...)
But some LL commands does'nt work. and I can't see any responses.
Furthermore, EventLoopError happened when LL commands are executed about 3 times to 4 times.
here's error message.
error caught in async handler 'exec ('continue',)'
Traceback (most recent call last):
File "/home/qwerty2501/.cache/dein/repos/github.com/critiqjo/lldb.nvim/rplugin/python/lldb_nvim/__init_
_.py", line 49, in _exec
self.ctrl.safe_execute(args)
File "/home/qwerty2501/.cache/dein/repos/github.com/critiqjo/lldb.nvim/rplugin/python/lldb_nvim/control
ler.py", line 101, in safe_execute
self.safe_call(self.exec_command, [cmd])
File "/home/qwerty2501/.cache/dein/repos/github.com/critiqjo/lldb.nvim/rplugin/python/lldb_nvim/control
ler.py", line 94, in safe_call
raise EventLoopError("Dead event loop!")
EventLoopError: Dead event loop!
My environments:
OS : Ubuntu 17.0.4
neovim:0.1.7
python:2.7
when i try to do for example:
LLtarget create /bin/ls
i get the following error:
Error detected while processing function remote#define#FunctionBootstrap..remote#host#Require..26_RequirePythonHost:
line 21:
E605: Exception not caught: Failed to load Python host. You can try to see what happened by starting Neovim with the environment variable $NVIM_PYTHON_LOG_FILE set to a file and opening the generated log file. Also, the host stderr will
be available in Neovim log, so it may contain useful information. See also ~/.nvimlog.
Error detected while processing function remote#define#FunctionBootstrap..remote#host#Require:
line 10:
E171: Missing :endif
nvim-python-log:
2015-08-03 08:44:33,931 [ERROR @ host.py:_load:91] 51737 - Encountered import error loading plugin at /home/brix/.vim/plugged/lldb.nvim/rplugin/python/lldb_nvim.py
2015-08-03 08:44:33,932 [ERROR @ session.py:run:108] 51737 - Setup error: local variable 'module' referenced before assignment
I did the UpdateRemotePlugins, when i do it again now, i get:
Vim(if):Channel was closed by the client
Error detected while processing function 26_UpdateRemotePlugins..26_RegistrationCommands..remote#host#Require..26_RequirePythonHost:
line 21:
E605: Exception not caught: Failed to load Python host. You can try to see what happened by starting Neovim with the environment variable $NVIM_PYTHON_LOG_FILE set to a file and opening the generated log file. Also, the host stderr will
be available in Neovim log, so it may contain useful information. See also ~/.nvimlog.
Error detected while processing function 26_UpdateRemotePlugins..26_RegistrationCommands..remote#host#Require:
line 10:
E171: Missing :endif
Error detected while processing function 26_UpdateRemotePlugins:
line 5:
E171: Missing :endif
In https://github.com/dbgx/lldb.nvim/blob/master/rplugin/python/lldb_nvim/__init__.py#L44, if LL is called with no arguments it may cause an out-of-bounds error. I suggest to check for this case and to emit a more helpful error message.
A session created by the plugin is default.
I run it as
:LLsession load
:LLmode debug
:LL r
Default breakpoint (breakpoint set -n main) with no shared libraries. Cursor changes from 'B>' to '->'.
thread #1: tid = 0x22a109, 0x0000000100000f6d test`main(argc=1, argv=0x00007fff5fbff7a0) + 29 at main.c:5, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000f6d test`main(argc=1, argv=0x00007fff5fbff7a0) + 29 at main.c:5
frame #1: 0x0000000100134255 libdyld.dylib`start + 1
Same breakpoint with a shared library. Cursos remains 'B>' and if I use a step-over then it goes to a next line after breakpoint and changes to '->'
thread #1: tid = 0x22b2b9, 0x000000010001185e dyld`gdb_image_notifier(dyld_image_mode, unsigned int, dyld_image_info const*) + 1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x000000010001185e dyld`gdb_image_notifier(dyld_image_mode, unsigned int, dyld_image_info const*) + 1
frame #1: 0x000000010001158b dyld`notifyGDB(dyld_image_states, unsigned int, dyld_image_info const*) + 40
frame #2: 0x0000000100007e37 dyld`dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) + 943
frame #3: 0x0000000100012a95 dyld`ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, bool, ImageLoader::RPathChain const&, char const*) + 101
Besides if I use a step-over and cursor is set on a line with a function which is located in a shared library then execution continues to the end without stopping on a next line after breakpoint as it should be. If i use step-into instead it works as it should.
I tried both scenarios in a terminal lldb and in a python shell (as described here http://lldb.llvm.org/python-reference.html) and they works just fine.
Due to the new SIP
mechanism of El capitan, I installed another python via homebrew. However, when I import the Xcode's lldb library, fatal error is reported.
The editor, backtrace and locals windows do not update automatically after a breakpoint stop.
I have to interact with lldb to trigger the update, for example, :LL print something
. (even if something
does not exist)
Is this the expected behavior? Or is there any option to tweak it? Thanks!
It will be nice if there is a terminal, so that I can use gdb command directly.
:e foo.cpp
:vsp
:terminal
:Lsession new
As a result from :messages
E315: ml_get: invalid lnum: 9
E315: ml_get: invalid lnum: 9
E315: ml_get: invalid lnum: 9
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 73:
E315: ml_get: invalid lnum: 42
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 73:
E315: ml_get: invalid lnum: 42
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
Error detected while processing function <SNR>43_Highlight_Matching_Pair:
line 92:
E315: ml_get: invalid lnum: 40
New session created!
Without terminal works fine.
The reason for choosing abspath
was because breakpoints did not seem to work while debugging Rust programs (back when Rust was 1.0 or 1.1). Need to reinvestigate.
This would be extremely useful, instead of keeping it all in the log buffer, allow attaching the debugged process to a proper terminal buffer.
There are many upstream bugs in LLDB's Python API that haven't been fixed for years. All the issues reported to this repo that got identified as upstream bugs were marked with a label. If you find more, you are welcome to describe it in a comment below.
Running :UpdateRemotePlugins
throws the error:
function remote#host#UpdateRemotePlugins[6]..<SNR>40_RegistrationCommands[15]..remote#host#Require[13
]..provider#pythonx#Require, line 14
Vim(let):E902: "" is not an executable
function remote#host#UpdateRemotePlugins[6]..<SNR>40_RegistrationCommands[15]..remote#host#Require[13
]..provider#pythonx#Require, line 21
Vim(for):E121: Undefined variable: channel_id
remote/host: generated rplugin manifest: /Users/revolt/.local/share/nvim/rplugin.vim
I tried multiple solutions from existing issues to no avail.
I'm using lldb to debug an ncurses application, and because the debugged process' output is thrown in the logs
buffer — and input looks like it's ignored, it's impossible to interact with the application.
Would it be possible to have lldb.nvim have a :term
like interface where it'd run the UI of that kind of application?
Is it possible to load coredumps? Can't seem to find a way to do so. From what I can see neither lldb-server
or gdbserver
supports it.
For some time, I've been wanting to transfer the maintainership to anyone else who is interested enough, due to lack of time in my hands. At the same time, I imagine that a common wrapper API can be developed for debugger extensions in general. So toward those ends, I believe creating an organization would be the right action to take for now.
I just created dbgx org and am planning to move the repository to it by the end of May. If anyone has any comments or suggestions, please raise it here.
Hi, thanks for this awesome plugin.
I have installed the plugin via vim-plug
and ran ./run.sh
under test
with no errors.
However, whenever I try to debug a less trivial program, I get the following:
After process launch
and stopping at main()
, whenever I try to use any of the plugin's capabilities (e.g. autocomplete a command) I get:
Error detected while processing function <SNR>35_llcomplete:
line 2:
Invalid channel "2"
if I try, for example, :LL process kill
I get
Error detected while processing function <SNR>35_llnotify:
line 5:
E475: Invalid argument: Channel doesn't exist
It seems that after the first breakpoint, the rpc channel somehow becomes invalid...
I have built a very recent nvim version from master (version 0.1.3-364). I have also tried with the ppa version (0.1.3-dev), but no luck either. I am uisng lldb-3.6. I don't have the python3 neovim package and the :UpdateRemotePlugins
command yields no errors.
Hope you can help, really looking forward to getting this to run properly.
I have set the homebrew installed python as the default python interpreter in my MAC OSX. However, lldb.vim seems uncompatible with it because of that lldb python module can only be used with the python which is shipped with system.
I hope there could be an option that allows me to select which version python to run. In that way, the vim runtime python can be separated from the python lldb.nvim works with.
Setting a breakpoint with the :LL breakpoint set
command doesn't update the gutter line with the default B>
symbol. I recorded an asciinema here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.