我正在尝试dockerd使用dlv调试器了解内部的一些东西。不幸的是,每次我尝试这样做时,我都会遇到错误。dlv exec我也做不到dlv attach。
以下差异显示了我应用的一些更改,docker/docker以确保避免一些 go 优化并且可以进行调试:
diff --git i/hack/make/.binary w/hack/make/.binary
index d56e3f3..e6835fa 100644
--- i/hack/make/.binary
+++ w/hack/make/.binary
@@ -84,6 +84,7 @@ hash_files() {
go build \
-o "$DEST/$BINARY_FULLNAME" \
"${BUILDFLAGS[@]}" \
+ -gcflags="all=-N -l" \
-ldflags "
$LDFLAGS
$LDFLAGS_STATIC_DOCKER
我还进行了修改dockerd-rootless.sh以确保我不使用普通exec但dlv exec dockerd -- $@. 不幸的是,每次我收到以下错误:
Could not create config directory: mkdir /root/.config: permission denied.could not launch process: could not get .debug_frame section: could not find .debug_frame section
当我尝试时发生同样的错误dlv attach docker-pid:
could not attach to pid 228089: could not get .debug_frame section: could not find .debug_frame section
有谁知道可能是什么原因造成的?
信息:
uname -a
Linux host 5.6.8-200.fc31.x86_64 #1 SMP Wed Apr 29 19:10:01 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
go version
go version go1.13.10 linux/amd64
dlv version
Delve Debugger
Version: 1.4.0
Build: $Id: 67422e6f7148fa1efa0eac1423ab5594b223d93b $
docker version
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b7f0
Built: Wed Mar 11 01:27:05 2020
OS/Arch: linux/amd64
Experimental: false
慕田峪7331174
相关分类