diff --git a/llvm/utils/gn/secondary/BUILD.gn b/llvm/utils/gn/secondary/BUILD.gn --- a/llvm/utils/gn/secondary/BUILD.gn +++ b/llvm/utils/gn/secondary/BUILD.gn @@ -20,7 +20,7 @@ "//libcxxabi", ] } - if (current_os == "mac") { + if (current_os == "linux" || current_os == "mac") { deps += [ "//lldb/test" ] } if (current_os == "linux" || current_os == "android") { diff --git a/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn b/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn --- a/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/include/lldb/Host/BUILD.gn @@ -12,7 +12,6 @@ # FIXME: Actual values for everything. "LLDB_EDITLINE_USE_WCHAR=", "LLDB_HAVE_EL_RFUNC_T=", - "HAVE_PPOLL=", "HAVE_PTSNAME_R=", "HAVE_PROCESS_VM_READV=", "HAVE_NR_PROCESS_VM_READV=", @@ -44,15 +43,25 @@ if (current_os == "win") { values += [ - "HAVE_SYS_EVENT_H=", "LLDB_ENABLE_POSIX=", "LLDB_ENABLE_TERMIOS=", ] } else { values += [ - "HAVE_SYS_EVENT_H=1", "LLDB_ENABLE_POSIX=1", "LLDB_ENABLE_TERMIOS=1", ] } + + if (current_os == "win" || current_os == "linux" || current_os == "android") { + values += [ "HAVE_SYS_EVENT_H=" ] + } else { + values += [ "HAVE_SYS_EVENT_H=1" ] + } + + if (current_os == "linux" || current_os == "android") { + values += [ "HAVE_PPOLL=1" ] + } else { + values += [ "HAVE_PPOLL=" ] + } } diff --git a/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn --- a/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/source/Initialization/BUILD.gn @@ -7,10 +7,12 @@ "//lldb/source/Plugins/Process/gdb-remote", # XXX: - # lldbPluginProcessPOSIX on linux/android # lldbPluginProcessWindowsCommon on win "//llvm/lib/Support", ] + if (current_os == "linux" || current_os == "android") { + deps += [ "//lldb/source/Plugins/Process/POSIX" ] + } # SystemInitializerCommon.cpp includes headers from Plugins/Process/.... include_dirs = [ ".." ] diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn --- a/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/BUILD.gn @@ -108,6 +108,10 @@ "//lldb/source/Plugins/ObjectFile/wasm", "ObjectFileWasm", ], + [ + "//lldb/source/Plugins/Platform/Linux", + "PlatformLinux", + ], [ "//lldb/source/Plugins/Platform/MacOSX", "PlatformMacOSX", diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn --- a/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/ObjectFile/JIT/BUILD.gn @@ -10,4 +10,6 @@ "//llvm/lib/Support", ] sources = [ "ObjectFileJIT.cpp" ] + # For Utility/UuidCompatibility.h. + include_dirs = [ "//lldb/source" ] } diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/Platform/Linux/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/Platform/Linux/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/Platform/Linux/BUILD.gn @@ -0,0 +1,18 @@ +static_library("Linux") { + output_name = "lldbPluginPlatformLinux" + configs += [ + "//llvm/utils/gn/build:clang_code", + "//llvm/utils/gn/build:lldb_code", + ] + deps = [ + "//lldb/source/Breakpoint", + "//lldb/source/Core", + "//lldb/source/Host", + "//lldb/source/Interpreter", + "//lldb/source/Target", + "//lldb/source/Plugins/Platform/POSIX", + ] + # Reaches into Plugins/Platform/POSIX. + include_dirs = [ "//lldb/source" ] + sources = [ "PlatformLinux.cpp" ] +} diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/Process/Linux/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/Process/Linux/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/Process/Linux/BUILD.gn @@ -0,0 +1,29 @@ +static_library("Linux") { + output_name = "lldbPluginProcessLinux" + configs += [ "//llvm/utils/gn/build:lldb_code" ] + deps = [ + "//lldb/source/Core", + "//lldb/source/Host", + "//lldb/source/Symbol", + "//lldb/source/Target", + "//lldb/source/Utility", + "//lldb/source/Plugins/Process/POSIX", + "//lldb/source/Plugins/Process/Utility", + "//llvm/lib/Support", + ] + # Uses source-relative includes for own headers. + include_dirs = [ "//lldb/source" ] + sources = [ + "IntelPTManager.cpp", + "NativeProcessLinux.cpp", + "NativeRegisterContextLinux.cpp", + "NativeRegisterContextLinux_arm.cpp", + "NativeRegisterContextLinux_arm64.cpp", + "NativeRegisterContextLinux_ppc64le.cpp", + "NativeRegisterContextLinux_s390x.cpp", + "NativeRegisterContextLinux_x86_64.cpp", + "NativeThreadLinux.cpp", + "SingleStepCheck.cpp", + ] +} + diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/Process/POSIX/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/Process/POSIX/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/Process/POSIX/BUILD.gn @@ -0,0 +1,17 @@ +static_library("POSIX") { + output_name = "lldbPluginProcessPOSIX" + configs += [ "//llvm/utils/gn/build:lldb_code" ] + deps = [ + "//lldb/source/Utility", + "//lldb/source/Plugins/Process/Utility", + "//llvm/lib/Support", + ] + # Reaches into Plugins/Platform/Process/Utility. + include_dirs = [ "//lldb/source" ] + sources = [ + "CrashReason.cpp", + "NativeProcessELF.cpp", + "ProcessMessage.cpp", + "ProcessPOSIXLog.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/lldb/tools/driver/BUILD.gn b/llvm/utils/gn/secondary/lldb/tools/driver/BUILD.gn --- a/llvm/utils/gn/secondary/lldb/tools/driver/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/tools/driver/BUILD.gn @@ -7,7 +7,7 @@ args = [ "-gen-opt-parser-defs" ] } -if (host_os == "mac") { +if (current_os == "mac") { write_cmake_config("write_info_plist") { input = "lldb-Info.plist.in" output = "$target_gen_dir/lldb-Info.plist" @@ -25,12 +25,15 @@ "//llvm/lib/Support", "//llvm/utils/gn/build/libs/xar", ] - if (host_os == "mac") { + if (current_os == "mac") { deps += [ ":write_info_plist" ] plist = get_target_outputs(":write_info_plist") ldflags = [ "-Wl,-sectcreate,__TEXT,__info_plist," + rebase_path(plist[0], root_out_dir) ] } + if (current_os == "linux") { + deps += [ "//lldb/tools/lldb-server" ] + } sources = [ "Driver.cpp", diff --git a/llvm/utils/gn/secondary/lldb/tools/lldb-server/BUILD.gn b/llvm/utils/gn/secondary/lldb/tools/lldb-server/BUILD.gn --- a/llvm/utils/gn/secondary/lldb/tools/lldb-server/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/tools/lldb-server/BUILD.gn @@ -29,13 +29,13 @@ "//lldb/source/Plugins/Language/CPlusPlus", ] - #if (current_os == "android" || current_os == "linux") { - #deps += [ "//lldb/source/Plugins/Process/Linux" ] + if (current_os == "android" || current_os == "linux") { + deps += [ "//lldb/source/Plugins/Process/Linux" ] #} else if (current_os == "freebsd") { #deps += [ "//lldb/source/Plugins/Process/FreeBSD" ] #} else if (current_os == "netbsd") { #deps += [ "//lldb/source/Plugins/Process/NetBSD" ] - #} + } if (current_os == "mac") { deps += [ "//lldb/source/Plugins/ObjectFile/Mach-O" ]