More than 3 years have passed since last update.
ビルドの設定
../configure --prefix="${HOME}/.rbenv/versions/yjit" --disable-install-doc --enable-yjit=dev
--enable-yjit=dev じゃないとデバッグできないのかは未検証。
Cの設定
Settings (Workspace) > Extensions > Makefile Tools > Makefile > Make Directory: out-of-place ビルドのディレクトリを指定する
Rustの設定
Cargo.tomlの場所を自動で見つけられている気がするので何もしなくても良さそうだが、.vscode/settings.json に以下を足すと明示的にCargo.tomlを指定できる。
{"rust-analyzer.linkedProjects":["/path/to/Cargo.toml"],}LLDBの設定
CにClangを使っていない場合でもRust側でlldbが必須になるので、Cも含めてLLDBでデバッグする必要がある。
-
apt install lldbとかでLLDBをいれる。 - VSCodeにCodeLLDBという拡張をいれる。
Workspaceの設定
tasks.json の設定
${defaultBuildTask} を設定しておく。
.vscode/tasks.json
{"version":"2.0.0","tasks":[{"label":"build","type":"shell","command":"make -C .yjit-arm64 -j8","group":{"kind":"build","isDefault":true}}]}launch.json の設定
.vscode/launch.json
{"version":"0.2.0","configurations":[{"type":"lldb","name":"Run ruby","request":"launch","program":"${workspaceFolder}/.yjit-arm64/ruby","args":["--disable-gems","--yjit-call-threshold=3","/Users/k0kubun/tmp/a.rb"],"preLaunchTask":"${defaultBuildTask}"}]}後からわかったことだが、tasks.jsonとpreLaunchTaskは省略しても動くぽい。
Optional: rust-analyzerに渡るfeatureを変更
.vscode/settings.json
{"rust-analyzer.cargo.features":["disasm",],}デバッグ実行
適当にブレークポイントを足した後、Run and Debugのところで緑の三角形 (Start Debugging) を押す。
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
