llvm-project/lldb/tools/driver
Levon Ter-Grigoryan f23b829a26 Fixed use of -o and -k in LLDB under Windows when statically compiled with vcruntime.
Right now if the LLDB is compiled under the windows with static vcruntime library, the -o and -k commands will not work.

The problem is that the LLDB create FILE* in lldb.exe and pass it to liblldb.dll which is an object from CRT.
Since the CRT is statically linked each of these module has its own copy of the CRT with it's own global state and the LLDB should not share CRT objects between them.

In this change I moved the logic of creating FILE* out of commands stream from Driver class to SBDebugger.
To do this I added new method: SBError SBDebugger::SetInputStream(SBStream &stream)

Command to build the LLDB:
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb;libcxx"  -DLLVM_USE_CRT_RELEASE="MT" -DLLVM_USE_CRT_MINSIZEREL="MT" -DLLVM_USE_CRT_RELWITHDEBINFO="MT" -DP
YTHON_HOME:FILEPATH=C:/Python38 -DCMAKE_C_COMPILER:STRING=cl.exe -DCMAKE_CXX_COMPILER:STRING=cl.exe ../llvm

Command which will fail:
lldb.exe -o help

See discord discussion for more details: https://discord.com/channels/636084430946959380/636732809708306432/854629125398724628
This revision is for the further discussion.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104413
2021-11-24 16:17:08 +00:00
..
CMakeLists.txt [CMake] Configure the Info.plist so it contains a real version number. 2019-11-15 09:50:42 -08:00
Driver.cpp Fixed use of -o and -k in LLDB under Windows when statically compiled with vcruntime. 2021-11-24 16:17:08 +00:00
Driver.h [lldb] make it easier to find LLDB's python 2021-11-10 10:33:34 -08:00
Options.td [lldb] make it easier to find LLDB's python 2021-11-10 10:33:34 -08:00
Platform.cpp [lldb][NFC] Use C++ versions of the deprecated C standard library headers 2021-05-26 12:46:12 +02:00
Platform.h [lldb] Get rid of HAVE_SYS_TYPES_H 2021-08-03 22:14:56 +02:00
lldb-Info.plist.in [CMake] Configure the Info.plist so it contains a real version number. 2019-11-15 09:50:42 -08:00