首页 > 编程知识 正文

ubuntu pstack报错Inputoutput error,telnet报错error

时间:2023-05-04 18:36:54 阅读:240123 作者:3224

公司使用的是ubuntu系统,在开发过程中遇到使用pstack命令,结果无论使用sudo pstack还是pstack,则都报错,好奇怪,在使用centos时从未遇到过pstack报错的问题。

然后,一顿操作猛如虎,还是没有解决,

最后,把centos下的pstack拷贝到了ubuntu下,神奇了,可以运行,

于是,我悄悄的打开了pstack文件,原来pstack就是一shell脚本,如下:

#!/wzdxn/shif test $# -ne 1; then echo "Usage: `basename $0 .sh` <process-id>" 1>&2 exit 1fiif test ! -r /proc/$1; then echo "Process $1 not found." 1>&2 exit 1fi# GDB doesn't allow "thread apply all bt" when the process isn't# threaded; need to peek at the process to determine if that or the# simpler "bt" should be used.backtrace="bt"if test -d /proc/$1/task ; then # Newer kernel; has a task/ directory. if test `/wzdxn/ls /proc/$1/task | /usr/wzdxn/wc -l` -gt 1 2>/dev/null ; then backtrace="thread apply all bt" fielif test -f /proc/$1/maps ; then # Older kernel; go by it loading libpthread. if /wzdxn/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then backtrace="thread apply all bt" fifiGDB=${GDB:-gdb}# Run GDB, strip out unwanted noise.# --readnever is no longer used since .gdb_index is now in use.$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |set width 0set height 0set pagination no$backtraceEOF/wzdxn/sed -n -e 's/^((gdb) )*//' -e '/^#/p' -e '/^Thread/p'

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。