hellが複雑なプログラムの場合,システムにインストールする前にそ れのテストとデバッグを間違いなく行いたいでしょう.上記のセクションで, libtoolラッパースクリプトが,プログラムを直接実行することを可能にする 方法を見ましたが,残念ながら,このメカニズムはデバッガの邪魔になります.
burger$ gdb hell GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is no warranty for GDB; type "show warranty" for details. GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. "hell": not in executable format: File format not recognized (gdb) quit burger$
残念です.GDBは実行形式がある場所が分からないので動作しません.そのた め,もう一度実行形式でGDBを呼び出してみてください.
burger$ gdb .libs/hell trick:/home/src/libtool/demo$ gdb .libs/hell GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is no warranty for GDB; type "show warranty" for details. GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. (gdb) break main Breakpoint 1 at 0x8048547: file main.c, line 29. (gdb) run Starting program: /home/src/libtool/demo/.libs/hell /home/src/libtool/demo/.libs/hell: can't load library 'libhello.so.2' Program exited with code 020. (gdb) quit burger$
あぁ.さて,GDBは,hellがリンクしている共有ライブラリを見つける ことができないため文句を言いました.そのため,正しいライブラリパスを設 定してデバッガを実行するために,libtoolを使う必要があります.幸い, .libsディレクトリを完全に忘れて,そのままの実行形式の ラッパーで実行可能です(see Execute mode).
burger$ libtool --mode=execute gdb hell GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is no warranty for GDB; type "show warranty" for details. GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. (gdb) break main Breakpoint 1 at 0x8048547: file main.c, line 29. (gdb) run Starting program: /home/src/libtool/demo/.libs/hell Breakpoint 1, main (argc=1, argv=0xbffffc40) at main.c:29 29 printf ("Welcome to GNU Hell!\n"); (gdb) quit The program is running. Quit anyway (and kill it)? (y or n) y burger$