Help us understand the problem. What is going on with this article?

OS X(Elcapitan)でgdbを使う

More than 3 years have passed since last update.

OS Xでgdbを使ってデバッグを使いたい。

インストール

$ brew install gdb
$ gdb -v
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
(以下略)

使ってみる(エラー)

$ ./executable_file_name hoge < data/huga

をデバッグしたい。

$ gdb ./executable_file_name
(gdb) run hoge < data/huga
Starting program: path/to/executable_file_name hoge < data/huga
Unable to find Mach task port for process-id 49153: (os/kern) failure (0x5).

Unable to find Match task... と怒られてしまう。

エラー対処

以下のどちらかを行えば、上と同じコマンドでデバッグできる。

一刻も早く動かしたい

$ sudo gdb ./executable_file_name

stack overflowのこの回答を参考にした。

証明書を作る

OS XでGDBを使う(ためにコード署名をする)
に従って証明書を作るとsudoが不要になる。

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした