使用lldb调试python脚本

时间:2018-03-07 19:14:35

标签: python debugging lldb

我正在尝试使用lldb调试python文件,但我一直收到以下错误:

xxxxx: lldb python lldb-test-2.py
(lldb) target create "python"
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/xxxxx/anaconda2/lib/python2.7/copy.py", line 52, in <module>
    import weakref
  File "/Users/xxxxx/anaconda2/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Current executable set to 'python' (x86_64).
(lldb) settings set -- target.run-args  "lldb-test-2.py"
(lldb) r
Process 69299 launched: '/Users/xxxxx/anaconda2/envs/work-env-test/bin/python' (x86_64)
Process 69299 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_SOFTWARE (code=131072, subcode=0x0)
    frame #0: 0x00007fffa478cb1a libsystem_kernel.dylib`__posix_spawn + 10
libsystem_kernel.dylib`__posix_spawn:
->  0x7fffa478cb1a <+10>: jae    0x7fffa478cb24            ; <+20>
    0x7fffa478cb1c <+12>: movq   %rax, %rdi
    0x7fffa478cb1f <+15>: jmp    0x7fffa4785cd4            ; cerror
    0x7fffa478cb24 <+20>: retq   
Target 0: (python) stopped.
(lldb) 

这是我的测试代码:

#!/Users/xxxxx/anaconda2/envs/work-env-test/bin/python
import os
import numpy as np

def printTest():
    print("This is a test")

if __name__ == '__main__':
    printTest()

我能够在终端上正常运行此脚本,但无法使用lldb运行。

0 个答案:

没有答案