diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-03-21 16:06:15 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-03-21 18:47:51 +0100 |
commit | c84d14c52521f95752c9f5643854e9e836df38b9 (patch) | |
tree | 911e2c8630f972d58e5a61f41930e8d562c69200 /docs/HACKING.md | |
parent | udev-rules: fix nvme symlink creation on namespace changes (diff) | |
download | systemd-c84d14c52521f95752c9f5643854e9e836df38b9.tar.xz systemd-c84d14c52521f95752c9f5643854e9e836df38b9.zip |
docs: Fix vscode debugging section in HACKING.md
Let's account for the recent changes in mkosi in the debugging
with vscode section.
Diffstat (limited to 'docs/HACKING.md')
-rw-r--r-- | docs/HACKING.md | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/docs/HACKING.md b/docs/HACKING.md index 0adf5ada54..a7ddfc0ca8 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -215,24 +215,25 @@ vscode documentation [here](https://code.visualstudio.com/docs/cpp/launch-json-r ## Debugging systemd with mkosi + vscode To simplify debugging systemd when testing changes using mkosi, we're going to show how to attach -[VSCode](https://code.visualstudio.com/)'s debugger to an instance of systemd running in a mkosi image -(either using QEMU or systemd-nspawn). +[VSCode](https://code.visualstudio.com/)'s debugger to an instance of systemd running in a mkosi image using +QEMU. To allow VSCode's debugger to attach to systemd running in a mkosi image, we have to make sure it can access -the container/virtual machine spawned by mkosi where systemd is running. mkosi makes this possible via a -handy SSH option that makes the generated image accessible via SSH when booted. Thus you must build -the image with `mkosi --ssh`. The easiest way to set the -option is to create a file 20-local.conf in mkosi.default.d/ (in the directory you ran mkosi in) and add -the following contents: +the virtual machine spawned by mkosi where systemd is running. mkosi makes this possible via a handy SSH +option that makes the generated image accessible via SSH when booted. Thus you must build the image with +`mkosi --ssh`. The easiest way to set the option is to create a file 20-local.conf in mkosi.conf.d/ (in the +directory you ran mkosi in) and add the following contents: ``` [Host] Ssh=yes ``` -Next, make sure systemd-networkd is running on the host system so that it can configure the network interface -connecting the host system to the container/VM spawned by mkosi. Once systemd-networkd is running, you should -be able to connect to a running mkosi image by executing `mkosi ssh` in the systemd repo directory. +Also make sure that the SSH agent is running on your system and that you've added your SSH key to it with +`ssh-add`. + +After rebuilding the image and booting it with `mkosi qemu`, you should now be able to connect to it by +running `mkosi ssh` from the same directory in another terminal window. Now we need to configure VSCode. First, make sure the C/C++ extension is installed. If you're already using a different extension for code completion and other IDE features for C in VSCode, make sure to disable the @@ -270,11 +271,11 @@ the directory, and add the following contents: }, "MIMode": "gdb", "sourceFileMap": { - "/root/build/../src": { + "/work/build/../src": { "editorPath": "${workspaceFolder}", "useForBreakpoints": false }, - "/root/build/*": { + "/work/build/*": { "editorPath": "${workspaceFolder}/mkosi.builddir", "useForBreakpoints": false } |