blob: 438ae33478ed3a7c29cca98cd747f2e33052da82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
project(sosplugin)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DPAL_STDCPP_COMPAT)
if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
add_definitions(-D_TARGET_AMD64_=1)
add_definitions(-DDBG_TARGET_64BIT=1)
add_definitions(-DDBG_TARGET_AMD64=1)
add_definitions(-DDBG_TARGET_WIN64=1)
add_definitions(-DBIT64)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
add_definitions(-D_TARGET_ARM_=1)
add_definitions(-DDBG_TARGET_32BIT=1)
add_definitions(-DDBG_TARGET_ARM=1)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
message(WARNING "lldb is not supported on linux/aarch64 yet")
return()
endif()
set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.")
set(REQUIRE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_LINUX} CACHE BOOL "Require building the SOS plugin for LLDB.")
set(WITH_LLDB_LIBS "" CACHE PATH "Path to LLDB libraries")
set(WITH_LLDB_INCLUDES "" CACHE PATH "Path to LLDB headers")
if(NOT ENABLE_LLDBPLUGIN)
return()
endif()
# Check for LLDB library
find_library(LLDB NAMES LLDB lldb lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm)
if(LLDB STREQUAL LLDB-NOTFOUND)
if(REQUIRE_LLDBPLUGIN)
message(FATAL_ERROR "Cannot find lldb-3.5 or lldb-3.6. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
else()
message(WARNING "Cannot find lldb-3.5 or lldb-3.6. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
endif()
return()
endif()
message(STATUS "LLDB: ${LLDB}")
# Check for LLDB headers
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}")
if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.6/include")
if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.5/include")
if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
if(REQUIRE_LLDBPLUGIN)
message(FATAL_ERROR "Cannot find LLDB.h. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
else()
message(WARNING "Cannot find LLDB.h Try installing lldb-3.6-dev (or the appropriate package for your platform)")
endif()
return()
endif()
endif()
endif()
message(STATUS "LLDB_H: ${LLDB_H}")
add_compile_options(-Wno-delete-non-virtual-dtor)
include_directories(inc)
include_directories("${LLDB_H}")
include_directories(${CLR_DIR}/src/debug/inc)
include_directories(${CLR_DIR}/src/inc)
include_directories(${CLR_DIR}/src/coreclr/hosts/unixcoreruncommon)
set(SOURCES
sosplugin.cpp
soscommand.cpp
setclrpathcommand.cpp
setsostidcommand.cpp
services.cpp
)
if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
list(APPEND SOURCES
coreruncommand.cpp
${CLR_DIR}/src/coreclr/hosts/unixcorerun/corerun.cpp
${CLR_DIR}/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
)
endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
add_library(sosplugin SHARED ${SOURCES})
add_dependencies(sosplugin sos)
if (CLR_CMAKE_PLATFORM_UNIX)
target_link_libraries(sosplugin ${LLDB})
endif()
# add the install targets
install_clr(sosplugin)
|