りんけーじ - 日記 - 2007年12月6日の日記



< 2007年12月 >
13141516171819
20212223242526
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678
9101112131415
16171819202122
23242526272829
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
78910111213
14151617181920
21222324252627
28293031123
前の日: 2007年11月26日
次の日: 2007年12月12日

2007/12/06 18:47 [gdb でデバッグできない?]

サーバで開発をしていて、デバッグをしたい。けど、起動してあるプロセスに attach しようとすると

[silky:~] root# gdb attach 24784
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...attach: No such file or directory.
Attaching to process 24784
/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/solib-svr4.c:1443: internal-error: legacy_fetch_link_map_offsets called without legacy link_map support enabled.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/solib-svr4.c:1443: internal-error: legacy_fetch_link_map_offsets called without legacy link_map support enabled.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n

正しくは gdb 24784 であって、attach がいらないとかはとりあえず置いておいて。

なぜか、gdb が internal error で落ちます。困ります。attach しようとした先のプロセスは detach されないので、巻き込まれて死にます。すごーく困ります。

gdb-6.7 をソースからインストールしたら symbol のフォーマットが分からんと言われて諦め、ports から入れ直しても結果は変わらず。

よく分からないから Google で検索してみたら、OpenBSD 関連のメーリングリストが引っかかりました。

これによれば、gdb の引数に実行ファイルを指定しなければならないとのこと。(というか、--pid なんてオプションがあったのに気付きました)

指定すれば確かに動くんだけど…、ほかの古い FreeBSD だと大丈夫だった気がするし、MacOS X でも問題ないし……。一々実行ファイルを指定しなきゃいけないのは面倒だし、そもそも実行開始後にファイルを書き換えたらデバッグできないということになるし。

とりあえずは間違ってファイルを書き換えないようにしたり、今までの方法でデバッグしようとして殺したりしないようにしないと…。

コメント(0) トラックバック(0)