llvm-project/lldb/source/Utility/CMakeLists.txt

91 lines
1.7 KiB
CMake
Raw Normal View History

set(LLDB_SYSTEM_LIBS)
# Windows-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
list(APPEND LLDB_SYSTEM_LIBS
ws2_32
rpcrt4
)
endif ()
if (NOT LLDB_DISABLE_LIBEDIT)
list(APPEND LLDB_SYSTEM_LIBS edit)
endif()
if (NOT LLDB_DISABLE_CURSES)
list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
endif()
endif()
if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
list(APPEND LLDB_SYSTEM_LIBS atomic)
endif()
list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY})
if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC)
list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
endif()
list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
if (LLVM_BUILD_STATIC)
if (NOT LLDB_DISABLE_PYTHON)
list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
endif()
if (NOT LLDB_DISABLE_CURSES)
list(APPEND LLDB_SYSTEM_LIBS gpm)
endif()
endif()
add_lldb_library(lldbUtility
ArchSpec.cpp
Baton.cpp
Connection.cpp
ConstString.cpp
DataBufferHeap.cpp
DataBufferLLVM.cpp
DataEncoder.cpp
DataExtractor.cpp
Add Utility/Environment class for handling... environments Summary: There was some confusion in the code about how to represent process environment. Most of the code (ab)used the Args class for this purpose, but some of it used a more basic StringList class instead. In either case, the fact that the underlying abstraction did not provide primitive operations for the typical environment operations meant that even a simple operation like checking for an environment variable value was several lines of code. This patch adds a separate Environment class, which is essentialy a llvm::StringMap<std::string> in disguise. To standard StringMap functionality, it adds a couple of new functions, which are specific to the environment use case: - (most important) envp conversion for passing into execve() and likes. Instead of trying to maintain a constantly up-to-date envp view, it provides a function which creates a envp view on demand, with the expectation that this will be called as the very last thing before handing the value to the system function. - insert(StringRef KeyEqValue) - splits KeyEqValue into (key, value) pair and inserts it into the environment map. - compose(value_type KeyValue) - takes a map entry and converts in back into "KEY=VALUE" representation. With this interface most of the environment-manipulating code becomes one-liners. The only tricky part was maintaining compatibility in SBLaunchInfo, which expects that the environment entries are accessible by index and that the returned const char* is backed by the launch info object (random access into maps is hard and the map stores the entry in a deconstructed form, so we cannot just return a .c_str() value). To solve this, I have the SBLaunchInfo convert the environment into the "envp" form, and use it to answer the environment queries. Extra code is added to make sure the envp version is always in sync. (This also improves the layering situation as Args was in the Interpreter module whereas Environment is in Utility.) Reviewers: zturner, davide, jingham, clayborg Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D41359 llvm-svn: 322174
2018-01-10 19:57:31 +08:00
Environment.cpp
FastDemangle.cpp
FileSpec.cpp
History.cpp
IOObject.cpp
JSON.cpp
LLDBAssert.cpp
Log.cpp
Logging.cpp
NameMatches.cpp
Range.cpp
RegularExpression.cpp
SelectHelper.cpp
SharingPtr.cpp
Status.cpp
Stream.cpp
StreamCallback.cpp
StreamGDBRemote.cpp
StreamString.cpp
StringExtractor.cpp
StringExtractorGDBRemote.cpp
StringLexer.cpp
StringList.cpp
StructuredData.cpp
TildeExpressionResolver.cpp
Timer.cpp
UserID.cpp
UriParser.cpp
UUID.cpp
VASprintf.cpp
VMRange.cpp
LINK_LIBS
${LLDB_SYSTEM_LIBS}
# lldbUtility does not depend on other LLDB libraries
LINK_COMPONENTS
BinaryFormat
Support
)