-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When we try to analyze a core file that is generated from a script with a shebang or any other form of non-ELF file with executable permissions, Pystack will fail to analyze it because it will detect that the provided executable is not an ELF file (Executable and Linkable Format) and therefore it cannot be used to analyze the core file.
Expected Behavior
When Pystack detects that the provided file is not an ELF file, Pystack should analyze the core file that we provided in order to determine which Python executable to use. To properly analyze the core file, we can pass the full path to the executable that was used in the original invocation as the second argument to the pystack core
command.
$ pystack core $(COREFILE) /full/path/to/the/python/executable
Steps To Reproduce
To reproduce the issue generate a core file from a Python file with a shebang.
[pgalindo3@pyfrad-ob-299 ~]$ cat program.py
#!/opt/bb/bin/python3.10
import time
time.sleep(100)
[pgalindo3@pyfrad-ob-299 ~]$ chmod +x program.py
[pgalindo3@pyfrad-ob-299 ~]$ ./program.py &
[1] 104173
[pgalindo3@pyfrad-ob-299 ~]$ gcore 104173
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f89765ec49b in select () from /lib64/libc.so.6
warning: target file /proc/104173/cmdline contained unexpected null characters
Saved corefile core.104173
[Inferior 1 (process 104173) detached]
[pgalindo3@pyfrad-ob-299 ~]$ pystack core core.104173
Using executable found in the core file: program.py
Core file information:
state: t zombie: True niceness: 0
pid: 104173 ppid: 102709 sid: 102709
uid: 26835 gid: 100 pgrp: 104173
executable: python3.10 arguments: /opt/bb/bin/python3.10
The process died due receiving signal SIGSTOP
💀 The provided executable (program.py) doesn't have an executable format 💀
Pystack Version
1.3.0
Python Version
3.7, 3.8, 3.9, 3.10, 3.11, 3.12
Linux distribution
Debian, Ubuntu, Fedora, Red Hat, Arch Linux, Alpine Linux, Other
Anything else?
No response