在此程序下, 如何与调试器断开执行并打印 i 值?
package main
import "fmt"
func main() {
x := "abc"
i := 3
fmt.Println(i)
fmt.Println(x)
}
我无法打印i。然而,我可以打印x:
go build test.go
gdb test
[...]Reading symbols from /home/ned/test...done.
(gdb) br 9
(gdb) run
(gdb) p i
No symbol "i" in current context.
(gdb) p x
$1 = "abc"