Add init debugging support
This adds Delve into the initramfs and a conditional hook which attaches Delve to our init
after the network is up. This allows for breakpoint-debugging the init itself, at least after the
very early node bringup.
Test Plan:
`bazel run -c dbg //:launch`, then use IDEA's Go Remote target to connect to localhost:2345
and set a breakpoint.
Bug: T786
X-Origin-Diff: phab/D581
GitOrigin-RevId: f6b32e7b7f4d36c8492df3e11ee97588817dbd8e
diff --git a/core/cmd/init/BUILD.bazel b/core/cmd/init/BUILD.bazel
index 1e5db46..af37ea6 100644
--- a/core/cmd/init/BUILD.bazel
+++ b/core/cmd/init/BUILD.bazel
@@ -2,13 +2,18 @@
go_library(
name = "go_default_library",
+ # keep
srcs = [
"main.go",
"switchroot.go",
- ],
+ ] + select({
+ "//core:debug_build": ["debug_enabled.go"],
+ "//conditions:default": ["debug_disabled.go"],
+ }),
importpath = "git.monogon.dev/source/nexantic.git/core/cmd/init",
visibility = ["//visibility:private"],
deps = [
+ "//core/internal/common:go_default_library", # keep
"//core/internal/common/supervisor:go_default_library",
"//core/internal/network:go_default_library",
"//core/internal/node:go_default_library",