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/BUILD b/core/BUILD
index fcfc049..23cb537 100644
--- a/core/BUILD
+++ b/core/BUILD
@@ -1,5 +1,14 @@
load("//core/build:def.bzl", "smalltown_initramfs")
+# debug_build checks if we're building in debug mode and enables various debug features for the image. Currently this
+# is only used for attaching a Delve debugger to init when it's enabled.
+config_setting(
+ name = "debug_build",
+ values = {
+ "compilation_mode": "dbg",
+ },
+)
+
smalltown_initramfs(
name = "initramfs",
extra_dirs = [
@@ -39,6 +48,9 @@
"@com_github_cilium_cilium//cilium": "/cilium/bin/cilium",
"@com_github_cilium_cilium//daemon": "/cilium/bin/daemon",
"@com_github_cilium_cilium//operator": "/cilium/bin/operator",
+
+ # Delve
+ "@com_github_go_delve_delve//cmd/dlv:dlv": "/dlv",
},
)