macos 下通过sublime text 3 + gosublime+sublimegdb 开发注意事项

1.macos系统10.13.4下

  安装gdb8.0可以正常调试,而gdb8.1不能正常调试,需要跳过这个坑

2.需要对gdb 8.0进行软件签名

3.通过gosublime 运行(cmd+b),添加如下命令

关闭内联优化
go build -gcflags "-N -l" xxx.go

 

先生成可执行文件,然后sublimegdb 设置中在

才能正常调试

配置调试的可执行文件工作路径

"workingdir": "/Users/duanguanjun/work/gospace/src/awesomeProject/src",
// "workingdir": "${folder:${file}}",

添加命令行命令
// NOTE: You MUST provide --interpreter=mi for the plugin to work
// "commandline": "gdb --interpreter=mi ./executable",
"commandline": "gdb --interpreter=mi ./hello",

//"commandline": "/usr/local/bin/gdb --interpreter=mi --args ./${file_base_name}",
// Environments for running gdb and gdb server
// Example: "env": {"DISPLAY": ":100"}
"env": {"PATH":"/usr/local/bin:/usr/local/go/bin"},

 

指定命令行用户输入参数

// Arguments for the program.
// Example: to run "./executable foo bar"
// "arguments": "foo bar"
// To provide user input (stdin) use
// "arguments": "< input.dat"
"arguments": "AA BB CC",

 

gosublime default setting参数如下:

指定用户工程的gopath和goroot环境参数

// you may set specific environment variables here
// e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
// in values, $PATH and ${PATH} are replaced with
// the corresponding environment(PATH) variable, if it exists.
"env": {"GOPATH":"/Users/x x x/work/gospace/src/awesomeProject:/Users/x x x/work/gospace/src/awesomeProject/src/testcall",
"GOROOT":"/usr/local/go"
},

关闭use_gs_gopath,设置为false

// if set, whenever possible `GOPATH` will be set to `GS_GOPATH`.
// please see `Usage & Tips` `ctrl+dot,ctrl+2`
// section `Per-project settings & Project-based GOPATH` for details about `GS_GOPATH`
"use_gs_gopath": false,

 

 

gosublime 用户配置参数添加如下

{
"font_size": 18,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"soda_classic_tabs": true,
"soda_folder_icons": true,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"update_check": false,
"word_wrap": true
}

 

 

 

posted @ 2018-05-09 23:37  中国人醒来了  阅读(457)  评论(0编辑  收藏  举报