-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Hi, I'm trying to track the process containerd, but I always get no output.
I used the following command, which did not produce any output:
sudo python3 strace.py -f -p 1363
I also tried the example in the documentation and rewrote it to:
import signal
import ptrace.debugger
def debugger_example(pid):
debugger = ptrace.debugger.PtraceDebugger()
print("Attach the running process %s" % pid)
process = debugger.addProcess(pid, False)
# process is a PtraceProcess instance
print("IP before: %#x" % process.getInstrPointer())
print("Execute a single step")
process.singleStep()
# singleStep() gives back control to the process. We have to wait
# until the process is trapped again to retrieve the control on the
# process.
process.waitSignals(signal.SIGTRAP)
print("IP after: %#x" % process.getInstrPointer())
process.detach()
debugger.quit()
def main():
debugger_example(1363)
if __name__ == "__main__":
main()
The error obtained is the following,
/home/zzc/Desktop/zzc/python3.6_sudo.sh /home/zzc/Desktop/zzc/python-ptrace/zzc-test.py
Attach the running process 1363
Traceback (most recent call last):
File "/home/zzc/Desktop/zzc/python-ptrace/zzc-test.py", line 30, in <module>
main()
File "/home/zzc/Desktop/zzc/python-ptrace/zzc-test.py", line 26, in main
debugger_example(1363)
File "/home/zzc/Desktop/zzc/python-ptrace/zzc-test.py", line 10, in debugger_example
process = debugger.addProcess(pid, False)
File "/home/zzc/Desktop/zzc/python-ptrace/ptrace/debugger/debugger.py", line 83, in addProcess
parent=parent, is_thread=is_thread)
File "/home/zzc/Desktop/zzc/python-ptrace/ptrace/debugger/process.py", line 172, in __init__
self.attach()
File "/home/zzc/Desktop/zzc/python-ptrace/ptrace/debugger/process.py", line 189, in attach
ptrace_attach(self.pid)
File "/home/zzc/Desktop/zzc/python-ptrace/ptrace/binding/func.py", line 177, in ptrace_attach
ptrace(PTRACE_ATTACH, pid)
File "/home/zzc/Desktop/zzc/python-ptrace/ptrace/binding/func.py", line 168, in ptrace
raise PtraceError(message, errno=errno, pid=pid)
ptrace.error.PtraceError: ptrace(cmd=16, pid=1363, 0, 0) error #1: Operation not permitted
Process finished with exit code 1
I want to know what I should do.
Metadata
Metadata
Assignees
Labels
No labels