使用 delve 使用 'next' 调试 golang 将跳过某些步骤

问题描述

当我使用 delve 调试这个项目时(dlv debug t.go):

//t.go
package 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))
}

我想分析函数growslice的行为(在runtime/slice.go中),然后在funcgrowslice上设置断点,我用ns来分析,但是会跳过一些步骤,如下图所示: enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...