Skip to content

Instantly share code, notes, and snippets.

@kazuph kazuph/.bash_profile forked from Pallinder/.bash_profile
Last active Aug 29, 2015

Embed
What would you like to do?
# 競合するgdbがないなら必要ない
# 普通にbrewで入れたらgdbコマンドが使える
alias gdbnew='/usr/local/Cellar/gdb/7.6/bin/gdb'
define g
python
import subprocess as p
cmd = ["go", "env", "GOROOT"]
gdb_cmd = "source %s/src/pkg/runtime/runtime-gdb.py" % p.check_output(cmd)[:-1]
gdb.execute(gdb_cmd)
#### Install a new version of gdb (the one that comes with mac os x is too old)
1. Install and get brew
2. brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
3. Add an alias so it's easier to run, I named it gdbnew (check the .bash_profile file attached for an example)
#### Deal with signing gdb (you can skip this if you feel like running the debug process like root)
1. Start keychain access
2. Keychain access -> Certificate assistance -> Create a certificate
3. Name it whatever you like (I choose gdb)
4. Certificate type should be code signing
5. Check "let me override defaults"
6. Just click continue until you reach the point to select Keychain, select the System keychain
7. type `codesign -s name-of-certificate /path/to/new/gdb` in your console
8. type `sudo chgrp procmod /path/to/new/gbb` in your console
9. type `sudo chmod g+s /usr/local/bin/gdb` in your console
10. Pray to whatever god(s) you may or may not have.
11. Confirm that it works by trying to run the new gdb with a compiled golang binary. (newgdb path-to-binary) if an error similar to `codesign -s gdb-cert /usr/local/bin/gdb /usr/local/bin/gdb: is already signed but it still gives me the error message Unable to find Mach task port for process-id 838: (os/kern) failure (0x5)` pops up, it didnt work. Some people say a restart of the computer might help.
#### Make sure gdb loads the golang scripts
1. Put the the attacked .gdbinit in your homedirectory
2. Launch the new gdb you can now enable the golang specific commands by typing "g" (without the quotes) in gdb
@kazuph

This comment has been minimized.

Copy link
Owner Author

kazuph commented May 16, 2014

日本語はこっちが参考になる。
http://unknownplace.org/archives/golang-gdb-osx.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.