読者です 読者をやめる 読者になる 読者になる

handlename's blog

コード片など

GDB7.3のコンパイル

emacsからgdbを呼び出すとき、Xcodeを入れたときに一緒にはいるもの(v6.3)だと

This version of GDB doesn't support non-stop mode.  Turning it off.

と言われてうまくいかなかったので、最新の7.3をソースからコンパイルして使ってみた。

http://ftp.gnu.org/gnu/gdb/gdb-7.3.tar.gz からソースをダウンロード。

$ wget http://ftp.gnu.org/gnu/gdb/gdb-7.3.tar.gz
$ tar xzfv gdb-7.3.tar.gz
$ cd gdb-7.3
$ ./configure
$ make

ここでこんなエラー。

(...略)

In file included from /usr/local/Cellar/python/2.7.2/include/python2.7/Python.h:126,
                 from ./python/python-internal.h:47,
                 from ./python/python.c:48:
/usr/local/Cellar/python/2.7.2/include/python2.7/modsupport.h:27: warning: ‘PyArg_ParseTuple’ is an unrecognized format function type
In file included from ./python/python.c:51:
../bfd/version.h:4:1: warning: "REPORT_BUGS_TO" redefined
In file included from ./defs.h:26,
                 from ./python/python.c:20:
./config.h:790:1: warning: this is the location of the previous definition
./python/python.c: In function ‘_initialize_python’:
./python/python.c:1019: error: ‘version’ undeclared (first use in this function)
./python/python.c:1019: error: (Each undeclared identifier is reported only once
./python/python.c:1019: error: for each function it appears in.)
./python/python.c:1020: error: ‘host_name’ undeclared (first use in this function)
./python/python.c:1022: error: ‘target_name’ undeclared (first use in this function)
make[2]: *** [python.o] Error 1
make[1]: *** [all-gdb] Error 2
make: *** [all] Error 2

gdb/python/python.c を見てみると、存在しないヘッダファイルを読み込むようになっていたので、その部分をいじってみた。

#include "version.h"

#include "../version.h"

もう一度 make するとコンパイルが通った。
その後インストール。

$ sudo make install
$ /usr/local/bin/gdb --version
GNU gdb (GDB) 7.3
Copyright (C) 2011 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-darwin11.0.1".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

入ったみたい。

で、emacsから呼び出してみた、が、

(gdb) r
The target does not support running in non-stop mode.
(gdb) set non-stop off
(gdb) r
Starting program: /Users/handle/dev/sandbox/test 
Unable to find Mach task port for process-id 78994: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
(gdb)

あれー…