goclipseでGo言語をデバッグできるようにしてみる

まずgdbを入れます。

% brew install homebrew/dupes/gdb
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-dupes'...
remote: Counting objects: 1498, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 1498 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1498/1498), 299.62 KiB | 191.00 KiB/s, done.
Resolving deltas: 100% (823/823), done.
Checking connectivity... done.
Tapped 36 formulae
==> Installing gdb from homebrew/homebrew-dupes
==> Installing dependencies for gdb: xz, readline
==> Installing gdb dependency: xz
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/xz-5.0.7.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring xz-5.0.7.mavericks.bottle.tar.gz
🍺  /usr/local/Cellar/xz/5.0.7: 58 files, 1.5M
==> Installing gdb dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.3.8.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-6.3.8.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X provides similar software, and installing this software in
parallel can cause all kinds of trouble.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
🍺  /usr/local/Cellar/readline/6.3.8: 40 files, 2.1M
==> Installing gdb
==> Downloading http://ftpmirror.gnu.org/gdb/gdb-7.8.1.tar.xz
######################################################################## 100.0%
==> Patching
patching file gdb/darwin-nat.c
==> ./configure --prefix=/usr/local/Cellar/gdb/7.8.1 --with-system-readline --with-lzma --with-python=/usr
==> make
==> make install
==> Caveats
gdb requires special privileges to access Mach ports.
You will need to codesign the binary. For instructions, see:

  http://sourceware.org/gdb/wiki/BuildingOnDarwin
==> Summary
🍺  /usr/local/Cellar/gdb/7.8.1: 42 files, 5.7M, built in 11.1 minutes


これだけでは動かないので下記のページを参考に証明書処理の
手順1〜7を実行します。8はVerが違っちゃっていたので
※有効期間はめんどいので3650日にしてみました。
Safx: MacでGoのデバッグ環境を構築する


証明書の残りの処理をします。

% codesign -s gdb-cert /usr/local/Cellar/gdb/7.8.1/bin/gdb
% sudo killall taskgated
Password:


次に設定を変更します。

% sudo vi /System/Library/LaunchDaemons/com.apple.taskgated.plist
Password:

-s -> -spが変更点です。


Eclipse側にGDBを設定するとデバッグが可能になります。