You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GoLand调试器触发断点时崩溃报'unexpected return pc for runtime.sigpanic'

Go调试器触发断点时崩溃问题(可复现)

在任意项目的任意单元测试中,只要触发断点,GoLand调试器就会崩溃,该问题完全一致且可复现。移除断点后,单元测试可正常运行完成。(故障表现如附图所示)

系统环境

  • MacOS 14.3.1
  • x86_64架构
  • GoLand 2023.3.5
  • xcode-select 版本2405
  • Go 1.21.6

GoLand调试器控制台输出

/usr/local/Cellar/go/1.21.6/libexec/bin/go test -c -o /....

/usr/local/Cellar/go/1.21.6/libexec/bin/go tool test2json -t ../GoLand.app/Contents/plugins/go-plugin/lib/dlv/mac/dlv --listen=127.0.0.1:53984 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /

...

API server listening at: 127.0.0.1:53984

已尝试更新部分软件,问题出现时GoLand、Xcode等软件版本更低,推测问题始于升级至Go 1.21.6。


2024-04-04 更新

无需GoLand即可复现该问题:

  1. 创建项目~/go/src/hello,在其中创建7行Hello World文件cmd/hello/main.go
  2. 执行编译命令:
    go build cmd/hello/main.go
    
  3. 启动调试器:
    dlv --listen=127.0.0.1:64997 --headless=true exec main
    
  4. 在另一个终端窗口连接调试器:
    dlv connect :64997
    
  • 直接运行程序(执行dlv的c命令):程序可正常运行,第一个窗口输出"hello world"和"Exiting.",第二个窗口输出"Process 2107 has exited with status 0"。
  • 设置断点后运行:执行break main.main后再执行c,第一个窗口输出:
    unexpected fault address 0xaaf0a20
    
    第二个窗口输出:
    > main.main() ./cmd/hello/main.go:5 (PC: 0xaaf0a2a)
    Warning: debugging optimized function
    Command failed: EOF
    

内容的提问来源于stack exchange,提问作者Sal Valente

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 16:52:14