3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OSX High Sierra で gdb を使おうとしたらエラー

Last updated at Posted at 2018-06-16

再現する環境と現象

OSX High Sierra。
gdb の version は 8.1

[Shumo:~/develop/ruby]$gdb -v
GNU gdb (GDB) 8.1
Copyright (C) 2018 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-darwin16.7.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".

codesign の認証はしている
(詳しくはこちらの記事などを参照のこと)

[Shumo:~/develop/ruby]$codesign -vv `which gdb`
/usr/local/bin/gdb: valid on disk
/usr/local/bin/gdb: satisfies its Designated Requirement

↓で落ちる

[Shumo:~/develop/ruby]$gdb ./ruby
GNU gdb (GDB) 8.1
Copyright (C) 2018 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-darwin16.7.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 ./ruby...Reading symbols from /Users/Shumo/develop/ruby/ruby.dSYM/Contents/Resources/DWARF/ruby...done.
done.
(gdb) run
Starting program: /Users/Shumo/develop/ruby/ruby
[New Thread 0x1103 of process 1997]
[New Thread 0x1403 of process 1997]
During startup program terminated with signal ?, Unknown signal.

原因と解決策

その1

https://stackoverflow.com/questions/49001329/gdb-doesnt-work-on-macos-high-sierra-10-13-3
↑の通り、gdb 8.1 で起きる不具合のようだ。
以下で解消した。

$ brew unlink gdb
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb
$ brew pin gdb

その2

↓も実行する必要がある

$ echo "set startup-with-shell off" >> ~/.gdbinit
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?