[Lldb-commits] [PATCH] D104413: Fixed use of -o and -k in LLDB under Windows when statically compiled with vcruntime.

Levon Ter-Grigoryan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 16 12:12:00 PDT 2021


PatriosTheGreat created this revision.
PatriosTheGreat added reviewers: teemperor, jarin.
PatriosTheGreat requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104413

Files:
  lldb/include/lldb/API/SBDebugger.h
  lldb/source/API/SBDebugger.cpp
  lldb/tools/driver/Driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104413.352499.patch
Type: text/x-patch
Size: 8619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210616/cadf00f5/attachment.bin>


More information about the lldb-commits mailing list