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/main.go b/core/cmd/init/main.go
index 4fc949d..f5b09f8 100644
--- a/core/cmd/init/main.go
+++ b/core/cmd/init/main.go
@@ -86,6 +86,9 @@
panic(err)
}
+ // This function initializes a headless Delve if this is a debug build or does nothing if it's not
+ initializeDebugger(networkSvc)
+
supervisor.New(context.Background(), logger, func(ctx context.Context) error {
if err := supervisor.Run(ctx, "network", networkSvc.Run); err != nil {
return err