加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

关于golang的debug

发布时间:2020-12-16 18:50:41 所属栏目:大数据 来源:网络整理
导读:Debuggers Application programming needs good debugging support,and in this area still a lot of work needs to be done. A debugger (Oogle): support for gdb (at least version 7 is needed),the GNU debugger is being built in Go’s gc linker (6l

Debuggers

Application programming needs good debugging support,and in this area still a lot of work needs to be done. A debugger (Oogle): support for gdb (at least version 7 is needed),the GNU debugger is being built in Go’s gc linker (6l,8l) by the Go-team from Google (not for Windows and ARM-platforms) (see also http://blog.golang.org/2010/11/debugging)

Support for gdb version 7.1 is build in in LiteIDE and Goclipse.

If you don’t want to use a debugger,the following is useful in a simple debugging strategy:

1) use print-statements (with print / println and the fmt.Print functions) at well chosen places 2) in fmt.Printf functions use the following specifiers to obtain complete info about variables: %+v gives us a complete output of the instance with its fields %#v gives us a complete output of the instance with its fields and qualified type name %T gives us the complete type specification

The Way to Go

35

3) use a panic-statement (see § 13.2) to obtain a stack trace (a list of all the called functions up until that moment) 4) use the defer keyword in tracing code execution (see § 6.4).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读