-
-
Save subh007/cb0a272257d88ae60cec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias gdbnew='/usr/local/Cellar/gdb/7.6/bin/gdb' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### 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 (e.g. /usr/local/bin/gdb) | |
8. type `sudo chgrp procmod /path/to/new/gdb` 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. | |
12. If it doesn't work then quit the keychain, it is important. Kill the taskgated process and restart it. It will reload the newly created certificate. (Ref : http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5 http://apple.stackexchange.com/questions/116707/how-do-i-start-taskgated-again). | |
#### 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment