今天在使用hop的時候痢掠,剛開始還可以正常顯示,但Kill了一個圖形程序進程后就不能正常使用了,表現(xiàn)為運行htop后直接卡住了颁湖。
1.檢查是程序問題還是輸出問題
htop > htop_dump.txt
查看,內容可以正常輸出例隆,說明只是顯示的問題
2.使用strace檢查卡在哪一步上
strace -o htop_strace.log -s 2000 htop
log顯示原因為:
socket(PF_FILE, SOCK_STREAM, 0) = 4
connect(4, {sa_family=AF_FILE, path="/dev/gpmctl"...}, 13) = ? ERESTARTSYS (To be restarted)
--- SIGINT (Interrupt) @ 0 (0) ---
rt_sigaction(SIGINT, {0x1, [], SA_RESTORER, 0x3fc0c302d0}, NULL, 8) = 0
正常的時候應該是:
connect(4, {sa_family=AF_FILE, path="/dev/gpmctl"...}, 13) = 0
write(4, "\f\0\363\376\0\0\316\377OD\0\0\0\0\0\0", 16) = 16
學習到使用strace來檢查程序運行時系統(tǒng)調用出現(xiàn)的問題甥捺。
NAME
strace - trace system calls and signals
SYNOPSIS
strace [ -dffhiqrtttTvxx ] [ -acolumn ] [ -eexpr ] ... [ -ofile ] [ -ppid ] ... [ -sstrsize ] [ -uusername ] [ -Evar=val ] ... [ -Evar ] ... [
command [ arg ... ] ]
strace -c [ -eexpr ] ... [ -Ooverhead ] [ -Ssortby ] [ command [ arg ... ] ]
3.重啟gpm
gpm是用來控制虛擬鼠標的
service gpm restart