]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
docs: Fix vscode debugging section in HACKING.md
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 21 Mar 2023 15:06:15 +0000 (16:06 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 21 Mar 2023 17:47:51 +0000 (17:47 +0000)
Let's account for the recent changes in mkosi in the debugging
with vscode section.

docs/HACKING.md

index 0adf5ada5470d2f26819ca19f288c213d6c51a67..a7ddfc0ca8eb6f857a2611b39fba26bafe4b4d3b 100644 (file)
@@ -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
                 }