The Go Blog

Running GDB on mac

bantana
21 March 2015

brew install gdb

brew tap homebrew/dupes
brew install gdb

create codesign certificate

if you get this message when run the gdb:

(please check gdb is codesigned - see taskgated(8))

do this first:

1.opening the "Keychain Access" >> "Certificate Assistent" >> "Create Certificate..."

==>:
Name: gdb-cert
Identity Type: Self Signed Root
Certificate Type: Code Signing

select the option: let me override default

and next , next , next ... until "Specify a Location For The Certificate"

keychain: system

and open the name of "gdb-cert" Certificate on the system+certificates; Trust set "Always Trust"

codesign the gdb

codesign -s 'gdb-cert' /usr/local/bin/gdb

save and restart osx

02:51 $ gdb hello
GNU gdb (GDB) 7.8.2
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.3.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello...done.
(gdb) run
Starting program: /Users/bantana/goproj/src/bantana/hello/hello
Hello, world!
baby!
hello, demogo!
[Inferior 1 (process 5354) exited normally]
(gdb)
(gdb) list
1   // Package main provides ...
2   package main
3
4   import "fmt"
5
6   func main() {
7     fmt.Println("Hello, world!")
8     fmt.Println("baby!")
9     fmt.Println("hello, demogo!")
10  }

done!

Related articles