你可以使用
/proc/[pid]/syscall
mark@ubuntu:~$ gdb python
...
...
...
Program received signal SIGINT, Interrupt.
0x00007ffff78ed573 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:84
84 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb)
mark@ubuntu:~/$ ps aux | grep python
mark 77858 0.2 0.7 90216 37780 pts/2 S+ 15:13 0:00 gdb python
mark 77860 0.0 0.1 38416 6424 pts/2 t 15:13 0:00 /usr/bin/python
77860
被跟踪-
t
mark@ubuntu:~/$ sudo cat /proc/77860/syscall
23 0x1 0x7fffffffd980 0x0 0x0 0x0 0x7ffff7fdb700 0x7fffffffd958 0x7ffff78ed573
0x7fffffffd958
sp
和
0x7ffff78ed573
是程序计数器。
我找不到
ptrace
http://man7.org/linux/man-pages/man5/proc.5.html
/proc/[pid]/syscall (since Linux 2.6.27)
This file exposes the system call number and argument regisâ
ters for the system call currently being executed by the
process, followed by the values of the stack pointer and proâ
gram counter registers. The values of all six argument regisâ
ters are exposed, although most system calls use fewer regisâ
ters.
If the process is blocked, but not in a system call, then the
file displays -1 in place of the system call number, followed
by just the values of the stack pointer and program counter.
If process is not blocked, then the file contains just the
string "running".