[all-commits] [llvm/llvm-project] f23b82: Fixed use of -o and -k in LLDB under Windows when ...

David Spickett via All-commits all-commits at lists.llvm.org
Wed Nov 24 08:17:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f23b829a2635a6d833bdc81a12d6217b52ae9e45
      https://github.com/llvm/llvm-project/commit/f23b829a2635a6d833bdc81a12d6217b52ae9e45
  Author: Levon Ter-Grigoryan <patriosthegreat at protonmail.ch>
  Date:   2021-11-24 (Wed, 24 Nov 2021)

  Changed paths:
    M lldb/bindings/interface/SBDebugger.i
    M lldb/include/lldb/API/SBDebugger.h
    M lldb/include/lldb/Core/Debugger.h
    M lldb/source/API/SBDebugger.cpp
    M lldb/source/Core/Debugger.cpp
    M lldb/test/API/python_api/default-constructor/sb_debugger.py
    M lldb/test/API/python_api/file_handle/TestFileHandle.py
    M lldb/tools/driver/Driver.cpp

  Log Message:
  -----------
  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




More information about the All-commits mailing list