That debugging is (now) in the runtime package, which is (always) compiled with optimizations on. That will tend to interfere with debugging. The 1.17 change to use registers for passing parameters has also caused some regressions in debugging quality (and it would be nice to fix those, but it is tricky).
On Tuesday, July 27, 2021 at 6:26:19 PM UTC-4 jake...@gmail.com wrote: > Was the code built with optimizations disabled? > > On Tuesday, July 27, 2021 at 1:57:17 PM UTC-4 林 子鹏 wrote: > >> When I use delve to debug this project(dlv debug t.go): >> >> //t.gopackage main >> import ( >> "fmt" >> "os" >> "reflect" >> "unsafe" >> ) >> func main() { >> s1 := make([]uint8, 0) >> aboutSlice(&s1, "s1") >> s2 := make([]uint8, 8) >> aboutSlice(&s2, "s2") >> new_s1 := append(s1, 10) >> new_s2 := append(s2, 20) >> aboutSlice(&new_s1, "new_s1") >> aboutSlice(&new_s2, "new_s2") >> os.Exit(0) >> } >> func aboutSlice(s *[]uint8, n string) { >> fmt.Printf("%s:\tmem_addr:%p\tsize:%v\taddr:%#x\tlen:%v\tcap:%v\n", n, >> s, unsafe.Sizeof(*s), (*reflect.SliceHeader)(unsafe.Pointer(s)).Data, >> len(*s), cap(*s)) >> } >> >> I want to analyze the behavior of function growslice(in >> runtime/slice.go),and then set breakpoints on func growslice,I use n and >> s to analyze it, but it will skip some step, like the picture below: >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/51baac64-0197-4a02-91d6-097bcfb892c5n%40googlegroups.com.