Bug ID 31699
Summary [Windows] LLDB crashes when launched with a startup script on the command line.
Product lldb
Version 4.0
Hardware PC
OS Windows XP
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter vadimcn@gmail.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified
- Install LLVM for Windows snapshot build from [http://llvm.org/build](http://llvm.org/build) (SVN
r291454, built on 9 January 2017 at the time of filing this).
- Launch LLDB: lldb -O "p 42".
- LLDB crashes.
I've tracked the cause down to snapshot builds being built with a statically
linked CRT (-DLLVM_USE_CRT_RELEASE=MT). When a startup script is given on the
command line, lldb.exe creates a pipe, writes the script into the write end,
wraps a stdio file around the read end, and gives the resulting FILE* to
SBDebugger::SetInputFileHandle(). Unfortunately, since SBDebugger lives in
liblldb.dll, with its own copy of the CRT, that handle is not valid there.
Later, it tries to read from that handle, and... boom.