[Bug 34483] New: Crash in CreateTarget(..) in vim 8.0 python

Bug ID 34483
Summary Crash in CreateTarget(…) in vim 8.0 python
Product lldb
Version unspecified
Hardware Macintosh
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter vasko.tim@gmail.com
CC llvm-bugs@lists.llvm.org

Created attachment 19105 [details]
Crash trace for LLDB when running through VIM 8 via Python27 interpreter

This happens with system-installed lldb (Xcode and toolset), as well as with
freshly compiled lldb on master.

The included python llvm vim-plugin works fine from standalone python
interpreter (excluding vim imports), but crashes when running through Vim. VIM
was built against system-installed Python 2.7.10 (I'm on Sierra 10.12.6).
3rd-party vim 8 installs suffer same/worse issues. It is unclear what is
different about python when running through vim rather than python interpreter;
regardless, crash occurs in lldb.

Behold, code sample:

>>> import lldb
>>> dbg = lldb.SBDebugger.Create()
>>> target = dbg.CreateTarget("/Users/owl/git/bravo/bin/bravo") # custom executable, crashes with any executable really as long as it's a real executable

This code works perfectly when executed from standalone python interpreter. In
vim, it crashes lldb, causing vim to crash. Attached is the crash report, along
with full debug stack trace - source names line numbers, should be enough to

Can't tell yet if problem with swig bindings or not, but looks like there is an
operation on null PythonObject to get it's type.

Greg Clayton changed bug 34483

What Removed Added
CC clayborg@gmail.com
Resolution INVALID

Comment # 1 on bug 34483 from Greg Clayton

You need to call lldb.SBDebugger.Initialize() before calling any API functions.

Tim Vasko changed bug 34483

What Removed Added
Resolution INVALID

Comment # 3 on bug 34483 from Tim Vasko

I just tried adding lldb.SBDebugger.Initialize() with no resolve.

I tried it (separately) before creating debugger, after creating debugger, and
calling initialize on the debugger object - to no avail.

The crash trace remains absolutely the same.

Additionally, the code works perfectly in python standalone interpreter - kind
of strange that this determinism is lost with lack of this call. Lastly, the
sample in LLDB repository for the lldb vim plugin has no mention for this call.
If it is truly needed, may I ask that we please update that code?

In any case however, problem remains.

Tim Vasko changed bug 34483