]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Update debugging with vscode section
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 15 Apr 2024 20:28:11 +0000 (22:28 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 16 Apr 2024 13:25:34 +0000 (15:25 +0200)
- We have ssh-generator now, so need for mkosi's Ssh= option anymore.
- By enabling RuntimeBuildSources= by default, we don't need the gdb
  config file in the image anymore, since the build and source
  directories will be mounted at the expected locations.

docs/HACKING.md
mkosi.conf
mkosi.images/system/mkosi.extra/usr/share/factory/mkosi/gdbinit.d/systemd.gdb [deleted file]
mkosi.images/system/mkosi.finalize

index 2a58780fbf513003b7df2ca7133374fb8af81d4d..569f81ab0ba09f4401f7d0a17b3512edd116c0bd 100644 (file)
@@ -276,22 +276,9 @@ To simplify debugging systemd when testing changes using mkosi, we're going to s
 QEMU.
 
 To allow VSCode's debugger to attach to systemd running in a mkosi image, we have to make sure it can access
-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 `mkosi.local.conf` in the root of the
-repository and add the following contents:
-
-```
-[Host]
-Ssh=yes
-RuntimeTrees=.
-```
-
-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`. Also make sure that `virtiofsd` is installed.
-
-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.
+the virtual machine spawned by mkosi where systemd is running. After booting the image 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
@@ -320,16 +307,12 @@ the directory, and add the following contents:
             "name": "systemd",
             "pipeTransport": {
                 "pipeProgram": "mkosi",
-                "pipeArgs": [
-                    "-C",
-                    "/path/to/systemd/repo/directory/on/host/system/",
-                    "ssh"
-                ],
+                "pipeArgs": ["-C", "${workspaceFolder}", "ssh"],
                 "debuggerPath": "/usr/bin/gdb"
             },
             "MIMode": "gdb",
             "sourceFileMap": {
-                "/root/src/systemd": {
+                "/work/src": {
                     "editorPath": "${workspaceFolder}",
                     "useForBreakpoints": false
                 },
index 96843db488149a85ac1d417cb6962b8c933aafea..ee7fa6e2a48d1b65319bc8e8b7415b2ee5a6d30d 100644 (file)
@@ -20,6 +20,7 @@ BuildSourcesEphemeral=yes
 [Host]
 @Incremental=yes
 @RuntimeSize=8G
+@RuntimeBuildSources=yes
 ToolsTreePackages=virtiofsd
 KernelCommandLineExtra=systemd.crash_shell
                        systemd.log_level=debug,console:info
diff --git a/mkosi.images/system/mkosi.extra/usr/share/factory/mkosi/gdbinit.d/systemd.gdb b/mkosi.images/system/mkosi.extra/usr/share/factory/mkosi/gdbinit.d/systemd.gdb
deleted file mode 100644 (file)
index 26f882b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-set debuginfod enabled off
-set build-id-verbose 0
-set substitute-path ../src /root/src/systemd
index 74b810c152bcbf37ba6ac4d1192e8e85d3f52a1f..6da35e51380ae9b2407fe022ce7f3209692833ba 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
+mkdir -p "$BUILDROOT"/usr/share/factory/mkosi
 cp --archive --recursive --no-target-directory --reflink=auto "$BUILDROOT"/etc "$BUILDROOT"/usr/share/factory/mkosi