github.com
github.com favicon https://github.com/puremourning/vimspector

vim 上のデバッガ

lldb.nvim

vim-vebugger

なんか動きそうなのだが、 vimproc を使っていたので動かせなかった kaoriya 版の Vim を使うなどしてみたがよくわからず。

pyclewn

gdb と pdb のvimフロントエンド?

pubd

pythonのpdb.

vim-breakpts

vim スクリプト用?

vimspector

VSCodeの DebugAdapterProtocol を使うものらしい。

While Language Server Protocol is well known, the Debug Adapter Protocol is less well known, but achieves a similar goal: language agnostic API abstracting debuggers from clients.

動かし方よくわからず。

DebugAdapterProtocol

読む。

The “deep understanding of a language” is surfaced by the Language Server Protocol (LSP) and the “debugging support” by the Debug Adapter Protocol (DAP).

editor <=> adapter <=> gdb
||
++=====> pdb

adapterでラップして同じに見えるようにする。

adapterの起動設定は、 .vscode/launch.json にというわけか。

The Debug Adapter Protocol is not tied to VS Code and can be used as the foundation for a generic debugger UI in other development tools.

新サイトで仕様を公開していくで、って書いてあるね。

読む。

single session mode: in this mode, the development tool starts a debug adapter as a standalone process and communicates with it through stdin and stdout.

multi session mode: in this mode, the development tool does not start the debug adapter but assumes that it is already running and that it listens on a specific port for connections attempts.

DAPの仕様

DAPの実装

ネイティブコンパイルするタイプは言語ごとではなく、ネイティブコンパイルの様式ごとに違うものになる。例えば、 vc , gcc , llvm のように。

となるとVMタイプのものは、 .Net, Mono, java といった分類になるのだろうか。 C#, F# が両方デバッグできたりしそうではある。

インタープリター型はそれぞれの言語ごとになる。

あとは、リモートデバッグの事情を調べる。

native debug

c++やd, rustなんかのnativeコードを出力するものをまとめて面倒見れるという理解であったいるのかな。ビルド形式とデバッグビルドに付加される情報のフォーマットに対応してデバッガを選択する必要があると。

LLVM

.Net

Mono debugging is not supported.

ILは互換性があるにしても、VMのデバッグインタフェースは互換性が無いということなのかな。

Mono

Unity

UnityEditorにアタッチできるらしい。 Unity版のMonoにアタッチできるということかしら。

lua / ravi

こんなのあるのか・・・

powershell

python

vimspectorの実装

読む。

.\install_gadget.py

を実行することで、 VSCodeextensiondownload する。 extension に、 DAP が含まれているのでこれを使う。

autoload/vimspector.vim

function! vimspector#Launch() abort
py3 _vimspector_session.Start()
endfunction

python3/vimspector/debug_session.py

class DebugSession:
def Start():
pass

vim.bindeval を使っているので、 vim8 専用。 nvim では回避する必要がある。

.vimspector.json

{
"adapters": {
},
"configurations": {
}
}

configurations からデバッグセッションの起動方法を取得して、 デバッグアダプターを vimjobchannel 経由で起動する。 configurations.vscode/launch.json に相当するようだ。 adapters は、インストールされている DebugAdapter のリスト。

call vimspector#Launch() simple_python - launch /Users/ousttrue と入力することでjobが、アダプター開始するところまでできた。 しかし、アダプターがすぐに死んでいる様子。

アダプターを手動起動してみる。

node .\.vscode\extensions\ms-python.python-2019.4.11987\out\client\debugger\debugAdapter\main.js

.vimspector.json に書いてあるのとバージョンが違う。 file not found か。

path をなおしたら動いた😃

- "$HOME/.vscode/extensions/ms-python.python-2018.4.0/out/client/debugger/Main.js"
+ "$HOME/.vscode/extensions/ms-python.python-2019.4.11987/out/client/debugger/debugAdapter/Main.js"

neovimrplugin での構成を考えてみようか。

python3 で Adapter を起動してみる

AdapterAdapter というか AdapterBridge という感じになりそうだけど、 vim で込み入った実装をするのは手に余るので、可能な限り python で事を進めよう。 pythonでprotocl実験。

GitHub - ousttrue/daplauncher: python3 DebugAdaper Launcher
python3 DebugAdaper Launcher. Contribute to ousttrue/daplauncher development by creating an account on GitHub.
GitHub - ousttrue/daplauncher: python3 DebugAdaper Launcher favicon https://github.com/ousttrue/daplauncher
GitHub - ousttrue/daplauncher: python3 DebugAdaper Launcher

launchRequestの後で固まると思ったら、サイトに記述されていないパラメーターがあった。 console どこに書いてあるのか・・・

vscode-debugadapter-node/debugProtocol.json at main · microsoft/vscode-debugadapter-node
Debug adapter protocol and implementation for VS Code. - microsoft/vscode-debugadapter-node
vscode-debugadapter-node/debugProtocol.json at main · microsoft/vscode-debugadapter-node favicon https://github.com/Microsoft/vscode-debugadapter-node/blob/master/debugProtocol.json
vscode-debugadapter-node/debugProtocol.json at main · microsoft/vscode-debugadapter-node
Debug adapter protocol violations in 2018.12.1 · Issue #3762 · microsoft/vscode-python
Environment data VS Code version: N/A (using the debug adapter with vimspector Extension version (available under the Extensions sidebar): 2018.12.1 OS and version: macOS Mojave (10.14.1) Python ve...
Debug adapter protocol violations in 2018.12.1 · Issue #3762 · microsoft/vscode-python favicon https://github.com/Microsoft/vscode-python/issues/3762
Debug adapter protocol violations in 2018.12.1 · Issue #3762 · microsoft/vscode-python

わかった。

Cannot debug programs which read from STDIN · Issue #219 · microsoft/vscode-go
[EDIT] I think the Debugger Console cannot accept input, or in other words, work as an interactive console. Is that right? Is there an alternative, like attaching to a process? [/EDIT] I tried to d...
Cannot debug programs which read from STDIN · Issue #219 · microsoft/vscode-go favicon https://github.com/Microsoft/vscode-go/issues/219
Cannot debug programs which read from STDIN · Issue #219 · microsoft/vscode-go

vscodeの .vscode/launch.json の起動設定を launch の引数に合体するのだ。

Debugging in Visual Studio Code
One of the great things in Visual Studio Code is debugging support. Set breakpoints, step-in, inspect variables and more.
Debugging in Visual Studio Code favicon https://code.visualstudio.com/Docs/editor/debugging#_launchjson-attributes
Debugging in Visual Studio Code

書いとけよー。