LoginSignup
0
1

More than 5 years have passed since last update.

Homebrew の gdb で ELF をアレしたい

Posted at

VMware のリモートデバッグ機能を使って OS X から Linux カーネルに gdb で接続したいのですが、それには ELF である vmlinux ファイルを gdb に読み込ませる必要があります。しかし、標準では Homebrew の gdb は ELF に対応していません。

解決策

  • --with-all-targets を付けて brew install する

こういう感じです。

% brew install gdb --with-all-targets
==> Installing gdb from homebrew/homebrew-dupes
==> Downloading http://ftpmirror.gnu.org/gdb/gdb-7.9.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gdb/7.9 --with-system-readline --with-lzma --enable-targets=all --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.9: 43 files, 22M, built in 6.1 minutes

早速 vmlinux をロードできるか試してみます。

% gdb
GNU gdb (GDB) 7.9
Copyright (C) 2015 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".
(gdb) file vmlinux
Reading symbols from vmlinux...done.

というわけで、OS X の gdb で ELF をロードできました。

0
1
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
0
1