Wol*_*lfy 0 python gdb segmentation-fault lldb macos-catalina
我正在使用 PySide2 和 scikit-learn 开发一个应用程序。如果我使用单线程,应用程序可以正常工作,但如果我将 sckikit-learn 计算移至工作 QThread(以在处理过程中保持 UI 响应),我会在 Mac OS Catalina 上遇到随机分段错误。同一个程序似乎在 Windows 上运行良好(在 Mac 上,我每次运行该程序时都会遇到分段错误;我在 Windows 上运行该程序至少二十次,但从未崩溃)。我试图遵循此答案中的建议,但我无法在 Catalina 上gdb正常lldb工作。
这就是我得到的lldb:
% lldb python
(lldb) target create "python"
Current executable set to 'python' (x86_64).
(lldb) run test.py
error: process exited with status -1 (attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries when the attached failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.))
Run Code Online (Sandbox Code Playgroud)
gdb然后我尝试使用 MacPorts进行安装,然后按照 GDB Wiki 中的说明进行操作以允许gdb调试另一个进程,但是在命令gdb之后要么挂起run,要么在运行简单脚本时出现未知信号错误(只需打印一个字符串):
% ggdb python
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin19.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
(No debugging symbols found in python)
(gdb) run test.py
Starting program: /usr/bin/python test.py
[New Thread 0x2603 of process 92261]
[New Thread 0x1803 of process 92261]
During startup program terminated with signal ?, Unknown signal.
Run Code Online (Sandbox Code Playgroud)
有没有办法在 Catalina 上调试 Python 分段错误?
macOS 上的 SIP(系统完整性保护)禁止调试器附加到系统应用程序,包括 Python 的发布版本。这就是你所看到的。
您需要关闭 SIP 或构建您自己的 Python 版本。OTOH,如果您正在调试 -O0 构建的 Python,那么在 Python 中调试问题会容易得多,因此从长远来看,弄清楚如何自己构建它(实际上并不难),这可能是值得的。
| 归档时间: |
|
| 查看次数: |
1143 次 |
| 最近记录: |