summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/cmake/modules/LLDBConfig.cmake22
-rw-r--r--lldb/cmake/modules/LLDBGenerateConfig.cmake9
-rw-r--r--lldb/include/lldb/Host/Config.h.cmake4
-rw-r--r--lldb/include/lldb/Host/linux/Uio.h3
-rw-r--r--lldb/source/Host/linux/LibcGlue.cpp8
5 files changed, 19 insertions, 27 deletions
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 79512941fd8..bbf7a0838d2 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -334,28 +334,6 @@ if (HAVE_LIBDL)
list(APPEND system_libs ${CMAKE_DL_LIBS})
endif()
-# Check for syscall used by lldb-server on linux.
-# If these are not found, it will fall back to ptrace (slow) for memory reads.
-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)
-
-if (HAVE_PROCESS_VM_READV)
- add_definitions(-DHAVE_PROCESS_VM_READV)
-else()
- # If we don't have the syscall wrapper function, but we know the syscall number, we can
- # still issue the syscall manually
- check_cxx_source_compiles("
- #include <sys/syscall.h>
- int main() { return __NR_process_vm_readv; }"
- HAVE_NR_PROCESS_VM_READV)
-
- if (HAVE_NR_PROCESS_VM_READV)
- add_definitions(-DHAVE_NR_PROCESS_VM_READV)
- endif()
-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")
diff --git a/lldb/cmake/modules/LLDBGenerateConfig.cmake b/lldb/cmake/modules/LLDBGenerateConfig.cmake
index f812cf11614..d3d0cb220b9 100644
--- a/lldb/cmake/modules/LLDBGenerateConfig.cmake
+++ b/lldb/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,15 @@ check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
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)
+
# 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.
diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake
index 5a16425fe0a..0deedd151a5 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -20,4 +20,8 @@
#cmakedefine01 HAVE_SIGACTION
+#cmakedefine01 HAVE_PROCESS_VM_READV
+
+#cmakedefine01 HAVE_NR_PROCESS_VM_READV
+
#endif // #ifndef LLDB_HOST_CONFIG_H
diff --git a/lldb/include/lldb/Host/linux/Uio.h b/lldb/include/lldb/Host/linux/Uio.h
index 8b964d3f3e2..0b8b7dbf6fb 100644
--- a/lldb/include/lldb/Host/linux/Uio.h
+++ b/lldb/include/lldb/Host/linux/Uio.h
@@ -10,11 +10,12 @@
#ifndef liblldb_Host_linux_Uio_h_
#define liblldb_Host_linux_Uio_h_
+#include "lldb/Host/Config.h"
#include <sys/uio.h>
// We shall provide our own implementation of process_vm_readv if it is not
// present
-#ifndef HAVE_PROCESS_VM_READV
+#if !HAVE_PROCESS_VM_READV
ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
unsigned long liovcnt, const struct iovec *remote_iov,
unsigned long riovcnt, unsigned long flags);
diff --git a/lldb/source/Host/linux/LibcGlue.cpp b/lldb/source/Host/linux/LibcGlue.cpp
index c036bb28a9b..93d2a41d2eb 100644
--- a/lldb/source/Host/linux/LibcGlue.cpp
+++ b/lldb/source/Host/linux/LibcGlue.cpp
@@ -14,13 +14,13 @@
#include <sys/syscall.h>
#include <unistd.h>
-#ifndef HAVE_PROCESS_VM_READV // If the syscall wrapper is not available,
- // provide one.
+#if !HAVE_PROCESS_VM_READV
+// If the syscall wrapper is not available, provide one.
ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
unsigned long liovcnt, const struct iovec *remote_iov,
unsigned long riovcnt, unsigned long flags) {
-#ifdef HAVE_NR_PROCESS_VM_READV // If we have the syscall number, we can issue
- // the syscall ourselves.
+#if HAVE_NR_PROCESS_VM_READV
+ // If we have the syscall number, we can issue the syscall ourselves.
return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov,
riovcnt, flags);
#else // If not, let's pretend the syscall is not present.
OpenPOWER on IntegriCloud