ターミナルウィンドウが出力でいっぱいになると gcore がコアダンプを作成できない
Environment
-
Red Hat Enterprise Linux 5 Update 4
-
kernel:2.6.18-164.el5
- gdb-6.8-37.el5
- gdb が、スクリーンに収まらないほどの出力を表示するプログラム。多数の共有ライブラリーにリンクされるプログラムが、各共有ライブラリーに対してこれを行います。debuginfo パッケージがインストールされていない場合は、no debugging symbols found メッセージが表示されます。
Issue
- ターミナルウィンドウが gdb からの出力でいっぱいになると、実行中のプログラムのコアダンプを gcore が作成できません。
Resolution
- gcore スクリプトから生成された set height 0 行を gdb バッチコマンドに追加すると gdb が小さいターミナルウィンドウで実行し続けます。
- 5.6GA で、http://rhn.redhat.com/errata/RHBA-2011-0099.html がリリースされています。
Root Cause
https://bugzilla.redhat.com/show_bug.cgi?id=555076
ターミナルウィンドウが出力でいっぱいになると、gdb が以下のメッセージを表示します。
---Type <return> to continue, or q <return> to quit---
ただし、gcore は gdb を、/dev/null からリダイレクトされた STDIN で実行しているため、gdb がキーボードからの読み取りに失敗します。
Diagnostic Steps
このファイルを test-gcore.c として保存します。
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
sleep(120);
return(0);
}
これをコンパイルして実行します。
-
リプロデューサーをコンパイルします。
# gcc -I. -c -o test-gcore.o test-gcore.c # gcc -I. -o test-gcore test-gcore.o -L/usr/lib -ldl -lrpm -lrpmio -lpopt \ -lz -lcrypto -lm -lssl -lxml2 -lxmlsec1 -lxslt -L/usr/lib/lib \ -lwrap -Wl,-E \ -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE \ -L/usr/local/lib \ /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a \ -L/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE -lperl \ -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -
リプロデューサーを実行します。
# ./test-gcore & -
小規模の xterm を開始します。
# xterm -geometry 80x10 & -
その小さい xterm で、gcore にリプロデューサーの PID を追加して実行します。
# gcore $(pidof test-gcore)
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
