Solaris

GDB 在 Solaris 上永遠掛起

  • October 22, 2015

run每次我從 gdb 提示符嘗試命令時,GDB 似乎都會掛起。當我執行ps時,產生了兩個 gdb 程序,pstack 顯示以下內容 -

15:47:02:/home/stufs1/pmanjunath/a2/Asgn2_code$ uname -a
SunOS compserv1 5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Blade-1500

15:44:04:/home/stufs1/pmanjunath/a2/Asgn2_code$ ps aux | grep gdb
pmanjuna 13121  0.1  0.1 1216  968 pts/23   S 15:44:11  0:00 grep gdb
pmanjuna 13077  0.0  0.1 7616 4392 pts/15   S 15:41:41  0:00 gdb client
pmanjuna 13079  0.0  0.1 7616 4392 pts/15   T 15:41:51  0:00 gdb client

15:44:50:/home/stufs1/pmanjunath/a2/Asgn2_code$ pstack 13077
13077:  gdb client
fef42c30 vfork    ()
00065938 procfs_create_inferior (32ea10, 32d728, 317430, 1, 0, 657a8) + 190
0008c668 sol_thread_create_inferior (32ea10, 32d728, 317430, 1, 25e030, 0) + 18
000ffda0 find_default_create_inferior (32ea10, 32d728, 317430, 1, 405c, 4060) + 20
000d8690 run_command_1 (0, 1, 32ea10, 1, ffbff0f4, 316fd0) + 208
0007e344 do_cfunc (316fd0, 0, 1, 1, 0, 0) + c
0008016c cmd_func (316fd0, 0, 1, 0, 1, 0) + 30
0004c1d4 execute_command (316fd0, 1, 0, 4f00c, 1, 2dc800) + 390
000eb6a0 command_handler (2f4ee0, 0, 2f3800, 8acf, ff000000, ff0000) + 8c
000ebbcc command_line_handler (2f3800, 7200636c, 32d71c, 7200, 2dfc00, 2dfc00) + 2a4
0019b354 rl_callback_read_char (fef6b6f8, 0, 931d8, 0, fef68284, fef68284) + 340
000eafb4 rl_callback_read_char_wrapper (0, fef709b0, 0, 11, 0, eafb0) + 4
000eb590 stdin_event_handler (0, 0, 932b4, fef6fad4, 0, 1) + 60
000ea780 handle_file_event (1, 1084, 932f4, 4f00c, ff1f2000, 1000) + bc
000ea11c process_event (0, 0, ffffffff, 0, 2df9f8, 0) + 84
000ea9d4 gdb_do_one_event (1, 1, 0, 2f3158, ff1f2000, 2) + 108
000e7cd4 catch_errors (ea8cc, 0, 2473a8, 6, ffbff6f0, 1) + 5c
000907e8 tui_command_loop (0, 64, ffffffff, 0, 0, 2f6190) + e0
000e7fcc current_interp_command_loop (800000, ff400000, ffc00000, 800000, 0, 331b40) + 54
00045b80 captured_command_loop (1, 1, 0, fef33a54, ff1f2000, 2) + 4
000e7cd4 catch_errors (45b7c, 0, 22db20, 6, 2dc400, 0) + 5c
0004625c captured_main (2d1800, 2f4ae0, 0, 0, 0, 0) + 6a0
000e7cd4 catch_errors (45bbc, ffbffc18, 22db20, 6, 0, 0) + 5c
00046bb0 gdb_main (ffbffc18, 0, 0, 0, 0, 0) + 24
00045b6c main     (2, ffbffc9c, ffbffca8, 2f45b8, ff1f0100, ff1f0140) + 28
000459dc _start   (0, 0, 0, 0, 0, 0) + 5c

15:45:38:/home/stufs1/pmanjunath/a2/Asgn2_code$ pstack 13079
13079:  gdb client
fef4098c execve   (ffbfffe6, ffbffc9c, ffbffca8)
feec4a7c execlp   (ffbffdc6, ffffffff, 289bc0, ffbfed18, 0, ffbfed10) + ac
0016e3e8 fork_inferior (32ea10, 32d728, 317430, 6567c, 653dc, 0) + 310
00065938 procfs_create_inferior (32ea10, 32d728, 317430, 1, 0, 657a8) + 190
0008c668 sol_thread_create_inferior (32ea10, 32d728, 317430, 1, 25e030, 0) + 18
000ffda0 find_default_create_inferior (32ea10, 32d728, 317430, 1, 405c, 4060) + 20
000d8690 run_command_1 (0, 1, 32ea10, 1, ffbff0f4, 316fd0) + 208
0007e344 do_cfunc (316fd0, 0, 1, 1, 0, 0) + c
0008016c cmd_func (316fd0, 0, 1, 0, 1, 0) + 30
0004c1d4 execute_command (316fd0, 1, 0, 4f00c, 1, 2dc800) + 390
000eb6a0 command_handler (2f4ee0, 0, 2f3800, 8acf, ff000000, ff0000) + 8c
000ebbcc command_line_handler (2f3800, 7200636c, 32d71c, 7200, 2dfc00, 2dfc00) + 2a4
0019b354 rl_callback_read_char (fef6b6f8, 0, 931d8, 0, fef68284, fef68284) + 340
000eafb4 rl_callback_read_char_wrapper (0, fef709b0, 0, 11, 0, eafb0) + 4
000eb590 stdin_event_handler (0, 0, 932b4, fef6fad4, 0, 1) + 60
000ea780 handle_file_event (1, 1084, 932f4, 4f00c, ff1f2000, 1000) + bc
000ea11c process_event (0, 0, ffffffff, 0, 2df9f8, 0) + 84
000ea9d4 gdb_do_one_event (1, 1, 0, 2f3158, ff1f2000, 2) + 108
000e7cd4 catch_errors (ea8cc, 0, 2473a8, 6, ffbff6f0, 1) + 5c
000907e8 tui_command_loop (0, 64, ffffffff, 0, 0, 2f6190) + e0
000e7fcc current_interp_command_loop (800000, ff400000, ffc00000, 800000, 0, 331b40) + 54
00045b80 captured_command_loop (1, 1, 0, fef33a54, ff1f2000, 2) + 4
000e7cd4 catch_errors (45b7c, 0, 22db20, 6, 2dc400, 0) + 5c
0004625c captured_main (2d1800, 2f4ae0, 0, 0, 0, 0) + 6a0
000e7cd4 catch_errors (45bbc, ffbffc18, 22db20, 6, 0, 0) + 5c
00046bb0 gdb_main (ffbffc18, 0, 0, 0, 0, 0) + 24
00045b6c main     (2, ffbffc9c, ffbffca8, 2f45b8, ff1f0100, ff1f0140) + 28
000459dc _start   (0, 0, 0, 0, 0, 0) + 5c

為什麼這些程序掛在vforkand中execve?這發生在我的大學機器上,同學們也有帳戶。他們都沒有報告這個問題。似乎只發生在我身上。

編輯:在schily 的幫助下,我能夠解決問題。當我登錄時,預設情況下我在csh。GDB 在這里工作得很好。現在,我執行bashcsh進入 bash shell。現在 GDB 掛起。當我檢查 的輸出時echo $SHELL,我看到了一些奇怪的東西

$ echo $SHELL
/bin/bash=

輸出末尾有一個等號。我猜 GDB 正在嘗試使用預設的 shell 變數生成一個 bash shell,但無法找到該等號的二進制 cos。現在,問題是找出等號是如何進入 shell 路徑的。

呼叫的程序vfork()掛起,因為它是並且子程序當時確實借用了程序映像,因此在子程序完成對orvfork() parent的呼叫之前它無法執行。_exit()``exec*()

因此,您需要找出 exec*() 掛起的原因。

exec*() 掛起的典型原因是 NFS 掛起或遍歷不存在的自動掛載點。

呼叫truss -p 13079以獲取掛起的 exec*() 的路徑。

引用自:https://unix.stackexchange.com/questions/237489