Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

4
external/llvm-project/lldb/.arcconfig vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"project_id" : "lldb",
"conduit_uri" : "https://reviews.llvm.org/"
}

View File

@@ -0,0 +1 @@
BasedOnStyle: LLVM

59
external/llvm-project/lldb/.gitignore vendored Normal file
View File

@@ -0,0 +1,59 @@
#==============================================================================#
# The file specifies intentionally untracked files that git should ignore.
# See: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html
#
# This file is intentionally different from the output of `git svn show-ignore`,
# as most of those are useless.
#==============================================================================#
#==============================================================================#
# File extensions to be ignored anywhere in the tree.
#==============================================================================#
# Temp files created by most text editors.
*~
# Merge files created by git.
*.orig
# Byte compiled python modules.
*.pyc
*.pyproj
# pyenv settings
.python-version
*.sln
*.suo
# vim swap files
.*.swp
.sw?
# OS X specific files.
.DS_store
DerivedData/
# Remote build configuration files.
.remote-build.conf
build/
pyproj/
llvm-build/
ninja/
*xcuserdata
test/20*
__pycache__/
*.lock
*.so
clang-module-cache
# Skip ctags-style tags files
tags
# We should ignore Xcode-style embedding of llvm/ at lldb root dir.
# Do not add trailing '/'s, they skip symlinks.
/llvm
/DerivedData
# Ignore test trace directories.
20??-??-??-??_??_??/
# Ignore crashlog support files.
crashinfo.lock
crashinfo.so

View File

@@ -0,0 +1,134 @@
cmake_minimum_required(VERSION 3.4.3)
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
)
include(LLDBStandalone)
include(LLDBConfig)
include(AddLLDB)
# Define the LLDB_CONFIGURATION_xxx matching the build type
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
add_definitions( -DLLDB_CONFIGURATION_DEBUG )
else()
add_definitions( -DLLDB_CONFIGURATION_RELEASE )
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
else()
set(LLDB_DEFAULT_DISABLE_LIBEDIT 0)
endif ()
# We need libedit support to go down both the source and
# the scripts directories.
set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables the use of editline.")
if (LLDB_DISABLE_LIBEDIT)
add_definitions( -DLLDB_DISABLE_LIBEDIT )
endif()
if(APPLE)
add_definitions(-DLLDB_USE_OS_LOG)
endif()
# add_subdirectory(include)
add_subdirectory(docs)
if (NOT LLDB_DISABLE_PYTHON)
if(LLDB_USE_SYSTEM_SIX)
set(SIX_EXTRA_ARGS "--useSystemSix")
endif()
set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
if(LLDB_BUILD_FRAMEWORK)
set(LLDB_PYTHON_TARGET_DIR
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
else()
# Don't set -m when building the framework.
set(FINISH_EXTRA_ARGS "-m")
endif()
add_subdirectory(scripts)
endif ()
add_subdirectory(source)
add_subdirectory(tools)
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests."
${LLVM_INCLUDE_TESTS})
if(LLDB_INCLUDE_TESTS)
if (TARGET clang)
set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
else()
set(LLDB_DEFAULT_TEST_C_COMPILER "")
set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
endif()
set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors")
if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run")
endif()
add_subdirectory(test)
add_subdirectory(unittests)
add_subdirectory(lit)
endif()
if (NOT LLDB_DISABLE_PYTHON)
# Add a Post-Build Event to copy over Python files and create the symlink
# to liblldb.so for the Python API(hardlink on Windows)
add_custom_target(finish_swig ALL
COMMAND
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
--srcRoot=${LLDB_SOURCE_DIR}
--targetDir=${LLDB_PYTHON_TARGET_DIR}
--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
${SIX_EXTRA_ARGS}
${FINISH_EXTRA_ARGS}
VERBATIM
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/scripts/lldb.py
COMMENT "Python script sym-linking LLDB Python API")
# We depend on liblldb being built before we can do this step.
add_dependencies(finish_swig liblldb lldb-argdumper)
# If we build the readline module, we depend on that happening
# first.
if (TARGET readline)
add_dependencies(finish_swig readline)
endif()
# Ensure we do the python post-build step when building lldb.
add_dependencies(lldb finish_swig)
if(LLDB_BUILD_FRAMEWORK)
# The target to install libLLDB needs to depend on finish swig so that the
# framework build properly copies over the Python files.
add_dependencies(install-liblldb finish_swig)
endif()
# Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching
# lldb.exe or any other executables that were linked with liblldb.
if (WIN32 AND NOT "${PYTHON_DLL}" STREQUAL "")
# When using the Visual Studio CMake generator the lldb binaries end up in Release/bin, Debug/bin etc.
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin" LLDB_BIN_DIR)
file(TO_NATIVE_PATH "${PYTHON_DLL}" PYTHON_DLL_NATIVE_PATH)
add_custom_command(
TARGET finish_swig
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_DLL_NATIVE_PATH} ${LLDB_BIN_DIR} VERBATIM
COMMENT "Copying Python DLL to LLDB binaries directory.")
endif ()
endif ()

View File

@@ -0,0 +1,52 @@
This file is a list of the people responsible for ensuring that patches for a
particular part of LLDB are reviewed, either by themself or by someone else.
They are also the gatekeepers for their part of LLDB, with the final word on
what goes in or not.
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Greg Clayton
E: clayborg@gmail.com
D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, Mac-specific code,
D: DynamicLoader, ObjectFile, IOHandler, EditLine, Core/Value*, Watchpoints, debugserver
D: Build scripts, Test suite, Platform, gdb-remote, Anything not covered by this file
N: Jim Ingham
E: jingham@apple.com
D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, Breakpoints, ABI
D: Watchpoints, Trampolines, Target, Command Interpreter, C++ / Objective C Language runtime
D: Expression evaluator, IR interpreter, Clang integration
D: Data Formatters
N: Ilia K
E: ki.stfu@gmail.com
D: lldb-mi
N: Ed Maste
E: emaste@freebsd.org
D: FreeBSD
N: Jason Molenda
E: jmolenda@apple.com
D: ABI, Disassembler, Unwinding, iOS, debugserver, Platform, ObjectFile, SymbolFile,
D: SymbolVendor, DWARF, gdb-remote
N: Hafiz Abid Qadeer
E: abidh.haq@gmail.com
D: lldb-mi
N: Kamil Rytarowski
E: kamil@netbsd.org
D: NetBSD
N: Zachary Turner
E: zturner@google.com
D: CMake build, Host (common+windows), Plugins/Process/Windows, Anything Windows-specific
D: Test suite
N: Pavel Labath
E: labath@google.com
D: Linux, Android

18
external/llvm-project/lldb/INSTALL.txt vendored Normal file
View File

@@ -0,0 +1,18 @@
LLDB Installation Instructions
==============================
LLDB builds on Mac OS X (with Xcode) and Linux (with GCC or Clang).
On Mac OS X, in addition to using Xcode you'll need to enable code signing
on your system to either build lldb or debug using lldb. Please see the code
signing documentation in docs/code-signing.txt for more detailed directions.
If you are building on Mac OS X and LLVM is not present in llvm/, then LLDB
will check it out automatically. The files in scripts/Xcode/repos determine
which branches of LLVM/Clang are checked out, depending on the current
LLDB branch, according to the algorithm in scripts/Xcode/repo.py.
For instructions to build LLDB on Linux, or more details about supported
compiler versions, other dependencies, and build flags, see:
http://lldb.llvm.org/build.html

38
external/llvm-project/lldb/LICENSE.TXT vendored Normal file
View File

@@ -0,0 +1,38 @@
University of Illinois/NCSA
Open Source License
Copyright (c) 2010 Apple Inc.
All rights reserved.
Developed by:
LLDB Team
http://lldb.llvm.org/
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLDB Team, copyright holders, nor the names of
its contributors may be used to endorse or promote products derived from
this Software without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.

View File

@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.4.3)
project(XcodeConfig C CXX)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/.."
"${CMAKE_CURRENT_SOURCE_DIR}/../modules"
)
set(LLDB_CONFIG_HEADER_INPUT
${CMAKE_CURRENT_SOURCE_DIR}/../../include/lldb/Host/Config.h.cmake)
include(LLDBGenerateConfig)

View File

@@ -0,0 +1,167 @@
function(add_lldb_library name)
# only supported parameters to this macro are the optional
# MODULE;SHARED;STATIC library type and source files
cmake_parse_arguments(PARAM
"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
""
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
${ARGN})
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
if(PARAM_PLUGIN)
set_property(GLOBAL APPEND PROPERTY LLDB_PLUGINS ${name})
endif()
if (MSVC_IDE OR XCODE)
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
list(GET split_path -1 dir)
file(GLOB_RECURSE headers
../../include/lldb${dir}/*.h)
set(srcs ${srcs} ${headers})
endif()
if (PARAM_MODULE)
set(libkind MODULE)
elseif (PARAM_SHARED)
set(libkind SHARED)
elseif (PARAM_OBJECT)
set(libkind OBJECT)
else ()
# PARAM_STATIC or library type unspecified. BUILD_SHARED_LIBS
# does not control the kind of libraries created for LLDB,
# only whether or not they link to shared/static LLVM/Clang
# libraries.
set(libkind STATIC)
endif()
#PIC not needed on Win
# FIXME: Setting CMAKE_CXX_FLAGS here is a no-op, use target_compile_options
# or omit this logic instead.
if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
if (PARAM_OBJECT)
add_library(${name} ${libkind} ${srcs})
else()
llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
${PARAM_LINK_LIBS}
DEPENDS ${PARAM_DEPENDS})
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
if (PARAM_SHARED)
set(out_dir lib${LLVM_LIBDIR_SUFFIX})
if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
endif()
install(TARGETS ${name}
COMPONENT ${name}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${out_dir}
ARCHIVE DESTINATION ${out_dir})
else()
install(TARGETS ${name}
COMPONENT ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
if (NOT CMAKE_CONFIGURATION_TYPES)
add_llvm_install_targets(install-${name}
DEPENDS ${name}
COMPONENT ${name})
endif()
endif()
endif()
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
# but it is simple enough to make all of LLDB depend on some of those
# headers without negatively impacting much of anything.
add_dependencies(${name} clang-tablegen-targets)
# Add in any extra C++ compilation flags for this library.
target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
endfunction(add_lldb_library)
function(add_lldb_executable name)
cmake_parse_arguments(ARG
"INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL"
""
"LINK_LIBS;LINK_COMPONENTS"
${ARGN}
)
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
set_target_properties(${name} PROPERTIES
FOLDER "lldb executables")
if(LLDB_BUILD_FRAMEWORK)
if(ARG_INCLUDE_IN_FRAMEWORK)
if(NOT IOS)
set(resource_dir "/Resources")
set(resource_dots "../")
endif()
string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
set_target_properties(${name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>${resource_dir}
BUILD_WITH_INSTALL_RPATH On
INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
# For things inside the framework we don't need functional install targets
# because CMake copies the resources and headers from the build directory.
# But we still need this target to exist in order to use the
# LLVM_DISTRIBUTION_COMPONENTS build option. We also need the
# install-liblldb target to depend on this tool, so that it gets put into
# the Resources directory before the framework is installed.
if(ARG_GENERATE_INSTALL)
add_custom_target(install-${name} DEPENDS ${name})
add_dependencies(install-liblldb ${name})
add_custom_target(install-${name}-stripped DEPENDS ${name})
add_dependencies(install-liblldb-stripped ${name})
endif()
else()
set_target_properties(${name} PROPERTIES
BUILD_WITH_INSTALL_RPATH On
INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
endif()
endif()
if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK ))
install(TARGETS ${name}
COMPONENT ${name}
RUNTIME DESTINATION bin)
if (NOT CMAKE_CONFIGURATION_TYPES)
add_llvm_install_targets(install-${name}
DEPENDS ${name}
COMPONENT ${name})
endif()
endif()
if(ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK)
add_llvm_tool_symlink(${name} ${name} ALWAYS_GENERATE SKIP_INSTALL
OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
endif()
endfunction(add_lldb_executable)
function(add_lldb_tool name)
add_lldb_executable(${name} GENERATE_INSTALL ${ARGN})
endfunction()
# Support appending linker flags to an existing target.
# This will preserve the existing linker flags on the
# target, if there are any.
function(lldb_append_link_flags target_name new_link_flags)
# Retrieve existing linker flags.
get_target_property(current_link_flags ${target_name} LINK_FLAGS)
# If we had any linker flags, include them first in the new linker flags.
if(current_link_flags)
set(new_link_flags "${current_link_flags} ${new_link_flags}")
endif()
# Now set them onto the target.
set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
endfunction()

View File

@@ -0,0 +1,11 @@
execute_process(COMMAND /usr/libexec/PlistBuddy -c "Print:CFBundleVersion" ${LLDB_INFO_PLIST}
OUTPUT_VARIABLE BundleVersion
OUTPUT_STRIP_TRAILING_WHITESPACE)
file(APPEND "${HEADER_FILE}.tmp"
"#define LLDB_VERSION_STRING lldb-${BundleVersion}\n")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${HEADER_FILE}.tmp" "${HEADER_FILE}")
file(REMOVE "${HEADER_FILE}.tmp")

View File

@@ -0,0 +1,425 @@
include(CheckCXXSymbolExists)
set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(LLDB_LINKER_SUPPORTS_GROUPS OFF)
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
# The Darwin linker doesn't understand --start-group/--end-group.
set(LLDB_LINKER_SUPPORTS_GROUPS ON)
endif()
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
set(LLDB_DEFAULT_DISABLE_CURSES 0)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
set(LLDB_DEFAULT_DISABLE_CURSES 1)
elseif (CMAKE_SYSTEM_NAME MATCHES "Android" )
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
set(LLDB_DEFAULT_DISABLE_CURSES 1)
elseif(IOS)
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
endif()
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
"Disables the Python scripting integration.")
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
"Disables the Curses integration.")
set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
"Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
set(LLDB_USE_SYSTEM_SIX 0 CACHE BOOL
"Use six.py shipped with system and do not install a copy of it")
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
"Causes lldb to export all symbols when building liblldb.")
else()
# Windows doesn't support toggling this, so don't bother making it a
# cache variable.
set(LLDB_EXPORT_ALL_SYMBOLS 0)
endif()
if ((NOT MSVC) OR MSVC12)
add_definitions( -DHAVE_ROUND )
endif()
if (LLDB_DISABLE_CURSES)
add_definitions( -DLLDB_DISABLE_CURSES )
endif()
# On Windows, we can't use the normal FindPythonLibs module that comes with CMake,
# for a number of reasons.
# 1) Prior to MSVC 2015, it is only possible to embed Python if python itself was
# compiled with an identical version (and build configuration) of MSVC as LLDB.
# The standard algorithm does not take into account the differences between
# a binary release distribution of python and a custom built distribution.
# 2) From MSVC 2015 and onwards, it is only possible to use Python 3.5 or later.
# 3) FindPythonLibs queries the registry to locate Python, and when looking for a
# 64-bit version of Python, since cmake.exe is a 32-bit executable, it will see
# a 32-bit view of the registry. As such, it is impossible for FindPythonLibs to
# locate 64-bit Python libraries.
# This function is designed to address those limitations. Currently it only partially
# addresses them, but it can be improved and extended on an as-needed basis.
function(find_python_libs_windows)
if ("${PYTHON_HOME}" STREQUAL "")
message("LLDB embedded Python on Windows requires specifying a value for PYTHON_HOME. Python support disabled.")
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
return()
endif()
file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIRS)
if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h")
file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str
REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1"
PYTHONLIBS_VERSION_STRING "${python_version_str}")
message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}")
string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}")
unset(python_version_str)
else()
message("Unable to find ${PYTHON_INCLUDE_DIRS}/patchlevel.h, Python installation is corrupt.")
message("Python support will be disabled for this build.")
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
return()
endif()
file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)
file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE)
file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" PYTHON_DEBUG_LIB)
file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll" PYTHON_DEBUG_DLL)
file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE)
file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" PYTHON_RELEASE_LIB)
file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_RELEASE_DLL)
if (NOT EXISTS ${PYTHON_DEBUG_EXE})
message("Unable to find ${PYTHON_DEBUG_EXE}")
unset(PYTHON_DEBUG_EXE)
endif()
if (NOT EXISTS ${PYTHON_RELEASE_EXE})
message("Unable to find ${PYTHON_RELEASE_EXE}")
unset(PYTHON_RELEASE_EXE)
endif()
if (NOT EXISTS ${PYTHON_DEBUG_LIB})
message("Unable to find ${PYTHON_DEBUG_LIB}")
unset(PYTHON_DEBUG_LIB)
endif()
if (NOT EXISTS ${PYTHON_RELEASE_LIB})
message("Unable to find ${PYTHON_RELEASE_LIB}")
unset(PYTHON_RELEASE_LIB)
endif()
if (NOT EXISTS ${PYTHON_DEBUG_DLL})
message("Unable to find ${PYTHON_DEBUG_DLL}")
unset(PYTHON_DEBUG_DLL)
endif()
if (NOT EXISTS ${PYTHON_RELEASE_DLL})
message("Unable to find ${PYTHON_RELEASE_DLL}")
unset(PYTHON_RELEASE_DLL)
endif()
if (NOT (PYTHON_DEBUG_EXE AND PYTHON_RELEASE_EXE AND PYTHON_DEBUG_LIB AND PYTHON_RELEASE_LIB AND PYTHON_DEBUG_DLL AND PYTHON_RELEASE_DLL))
message("Python installation is corrupt. Python support will be disabled for this build.")
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
return()
endif()
# Generator expressions are evaluated in the context of each build configuration generated
# by CMake. Here we use the $<CONFIG:Debug>:VALUE logical generator expression to ensure
# that the debug Python library, DLL, and executable are used in the Debug build configuration.
#
# Generator expressions can be difficult to grok at first so here's a breakdown of the one
# used for PYTHON_LIBRARY:
#
# 1. $<CONFIG:Debug> evaluates to 1 when the Debug configuration is being generated,
# or 0 in all other cases.
# 2. $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}> expands to ${PYTHON_DEBUG_LIB} when the Debug
# configuration is being generated, or nothing (literally) in all other cases.
# 3. $<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}> expands to ${PYTHON_RELEASE_LIB} when
# any configuration other than Debug is being generated, or nothing in all other cases.
# 4. The conditionals in 2 & 3 are mutually exclusive.
# 5. A logical expression with a conditional that evaluates to 0 yields no value at all.
#
# Due to 4 & 5 it's possible to concatenate 2 & 3 to obtain a single value specific to each
# build configuration. In this example the value will be ${PYTHON_DEBUG_LIB} when generating the
# Debug configuration, or ${PYTHON_RELEASE_LIB} when generating any other configuration.
# Note that it's imperative that there is no whitespace between the two expressions, otherwise
# CMake will insert a semicolon between the two.
set (PYTHON_EXECUTABLE $<$<CONFIG:Debug>:${PYTHON_DEBUG_EXE}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_EXE}>)
set (PYTHON_LIBRARY $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}>)
set (PYTHON_DLL $<$<CONFIG:Debug>:${PYTHON_DEBUG_DLL}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_DLL}>)
set (PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} PARENT_SCOPE)
set (PYTHON_LIBRARY ${PYTHON_LIBRARY} PARENT_SCOPE)
set (PYTHON_DLL ${PYTHON_DLL} PARENT_SCOPE)
set (PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} PARENT_SCOPE)
message("-- LLDB Found PythonExecutable: ${PYTHON_RELEASE_EXE} and ${PYTHON_DEBUG_EXE}")
message("-- LLDB Found PythonLibs: ${PYTHON_RELEASE_LIB} and ${PYTHON_DEBUG_LIB}")
message("-- LLDB Found PythonDLL: ${PYTHON_RELEASE_DLL} and ${PYTHON_DEBUG_DLL}")
message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIRS}")
endfunction(find_python_libs_windows)
if (NOT LLDB_DISABLE_PYTHON)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
find_python_libs_windows()
if (NOT LLDB_RELOCATABLE_PYTHON)
file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME)
add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" )
endif()
else()
find_package(PythonLibs REQUIRED)
endif()
if (PYTHON_INCLUDE_DIRS)
include_directories(${PYTHON_INCLUDE_DIRS})
endif()
endif()
if (LLDB_DISABLE_PYTHON)
unset(PYTHON_INCLUDE_DIRS)
unset(PYTHON_LIBRARY)
add_definitions( -DLLDB_DISABLE_PYTHON )
endif()
if (LLVM_EXTERNAL_CLANG_SOURCE_DIR)
include_directories(${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/include)
else ()
include_directories(${CMAKE_SOURCE_DIR}/tools/clang/include)
endif ()
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
# Disable GCC warnings
check_cxx_compiler_flag("-Wno-deprecated-declarations"
CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
if (CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif ()
check_cxx_compiler_flag("-Wno-unknown-pragmas"
CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
if (CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
endif ()
check_cxx_compiler_flag("-Wno-strict-aliasing"
CXX_SUPPORTS_NO_STRICT_ALIASING)
if (CXX_SUPPORTS_NO_STRICT_ALIASING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing")
endif ()
# Disable Clang warnings
check_cxx_compiler_flag("-Wno-deprecated-register"
CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
if (CXX_SUPPORTS_NO_DEPRECATED_REGISTER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
endif ()
check_cxx_compiler_flag("-Wno-vla-extension"
CXX_SUPPORTS_NO_VLA_EXTENSION)
if (CXX_SUPPORTS_NO_VLA_EXTENSION)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension")
endif ()
check_cxx_compiler_flag("-Wno-gnu-anonymous-struct"
CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)
check_cxx_compiler_flag("-Wno-nested-anon-types"
CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
# Disable MSVC warnings
if( MSVC )
add_definitions(
-wd4018 # Suppress 'warning C4018: '>=' : signed/unsigned mismatch'
-wd4068 # Suppress 'warning C4068: unknown pragma'
-wd4150 # Suppress 'warning C4150: deletion of pointer to incomplete type'
-wd4251 # Suppress 'warning C4251: T must have dll-interface to be used by clients of class U.'
-wd4521 # Suppress 'warning C4521: 'type' : multiple copy constructors specified'
-wd4530 # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
)
endif()
# Use the Unicode (UTF-16) APIs by default on Win32
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions( -D_UNICODE -DUNICODE )
endif()
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
"the makefiles distributed with LLDB. Please create a directory and run cmake "
"from there, passing the path to this source directory as the last argument. "
"This process created the file `CMakeCache.txt' and the directory "
"`CMakeFiles'. Please delete them.")
endif()
# Compute the LLDB version from the LLVM version.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION
${PACKAGE_VERSION})
message(STATUS "LLDB version: ${LLDB_VERSION}")
include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/
COMPONENT lldb-headers
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".cmake" EXCLUDE
PATTERN "Config.h" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
COMPONENT lldb-headers
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".cmake" EXCLUDE
)
add_custom_target(lldb-headers)
set_target_properties(lldb-headers PROPERTIES FOLDER "Misc")
if (NOT CMAKE_CONFIGURATION_TYPES)
add_llvm_install_targets(install-lldb-headers
COMPONENT lldb-headers)
endif()
endif()
if (NOT LIBXML2_FOUND AND NOT (CMAKE_SYSTEM_NAME MATCHES "Windows"))
# Skip Libxml2 on Windows. In CMake 3.4 and higher, the algorithm for
# finding libxml2 got "smarter", and it can now locate the version which is
# in gnuwin32, even though that version does not contain the headers that
# LLDB uses.
find_package(LibXml2)
endif()
# Find libraries or frameworks that may be needed
if (APPLE)
if(NOT IOS)
find_library(CARBON_LIBRARY Carbon)
find_library(CORE_SERVICES_LIBRARY CoreServices)
find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
endif()
find_library(FOUNDATION_LIBRARY Foundation)
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
find_library(SECURITY_LIBRARY Security)
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output directory for LLDB.framework")
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
set(LLDB_FRAMEWORK_RESOURCE_DIR
LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
add_definitions( -DLIBXML2_DEFINED )
list(APPEND system_libs xml2
${CURSES_LIBRARIES}
${FOUNDATION_LIBRARY}
${CORE_FOUNDATION_LIBRARY}
${CORE_SERVICES_LIBRARY}
${SECURITY_LIBRARY}
${DEBUG_SYMBOLS_LIBRARY})
else()
if (LIBXML2_FOUND)
add_definitions( -DLIBXML2_DEFINED )
list(APPEND system_libs ${LIBXML2_LIBRARIES})
include_directories(${LIBXML2_INCLUDE_DIR})
endif()
endif()
if (HAVE_LIBPTHREAD)
list(APPEND system_libs pthread)
endif(HAVE_LIBPTHREAD)
if (HAVE_LIBDL)
list(APPEND system_libs ${CMAKE_DL_LIBS})
endif()
# Figure out if lldb could use lldb-server. If so, then we'll
# ensure we build lldb-server when an lldb target is being built.
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
set(LLDB_CAN_USE_LLDB_SERVER 1)
else()
set(LLDB_CAN_USE_LLDB_SERVER 0)
endif()
# Figure out if lldb could use debugserver. If so, then we'll
# ensure we build debugserver when we build lldb.
if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set(LLDB_CAN_USE_DEBUGSERVER 1)
else()
set(LLDB_CAN_USE_DEBUGSERVER 0)
endif()
if (NOT LLDB_DISABLE_CURSES)
find_package(Curses REQUIRED)
find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel library")
if (NOT CURSES_PANEL_LIBRARY)
message(FATAL_ERROR "A required curses' panel library not found.")
endif ()
# Add panels to the library path
set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY})
list(APPEND system_libs ${CURSES_LIBRARIES})
include_directories(${CURSES_INCLUDE_DIR})
endif ()
check_cxx_symbol_exists("__GLIBCXX__" "string" LLDB_USING_LIBSTDCXX)
if(LLDB_USING_LIBSTDCXX)
# There doesn't seem to be an easy way to check the library version. Instead, we rely on the
# fact that std::set did not have the allocator constructor available until version 4.9
check_cxx_source_compiles("
#include <set>
std::set<int> s = std::set<int>(std::allocator<int>());
int main() { return 0; }"
LLDB_USING_LIBSTDCXX_4_9)
if (NOT LLDB_USING_LIBSTDCXX_4_9 AND NOT LLVM_ENABLE_EH)
message(WARNING
"You appear to be linking to libstdc++ version lesser than 4.9 without exceptions "
"enabled. These versions of the library have an issue, which causes occasional "
"lldb crashes. See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656> for "
"details. Possible courses of action are:\n"
"- use libstdc++ version 4.9 or newer\n"
"- use libc++ (via LLVM_ENABLE_LIBCXX)\n"
"- enable exceptions (via LLVM_ENABLE_EH)\n"
"- ignore this warning and accept occasional instability")
endif()
endif()
if(MSVC)
set(LLDB_USE_BUILTIN_DEMANGLER ON)
else()
option(LLDB_USE_BUILTIN_DEMANGLER "Use lldb's builtin demangler instead of the system one" ON)
endif()
if(LLDB_USE_BUILTIN_DEMANGLER)
add_definitions(-DLLDB_USE_BUILTIN_DEMANGLER)
endif()
if ((CMAKE_SYSTEM_NAME MATCHES "Android") AND LLVM_BUILD_STATIC AND
((ANDROID_ABI MATCHES "armeabi") OR (ANDROID_ABI MATCHES "mips")))
add_definitions(-DANDROID_USE_ACCEPT_WORKAROUND)
endif()
find_package(Backtrace)
include(LLDBGenerateConfig)

View File

@@ -0,0 +1,48 @@
# This file contains all the logic for running configure-time checks
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckLibraryExists)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists(ppoll poll.h HAVE_PPOLL)
set(CMAKE_REQUIRED_DEFINITIONS)
check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
check_include_file(termios.h HAVE_TERMIOS_H)
check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
check_cxx_source_compiles("
#include <sys/uio.h>
int main() { process_vm_readv(0, nullptr, 0, nullptr, 0, 0); return 0; }"
HAVE_PROCESS_VM_READV)
check_cxx_source_compiles("
#include <sys/syscall.h>
int main() { return __NR_process_vm_readv; }"
HAVE_NR_PROCESS_VM_READV)
check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
# These checks exist in LLVM's configuration, so I want to match the LLVM names
# so that the check isn't duplicated, but we translate them into the LLDB names
# so that I don't have to change all the uses at the moment.
set(LLDB_CONFIG_TERMIOS_SUPPORTED ${HAVE_TERMIOS_H})
if(NOT UNIX)
set(LLDB_DISABLE_POSIX 1)
endif()
if(NOT LLDB_CONFIG_HEADER_INPUT)
set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake)
endif()
if(NOT LLDB_CONFIG_HEADER_OUTPUT)
set(LLDB_CONFIG_HEADER_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h)
endif()
# This should be done at the end
configure_file(
${LLDB_CONFIG_HEADER_INPUT}
${LLDB_CONFIG_HEADER_OUTPUT}
)

View File

@@ -0,0 +1,131 @@
# If we are not building as a part of LLVM, build LLDB as an
# standalone project, using LLVM as an external library:
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(lldb)
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
# Rely on llvm-config.
set(CONFIG_OUTPUT)
find_program(LLVM_CONFIG "llvm-config")
if(LLVM_CONFIG)
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
set(CONFIG_COMMAND ${LLVM_CONFIG}
"--assertion-mode"
"--bindir"
"--libdir"
"--includedir"
"--prefix"
"--src-root"
"--cmakedir")
execute_process(
COMMAND ${CONFIG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE CONFIG_OUTPUT
)
if(NOT HAD_ERROR)
string(REGEX REPLACE
"[ \t]*[\r\n]+[ \t]*" ";"
CONFIG_OUTPUT ${CONFIG_OUTPUT})
else()
string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
message(STATUS "${CONFIG_COMMAND_STR}")
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
endif()
else()
message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
endif()
list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
if(NOT MSVC_IDE)
set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
CACHE BOOL "Enable assertions")
# Assertions should follow llvm-config's.
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
endif()
set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
set(LLVM_DIR ${LLVM_OBJ_ROOT}/cmake/modules/CMakeFiles CACHE PATH "Path to LLVM build tree CMake files")
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
if(EXISTS ${LLVMCONFIG_FILE})
file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH}" LLVM_CMAKE_PATH)
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
include(${LLVMCONFIG_FILE})
else()
message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
endif()
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
if(WIN32 OR CYGWIN)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
else()
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
endif()
include(AddLLVM)
include(HandleLLVMOptions)
include(CheckAtomic)
if (PYTHON_EXECUTABLE STREQUAL "")
set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
message(FATAL_ERROR
"Unable to find Python interpreter, required for builds and testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
else()
message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
endif()
# Import CMake library targets from LLVM and Clang.
include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm/LLVMConfig.cmake")
# cmake/clang/ClangConfig.cmake is not created when LLVM and Cland are built together.
if (EXISTS "${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake")
include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake")
endif()
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
# Next three include directories are needed when llvm-config is located in build directory.
# LLVM and Cland are assumed to be built together
if (EXISTS "${LLVM_OBJ_ROOT}/include")
include_directories("${LLVM_OBJ_ROOT}/include")
endif()
if (EXISTS "${LLVM_MAIN_SRC_DIR}/tools/clang/include")
include_directories("${LLVM_MAIN_SRC_DIR}/tools/clang/include")
endif()
if (EXISTS "${LLVM_OBJ_ROOT}/tools/clang/include")
include_directories("${LLVM_OBJ_ROOT}/tools/clang/include")
endif()
link_directories("${LLVM_LIBRARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
set(LLDB_BUILT_STANDALONE 1)
endif()

View File

@@ -0,0 +1,41 @@
include(FindDoxygen)
if(DOXYGEN_FOUND)
set(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}/..)
set(DOT dot)
set(PACKAGE_VERSION mainline)
set(abs_top_builddir ..)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
add_custom_target(lldb-cpp-doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating LLDB C++ API reference with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
find_package(PythonInterp REQUIRED)
find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py)
if(EPYDOC_EXECUTABLE)
find_program(DOT_EXECUTABLE dot)
if(DOT_EXECUTABLE)
set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE})
endif()
set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
file(MAKE_DIRECTORY "${DOC_DIR}")
#set(ENV{PYTHONPATH} ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/python2.7/site-packages)
add_custom_target(lldb-python-doc
${EPYDOC_EXECUTABLE}
--html
lldb
-o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
--name "LLDB python API"
--url "http://lldb.llvm.org"
${EPYDOC_OPTIONS}
DEPENDS swig_wrapper liblldb
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../../../lib${LLVM_LIBDIR_SUFFIX}/python2.7/site-packages
COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
)
endif(EPYDOC_EXECUTABLE)

View File

@@ -0,0 +1,50 @@
This document describes how to build a debug version of LLVM for use with
LLDB, and how to make LLDB use it.
It assumes that you are using the Xcode 3 series (I used 3.2.4) to build
LLDB. It also assumes that your shell is /bin/bash, and that you are
currently at a shell prompt in a checked-out LLDB repository.
1. Check out LLVM and Clang from their repositories. To determine
the revision to use, consult scripts/build-llvm.pl (this is done
in the first command line below). !!! WARNING Do not use the
name "llvm" for your checkout, for reasons described in part 3
below.
$ export CLANG_REVISION=`cat scripts/build-llvm.pl | grep ^our.*llvm_revision | cut -d \' -f 2,2`
$ svn co -r $CLANG_REVISION http://llvm.org/svn/llvm-project/llvm/trunk llvm.checkout
$ svn co -r $CLANG_REVISION http://llvm.org/svn/llvm-project/cfe/trunk llvm.checkout/tools/clang
2. Configure LLVM/Clang with the proper options and compilers. I use:
$ cd llvm.checkout
$ CC="cc -g -O0" CXX="c++ -g -O0" ./configure --disable-optimized --enable-assertions --enable-targets=x86_64,arm
$ CC="cc -g -O0" CXX="c++ -g -O0" make -j 2
$ cd ..
3. Create a link to the built LLVM. !!! WARNING: Do not rename the
directory! The LLVM builder script that runs as part of the Xcode
build keys off the fact that llvm/ is a symlink to recognize that
we are building with a custom debug build.
$ ln -sf llvm.checkout llvm
4. Make sure that your Xcode project is set up correctly. Open
lldb.xcodeproj and do the following:
Under "Targets" in the Groups & Files navigator, double-click
lldb-tool. In the resulting window, select "Debug" from the
"Configuration:" drop-down. Then, make sure that the setting
"Build Active Architecture Only" is enabled. Close the window.
Under "Targets" in the Groups & Files navigator, double-click
LLDB. In the resulting window, select "Debug" from the
"Configuration:" drop-down. Then, make sure that the setting
"Build Active Architecture Only" is enabled. Close the window.
5. Ensure that Xcode is building the lldb-tool target in Debug
configuration for your architecture (typically x86_64). You
can usually pick these options from the Overview drop-down at
the top left of the Xcode window.
6. Build lldb.xcodeproj.

View File

@@ -0,0 +1,61 @@
On MacOSX lldb needs to be code signed. The Debug, DebugClang and Release
builds are set to code sign using a code signing certificate named
"lldb_codesign".
If you have re-installed a new OS, please delete all old lldb_codesign items
from your keychain. There will be a code signing certification and a public
and private key. Reboot after deleting them. You will also need to delete and
build folders that contained old signed items. The darwin kernel will cache
code signing using the executable's file system node, so you will need to
delete the file so the kernel clears its cache.
If you don't have one yet you will need to:
- Launch /Applications/Utilities/Keychain Access.app
- In Keychain Access select the "login" keychain in the "Keychains"
list in the upper left hand corner of the window.
- Select the following menu item:
Keychain Access->Certificate Assistant->Create a Certificate...
- Set the following settings
Name = lldb_codesign
Identity Type = Self Signed Root
Certificate Type = Code Signing
- Click Create
- Click Continue
- Click Done
- Click on the "My Certificates"
- Double click on your new lldb_codesign certificate
- Turn down the "Trust" disclosure triangle, scroll to the "Code Signing" trust
pulldown menu and select "Always Trust" and authenticate as needed using your
username and password.
- Drag the new "lldb_codesign" code signing certificate (not the public or private
keys of the same name) from the "login" keychain to the "System" keychain in the
Keychains pane on the left hand side of the main Keychain Access window. This will
move this certificate to the "System" keychain. You'll have to authorize a few
more times, set it to be "Always trusted" when asked.
- Remove "~/Desktop/lldb_codesign.cer" file on your desktop if there is one.
- In the Keychain Access GUI, click and drag "lldb_codesign" in the "System" keychain
onto the desktop. The drag will create a "~/Desktop/lldb_codesign.cer" file used in
the next step.
- Switch to Terminal, and run the following:
sudo security add-trust -d -r trustRoot -p basic -p codeSign -k /Library/Keychains/System.keychain ~/Desktop/lldb_codesign.cer
rm -f ~/Desktop/lldb_codesign.cer
- Drag the "lldb_codesign" certificate from the "System" keychain back into the
"login" keychain
- Quit Keychain Access
- Reboot
- Clean by removing all previously creating code signed binaries and rebuild
lldb and you should be able to debug.
When you build your LLDB for the first time, the Xcode GUI will prompt you for permission
to use the "lldb_codesign" keychain. Be sure to click "Always Allow" on your first
build. From here on out, the "lldb_codesign" will be trusted and you can build from the
command line without having to authorize. Also the first time you debug using a LLDB that
was built with this code signing certificate, you will need to authenticate once.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
<hr>
<p class="footer">
Generated on $datetime for <a href="http://lldb.llvm.org/">$projectname</a> by
<a href="http://www.doxygen.org"><img src="doxygen.png" alt="Doxygen"
align="middle" border="0"/>$doxygenversion</a><br>
Copyright &copy; 2003-2013 University of Illinois at Urbana-Champaign.
All Rights Reserved.</p>
<hr>
<!--#include virtual="/attrib.incl" -->
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<meta name="keywords" content="LLDB,C++,doxygen,API,documentation"/>
<meta name="description" content="C++ source code API documentation for LLDB."/>
<title>LLVM: $title</title>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head><body>
<p class="title">LLDB API Documentation</p>

View File

@@ -0,0 +1,19 @@
/// @mainpage LLDB
///
/// @section main_intro Introduction
/// Welcome to LLDB.
///
/// This documentation describes the @b interface that can drive LLDB.
/// There are no instructions here on how to use LLDB, only the APIs
/// that make up the software. For usage instructions, please see
/// the help command.
///
/// @section main_caveat Caveat
/// This documentation is generated directly from the source code with doxygen.
/// Since LLDB is constantly under active development, what you're about to
/// read is out of date! However, it may still be useful since certain portions
/// of LLDB are very stable.
///
/// @section main_changelog Change Log
/// - Adapted for LLDB 05/25/2013 by Daniel Malea
/// - Original content written 12/30/2003 by Reid Spencer

Some files were not shown because too many files have changed in this diff Show More