xcode自带的gdb是6,golang需要的gdb是7,因此,homebrew之
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
添加证书
钥匙串访问,证书助理,选第二个,证书助理,创建证书,名字为gdb-cert,勾选覆盖默认值,有效期可以改的长一点,一步步下去,注意一定要选择代码签名,安装一定要到系统里面。
配置证书,全部改成信任模式,和goagent的配置方式一样
签名
codesign -s gdb-cert /usr/local/Cellar/gdb/7.7/bin/gdb
liteide里面配置gdb为新的路径即可
调试的时候提示输入密码,貌似输入一次以后,只要不重启,永久有效,不错
有疑问加站长微信联系(非本文作者)

"liteide里面配置gdb为新的路径即可" -- 这是神马意思?
运行不了
=thread-group-added,id="i1" ~"GNU gdb (GDB) 8.1\n" ~"Copyright (C) 2018 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-apple-darwin17.3.0\".\nType \"show configuration\" for configuration details." ~"\nFor bug reporting instructions, please see:\n" ~"<http://www.gnu.org/software/gdb/bugs/>.\n" ~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\"...\n" ~"Reading symbols from /Users/duanguanjun/work/gospace/src/awesomeProject/src/src.debug..."
请问上面这个“Warning:\nCannot insert breakpoint -1.\nCannot access memory at address 0xf782\n" (gdb)“怎样解决
重新安安装gdb brew reinstall gdb
根据提示添加~/.gdbinit文件 echo "set startup-with-shell off" >> ~/.gdbinit
然后签名 codesig -s gdb-cert /usr/local/bin/gdb
再通过liteide 选择gdb调试还是会报错,信息提示如下: =thread-group-added,id="i1" ~"GNU gdb (GDB) 8.1\n" ~"Copyright (C) 2018 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-apple-darwin17.3.0\".\nType \"show configuration\" for configuration details." ~"\nFor bug reporting instructions, please see:\n" ~"<http://www.gnu.org/software/gdb/bugs/>.\n" ~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\"...\n" =cmd-param-changed,param="startup-with-shell",value="off" ~"Reading symbols from /Users/duanguanjun/work/gospace/src/awesomeProject/src/src.debug..."
请各位前辈大虾多多指点,先谢谢了!
测试发现macos 10.13.4下更新的gdb(8.1)调试有问题,这个坑耽误我不少时间,最后使用gdb8.0就可正常调试,希望该贴帮助到更多的人。
本人系统下有两个版本的gdb(8.1和8.0) 解决办法: 1.果断删除/usr/local/bin/gdb 这个软链接文件 (rm -f /usr/local/bin/gdb) 2.重新建立软链接文件 ln -s /usr/local/Cellar/gdb/8.0/bin/gdb /usr/local/bin/gdb 3.重新签名gdb(8.0) codesign -s gdb-cert /usr/local/bin/gdb
这样就搞定!