python3执行某一个程序时,报Segmentation fault (core dumped)错,但没有告知到底哪里出错,无法查问题
同时在根目录下生成core文件,典型的可以用gdb进行调试。这里用另外一个方法调试。
在主程序最开始加入两行代码:
import faulthandler
faulthandler.enable()
# 下面是原代码
再执行主程序,发现输出的信息很多:
igs@igs:~/eval_viewer $ python3 main.py
Fatal Python error: Segmentation fault
Current thread 0x00007f611cb7e740 (most recent call first):
File "/usr/lib/python3/dist-packages/gi/_option.py", line 47 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1023 in _handle_fromlist
File "/usr/lib/python3/dist-packages/gi/overrides/GLib.py", line 37 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "<frozen importlib._bootstrap>"<