golang 的调试比较麻烦,debug stop into 无法跳转到自己写的代码,但是能够跳转到系统提供的代码。

以下是简单的测试代码:

package main

import (
"fmt"
)

func main() {
i := 5
even(i)
b := 1
fmt.Printf("Is %d even? %v\n", i, b)
}

func even(i int) bool {
a := 1
b := a + 1
b = b + 1
return i%2 == 0
}

这个情况太诡异了,网上到处是对golang gdb的吐槽。详情可以看这里:

http://grokbase.com/t/gg/golang-nuts/1443r0vch8/go-nuts-debugging-in-go-seems-to-be-a-very-difficult-task-to-accomplish

不过好在最后有人提供了LiteIDE里面设置的方式。

1 - Open your project in LiteIDE2 - Select "Build" menu and under it select "Build Configuration..."3 - A dialog shows up. Select "Custom" tab. It contains a list of key/valuepairs4 - Double click the space reserved for the value of "BUILDARGS"5 - write -gcflags "-N -l"6 - close the dialog by clicking Ok button7 - rebuild your project (Ctrl+B)8 - press F5 to start debugging9 - put some breakpoints wherever you wish10 - press f5 again to reach the first breakpoint

解决方案:

1 - 打开LiteIDE Build设置2 - 修改BUILDARGS 变量,添加参数 -gcflags "-N -l" 注意这里有引号3 - 保存后即可4 - enjoy it

golang debug with LiteIDE的更多相关文章

  1. golang debug调试

    1. debug by gdb: office doc download the runtime-gdb file. $ wget -q -O - https://golang.org/src/run ...

  2. Golang开发工具LiteIDE使用方法整理

    安装 参考github的说明 添加GOPATH 创建workspace 创建新文件 运行程序 Liteide中运行程序有两种方式: FR(FileRun)是编译并运行单个文件,可以使用Shift + ...

  3. 安装Golang 1.6及开发环境

    安装Golang 1.6及开发环境=====================================> 下载软件    * go1.4.2.linux-amd64.tar.gz     ...

  4. calling c++ from golang with swig--windows dll (四)

    calling c++ from golang with swig--windows dll 四 前面讲述了windows环境下golang如何通过swig调用C++ dll.由于编译c++代码使用了 ...

  5. k8s开发环境

    在搭建开发环境之前, 请Try Kubernetes,Get Started and CONCEPTS 可以自己使用minikube 来搭建个环境, 自己玩一玩. K8s需要一些依赖. 参看官方文档 ...

  6. jmeter sampler maven项目排错记

    eclipse 创建的maven项目,引入jar包之后出现红色叹号,一直找不到原因,连main方法都无法运行,提示找不到类: 错误: 找不到或无法加载主类 soapsampler.SoapSample ...

  7. [golang学习] 在idea中code & debug

    [已废弃]不需要看 idea 虽然审美倒退了n年. 不过功能还是相当好用的. idea 的go插件堪称最好的go ide. 1. 语法高亮支持 2. 智能提示 3. 跳转定义(反跳转回来) 4. 集成 ...

  8. 2016年最新mac下vscode配置golang开发环境支持debug

    网上目前还找不到完整的mac下golang环境配置支持,本人配置成功,现在整理分享出来. mac最好装下xcode,好像有依赖关系安装Homebrew打开终端窗口, 粘贴脚本执行/usr/bin/ru ...

  9. Golang开发环境搭建(Notepad++、LiteIDE两种方式以及martini框架使用)

    本文介绍两种Golang的开发环境一种基于notepad++.还有一种基于liteide. 1.下载Golang语言的pkg:http://golangtc.com/download 直接点击安装,一 ...

随机推荐

  1. git branch使用

    (1) git配置global信息: git config --global user.name "Your Name" git config --global user.emai ...

  2. 字符串、字符、字节以及bit位小结与疑问

    字符串是由一个个字符组成的,每个字符又有一个或多个字节来表示,每个字节又由8个bit位来表示 在C#里 字符串通常由string来声明,字符由char来声明,字节由byte来表示,位由bit来表示,具 ...

  3. [20160701]DevideByZeroWithoutNoException——from 《Java How To Program (Early Objects), 10th》

    //一段优美的例子 import java.util.Scanner; import java.util.InputMismatchException; public class DevideByZe ...

  4. Course Schedule I & II

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  5. 没有body怎么添加onload事件

    <script type="text/javascript"> window.onload = function () { setup(); } </script ...

  6. 一道常考fork题挖掘

    #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { int ...

  7. 问题 A: 【动态规划】采药_二维数组_一维数组

    问题 A: [动态规划]采药 时间限制: 1 Sec  内存限制: 64 MB提交: 35  解决: 15[提交][状态][讨论版] 题目描述 山洞里有一些不同的草药,采每一株都需要一些时间,每一株也 ...

  8. css 命名规范

    网站头部:    head/header(头部) top(顶部)    导航:   nanv 导航具体区分:topnav(顶部导航).mainnav(主导航).mininav(迷你导航).textna ...

  9. js的json转换

    静态页面是: data:[{ value:2.5, itemStyle:{ normal:{color:'#4a90e2'} } },{ value:2.5, itemStyle:{ normal:{ ...

  10. java获得本机IP,名称等

    import java.net.InetAddress; import java.net.UnknownHostException; public class GetLocalIP { public ...