[gn build] Make lldb build on Windows

Differential Revision: https://reviews.llvm.org/D109478
This commit is contained in:
Nico Weber 2021-09-09 08:12:58 -04:00
parent 6e12c73316
commit 7484206cfd
8 changed files with 82 additions and 10 deletions

View File

@ -5,13 +5,13 @@ static_library("Initialization") {
"//lldb/source/Core",
"//lldb/source/Host",
"//lldb/source/Plugins/Process/gdb-remote",
# XXX:
# lldbPluginProcessWindowsCommon on win
"//llvm/lib/Support",
]
if (current_os == "linux" || current_os == "android") {
deps += [ "//lldb/source/Plugins/Process/POSIX" ]
} else if (current_os == "win") {
deps += [ "//lldb/source/Plugins/Process/Windows/Common" ]
}
# SystemInitializerCommon.cpp includes headers from Plugins/Process/....

View File

@ -40,6 +40,10 @@ lldb_plugins += [
"//lldb/source/Plugins/DynamicLoader/Static",
"DynamicLoaderStatic",
],
[
"//lldb/source/Plugins/DynamicLoader/Windows-DYLD",
"DynamicLoaderWindowsDYLD",
],
[
"//lldb/source/Plugins/Instruction/ARM",
"InstructionARM",
@ -211,7 +215,7 @@ write_cmake_config("Plugins.def") {
# These are in separate variables to make sure ProcessWindowsCommon is
# initalized after all plugins, but before ProcessGDBRemote.
if (current_os == "win") {
values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=LLDB_PLUGIN(XXX)" ]
values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=LLDB_PLUGIN(ProcessWindowsCommon)" ]
} else {
values += [ "LLDB_PROCESS_WINDOWS_PLUGIN=" ]
}

View File

@ -0,0 +1,13 @@
static_library("Windows-DYLD") {
output_name = "lldbPluginDynamicLoaderWindowsDYLD"
configs += [ "//llvm/utils/gn/build:lldb_code" ]
deps = [
"//lldb/source/Core",
"//lldb/source/Target",
"//llvm/lib/Support",
]
# Uses source-relative includes for own headers.
include_dirs = [ "//lldb/source" ]
sources = [ "DynamicLoaderWindowsDYLD.cpp" ]
}

View File

@ -9,7 +9,7 @@ static_library("JIT") {
#"//lldb/source/Target", # 2-hop dependency cycle.
"//llvm/lib/Support",
]
sources = [ "ObjectFileJIT.cpp" ]
# For Utility/UuidCompatibility.h.
include_dirs = [ "//lldb/source" ]
sources = [ "ObjectFileJIT.cpp" ]
}

View File

@ -11,6 +11,10 @@ static_library("Mach-O") {
"//llvm/lib/Support",
]
if (current_os == "win") {
defines = [ "_ENABLE_EXTENDED_ALIGNED_STORAGE" ]
}
# Reaches into Plugins/Process/Utility.
include_dirs = [ "//lldb/source" ]
sources = [ "ObjectFileMachO.cpp" ]

View File

@ -20,6 +20,6 @@ static_library("PECOFF") {
if (current_os == "win") {
# Dbghelp is used on windows for writing minidump files.
libs = [ "dbghelp" ]
libs = [ "dbghelp.lib" ]
}
}

View File

@ -0,0 +1,48 @@
static_library("Common") {
output_name = "lldbPluginProcessWindowsCommon"
configs += [ "//llvm/utils/gn/build:lldb_code" ]
deps = [
"//lldb/source/Core",
"//lldb/source/Host",
"//lldb/source/Interpreter",
"//lldb/source/Plugins/DynamicLoader/Windows-DYLD",
"//lldb/source/Symbol",
"//lldb/source/Target",
"//llvm/lib/Support",
]
libs = [
"psapi.lib",
"rpcrt4.lib",
"ws2_32.lib",
]
include_dirs = [
# ../Process/Windows/Common/x64/RegisterContextWindows_x64.h uses an
# unqualified include for "RegisterContextWindows.h".
".",
# Reaches into Plugins/Process/Utility.
"//lldb/source",
]
sources = [
"DebuggerThread.cpp",
"LocalDebugDelegate.cpp",
"NativeProcessWindows.cpp",
"NativeRegisterContextWindows.cpp",
"NativeRegisterContextWindows_WoW64.cpp",
"NativeRegisterContextWindows_arm.cpp",
"NativeRegisterContextWindows_arm64.cpp",
"NativeRegisterContextWindows_i386.cpp",
"NativeRegisterContextWindows_x86_64.cpp",
"NativeThreadWindows.cpp",
"ProcessDebugger.cpp",
"ProcessWindows.cpp",
"ProcessWindowsLog.cpp",
"RegisterContextWindows.cpp",
"TargetThreadWindows.cpp",
"arm/RegisterContextWindows_arm.cpp",
"arm64/RegisterContextWindows_arm64.cpp",
"x64/RegisterContextWindows_x64.cpp",
"x86/RegisterContextWindows_x86.cpp",
]
}

View File

@ -59,6 +59,13 @@ static_library("Utility") {
"XcodeSDK.cpp",
]
if (current_os == "win") {
libs = [
"rpcrt4.lib",
"ws2_32.lib",
]
}
# FIXME:
# if (APPLE)
# list(APPEND LLDB_SYSTEM_LIBS
@ -75,10 +82,6 @@ static_library("Utility") {
#
# list(APPEND LLDB_SYSTEM_LIBS ${CMAKE_DL_LIBS})
#
# if (CMAKE_SYSTEM_NAME MATCHES "Windows")
# list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4)
# endif ()
#
# if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
# list(APPEND LLDB_SYSTEM_LIBS atomic)
# endif()