summaryrefslogtreecommitdiff
path: root/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2018-07-12 23:45:39 -0700
committerGitHub <noreply@github.com>2018-07-12 23:45:39 -0700
commitb89e2305a2c953272c997242d01b66b1bb1e661e (patch)
treeb4064df6f0917351a74722c91d9928789e53c8cc /src/ToolBox/SOS/lldbplugin/CMakeLists.txt
parent0e22b107e811bc8ab7f3c1caf0943ef760d9f53d (diff)
downloadcoreclr-b89e2305a2c953272c997242d01b66b1bb1e661e.tar.gz
coreclr-b89e2305a2c953272c997242d01b66b1bb1e661e.tar.bz2
coreclr-b89e2305a2c953272c997242d01b66b1bb1e661e.zip
Add prefix to DAC's PAL exports for alpine (#18873)
Added some cmake logic to create assembly include mapping files. One that maps the prefixed name (DAC_foo) to the actual name (foo) which is included in the DAC module and another that maps the actual name to the prefixed name that is included in the SOS, DBI and createdump modules. The data exports like IID_IUnknown are not prefixed and don't need to be (immutable static data). There were some C++ exports functions exported with their decorated names in the CatchHardwareExceptionHolder and NativeExceptionHolderBase classes. Created PAL_* style export functions that implements the code. Fix lldb plugin cmake file to use LLDB_H/LLDB_LIB env vars to build it.
Diffstat (limited to 'src/ToolBox/SOS/lldbplugin/CMakeLists.txt')
-rw-r--r--src/ToolBox/SOS/lldbplugin/CMakeLists.txt93
1 files changed, 54 insertions, 39 deletions
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
index e87ac8bf02..96aec3019b 100644
--- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
+++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
@@ -45,57 +45,72 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
SET(REQUIRE_LLDBPLUGIN false)
endif()
-set(LLVM_HOST_DIR "$ENV{LLVM_HOME}")
-set(WITH_LLDB_LIBS "${LLVM_HOST_DIR}/lib" CACHE PATH "Path to LLDB libraries")
-set(WITH_LLDB_INCLUDES "${LLVM_HOST_DIR}/include" CACHE PATH "Path to LLDB headers")
+if(NOT $ENV{LLVM_HOME} STREQUAL "")
+ set(LLDB_INCLUDE_DIR "$ENV{LLVM_HOME}/include")
+ set(LLDB_LIB_DIR "$ENV{LLVM_HOME}/lib")
+else()
+ if(NOT $ENV{LLDB_INCLUDE_DIR} STREQUAL "")
+ set(LLDB_INCLUDE_DIR "$ENV{LLDB_INCLUDE_DIR}")
+ endif()
+ if(NOT $ENV{LLDB_LIB_DIR} STREQUAL "")
+ set(LLDB_LIB_DIR "$ENV{LLDB_LIB_DIR}")
+ endif()
+endif()
if(NOT ENABLE_LLDBPLUGIN)
return()
endif()
-if (CLR_CMAKE_PLATFORM_DARWIN)
+if(NOT $ENV{LLDB_LIB} STREQUAL "")
+ set(LLDB_LIB "$ENV{LLDB_LIB}")
+else()
# Check for LLDB library
- find_library(LLDB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
- find_library(LLDB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
- if(LLDB STREQUAL LLDB-NOTFOUND)
+ if(CLR_CMAKE_PLATFORM_DARWIN)
+ find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
+ find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
+ if(LLDB_LIB STREQUAL LLDB_LIB-NOTFOUND)
+ if(REQUIRE_LLDBPLUGIN)
+ set(MESSAGE_MODE FATAL_ERROR)
+ else()
+ set(MESSAGE_MODE WARNING)
+ endif()
+ message(${MESSAGE_MODE} "Cannot find lldb library. Try installing Xcode. You may need to set LLVM_HOME, LLDB_LIB_DIR or LLDB_LIB if the build still can't find it.")
+ return()
+ endif()
+ endif()
+endif()
+
+message(STATUS "LLDB_LIB: ${LLDB_LIB}")
+
+if(NOT $ENV{LLDB_H} STREQUAL "")
+ set(LLDB_H "$ENV{LLDB_H}")
+else()
+ # Check for LLDB headers
+ # Multiple versions of LLDB can install side-by-side, so we need to check for lldb in various locations.
+ # If the file in a directory is found the result is stored in the variable and the search will not be repeated unless the variable is cleared.
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}" NO_DEFAULT_PATH)
+ find_path(LLDB_H "lldb/API/LLDB.h")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-6.0/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-5.0/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-4.0/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.9/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.8/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.7/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.6/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.5/include")
+ #FreeBSD
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/local/llvm39/include")
+ find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/local/llvm38/include")
+
+ if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
if(REQUIRE_LLDBPLUGIN)
set(MESSAGE_MODE FATAL_ERROR)
else()
set(MESSAGE_MODE WARNING)
endif()
- message(${MESSAGE_MODE} "Cannot find lldb-3.5, lldb-3.6, lldb-3.8, lldb-3.9, lldb-4.0, lldb-5.0 or lldb-6.0. Try installing liblldb-3.9-dev (or the appropriate package for your platform). You may need to set LLVM_HOME if the build still can't find it.")
-
+ message(${MESSAGE_MODE} "Cannot find LLDB.h Try installing lldb-3.9-dev (or the appropriate package for your platform). You may need to set LLVM_HOME or LLDB_INCLUDE_DIR if the build still can't find it.")
return()
endif()
-
- message(STATUS "LLDB: ${LLDB}")
-endif()
-
-# Check for LLDB headers
-# Multiple versions of LLDB can install side-by-side, so we need to check for lldb in various locations.
-# If the file in a directory is found the result is stored in the variable and the search will not be repeated unless the variable is cleared.
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}" NO_DEFAULT_PATH)
-find_path(LLDB_H "lldb/API/LLDB.h")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-6.0/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-5.0/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-4.0/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.9/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.8/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.7/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.6/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.5/include")
-#FreeBSD
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/local/llvm39/include")
-find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/local/llvm38/include")
-
-if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
- if(REQUIRE_LLDBPLUGIN)
- set(MESSAGE_MODE FATAL_ERROR)
- else()
- set(MESSAGE_MODE WARNING)
- endif()
- message(${MESSAGE_MODE} "Cannot find LLDB.h Try installing lldb-3.9-dev (or the appropriate package for your platform). You may need to set LLVM_HOME if the build still can't find it.")
- return()
endif()
message(STATUS "LLDB_H: ${LLDB_H}")
@@ -121,7 +136,7 @@ _add_library(sosplugin SHARED ${SOURCES})
add_dependencies(sosplugin sos)
if (CLR_CMAKE_PLATFORM_DARWIN)
- target_link_libraries(sosplugin ${LLDB})
+ target_link_libraries(sosplugin ${LLDB_LIB})
endif()
# add the install targets