golang debug调试
1. debug by gdb:
download the runtime-gdb file.
$ wget -q -O - https://golang.org/src/runtime/runtime-gdb.py |grep '<span id="L' > runtime-gdb.py
$ sed -i -e "s/<span.*span>//g" -e "s/<pre>//g" -e "s/^\t//g" -e 's/"/"/g' -e "s/'/'/g" -e "s/>/>/g" -e "s/</</g" -e "s/amp;//g" runtime-gdb.py
linux 下应该有脱字符处理工具(iconv)。 或者wget 本身应该能处理掉脱字符。
run gdb by:
$ $GOROOT=`go env |grep GOROOT |cut -d "=" -f2`
$ gdb your_bin -d $GOROOT
$ gdb cpuinfo_main -d `go env |grep GOROOT |cut -d "=" -f2`
source ~/go/src/runtime/runtime-gdb.py
发现最新的golang1.6已经自带了runtime-gdb.py
进入gdb
(gdb) add-auto-load-safe-path /usr/local/go/src/runtime/runtime-gdb.py
echo "set auto-load safe-path /" > line to your configuration file "/home/shaohef//.gdbinit".
直接运行
$ gdb your_bin
2. godebug
http://studygolang.com/articles/2899
Download:
$ go get -u github.com/mailgun/godebug
将 _ = "breakpoint" 插入代码。
package main import (
"fmt"
) func main() {
_ = "breakpoint"
fmt.Print("**********************\n")
}
build godbug
$ go build
mv godbug to goroot bin
$ sudo cp godebug /usr/local/go/bin/
$ debug
godbug run your go_file.
3. Go语言debug调试
http://studygolang.com/articles/2057
4. 采用idea IDE环境。
http://www.cnblogs.com/lingdhox/p/4189517.html
5. 使用Delve进行Golang代码的调试
http://www.qingpingshan.com/jb/go/111271.html
$ dlv exec ./sample-controller -- -kubeconfig=$HOME/.kube/config
使用Delve调试test case
dlv test --build-flags='github.com/dlsniper/u/tmp/mypack' -- -test.run ^TestHello$ https://github.com/derekparker/delve/issues/422
package main import (
"fmt"
"runtime/debug"
) func test1() {
test2()
} func test2() {
test3()
} func test3() {
fmt.Printf("%s", debug.Stack())
debug.PrintStack()
} func main() {
test1()
}
golang debug调试的更多相关文章
- golang debug with LiteIDE
golang 的调试比较麻烦,debug stop into 无法跳转到自己写的代码,但是能够跳转到系统提供的代码. 以下是简单的测试代码: package main import ( "f ...
- 远程debug调试java代码
远程debug调试java代码 日常环境和预发环境遇到问题时,可以用远程调试的方法本地打断点,在本地调试.生产环境由于网络隔离和系统稳定性考虑,不能进行远程代码调试. 整体过程是通过修改远程服务JAV ...
- u-boot 2011.09 开启debug 调试
以前做过,现在刚才又想不起来了,这个错误非常的严重. 在这里记一下. debug 调试信息的开启在 include/common.h 有如下宏定义: #ifdef DEBUG #define debu ...
- 使用Eclipse开发Java Web过程中Debug调试的使用方法
里介绍的是在Eclipse中的Debug调试. 首先右击项目选择Debug As -- Debug on Server 或者点击Server面板的小昆虫图标,启动Debug模式. 运行web项目,进行 ...
- eclipse debug (调试) 学习心得
eclipse debug (调试) 学习心得 进入debug模式: 1.设置断点 2.启动servers端的debug模式 3.运行程序,在后台遇到断点时,进入debug调试状态 ...
- Eclipse debug调试
Eclipse debug调试: F5:跳入方法F6:向下逐行调试F7:跳出方法F8:直接跳转到下一个断点
- (转) eclipse debug (调试) 学习心得
1.Step Into (also F5) 跳入2.Step Over (also F6) 跳过3.Step Return (also F7) 执行完当前method,然后return跳出此metho ...
- Android Studio的使用(二)--Debug调试
使用Android Studio进行Debug调试,这里有一篇比较详细的介绍 http://www.2cto.com/kf/201506/408358.html 故不再重复介绍.
- Eclipse中debug调试java代码一直报Source not found的解决办法
今天使用eclipse的debug调试代码,一直没法正常调试,一按F6就提示Source not found 根据提示发现可能是另一个项目影响了,所以把另一个项目Close Project,这次直接t ...
随机推荐
- $obj
<?php $obj = new stdClass(); for($w=0; $w<10; $w++){ $obj->$w= $w.'w'; $str = $w.'we'; $obj ...
- centos7 卸载和安装最新版本docker-ce,配置阿里云加速
一.yum卸载.安装 1.卸载老版本的 docker 及其相关依赖 sudo yum remove docker docker-common container-selinux docker-seli ...
- Frame报文
链路层帧常用的帧格式有两种:Ethernet II 与 IEEE802.3 Ethernet II 格式多用于终端设备的通信 IEEE802.3 格式多用于网络设备的通信 如何区分这两种报文 ...
- 最强Mac电脑 工作站级别一体机iMac Pro公布
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/a2Ni5KFDaIO1E6/article/details/78795857 前不久传出消息,苹果将 ...
- Jedis 对 Redis 的操作详解
1. JedisUtil2. 键操作3. 字符串操作4. 字节串4. 整数和浮点数5. 列表6. 集合(Set)7. 散列8. 排序sort 本篇主要阐述Jedis对redis的五大类型的操作:字符串 ...
- word 加载adobe acrobat ,保存word中的清晰图片
1:先安装 adobe 并激活 https://blog.csdn.net/xintingandzhouyang/article/details/82558235 2:打开word,点击 文件&g ...
- 自定义WordPress文件上传路径
自WordPress 3.5版本开始,隐藏了后台媒体设置页面的“默认上传路径和文件的完整URL地址”选项,可以通过下面的代码将该选项调出来. 将下面的代码添加到当前主题functions.php文件中 ...
- python3专业版安装及破解
1.网址 https://www.jetbrains.com/pycharm/download/#section=windows,打开页面,点击下载专业版 2.这是下载好的文件,双击运行即可. //详 ...
- leetcode & lintcode 题解
刷题备忘录,for bug-free 招行面试题--求无序数组最长连续序列的长度,这里连续指的是值连续--间隔为1,并不是数值的位置连续 问题: 给出一个未排序的整数数组,找出最长的连续元素序列的长度 ...
- NLP总览
一.自然语言处理概述 1)自然语言处理:利用计算机为工具,对书面实行或者口头形式进行各种各样的处理和加工的技术,是研究人与人交际中以及人与计算机交际中的演员问题的一门学科,是人工智能的主要内容. 2) ...