[Lldb-commits] [lldb] r304544 - cmake: Put PROCESS_VM_READV detection results into Config.h

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 2 05:29:08 PDT 2017


Author: labath
Date: Fri Jun  2 07:29:08 2017
New Revision: 304544

URL: http://llvm.org/viewvc/llvm-project?rev=304544&view=rev
Log:
cmake: Put PROCESS_VM_READV detection results into Config.h

Reviewers: beanz, eugene

Subscribers: mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D33771

Modified:
    lldb/trunk/cmake/modules/LLDBConfig.cmake
    lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
    lldb/trunk/include/lldb/Host/Config.h.cmake
    lldb/trunk/include/lldb/Host/linux/Uio.h
    lldb/trunk/source/Host/linux/LibcGlue.cpp

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=304544&r1=304543&r2=304544&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Fri Jun  2 07:29:08 2017
@@ -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")

Modified: lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake?rev=304544&r1=304543&r2=304544&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake Fri Jun  2 07:29:08 2017
@@ -12,6 +12,15 @@ check_symbol_exists(sigaction signal.h H
 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.

Modified: lldb/trunk/include/lldb/Host/Config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h.cmake?rev=304544&r1=304543&r2=304544&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Config.h.cmake (original)
+++ lldb/trunk/include/lldb/Host/Config.h.cmake Fri Jun  2 07:29:08 2017
@@ -20,4 +20,8 @@
 
 #cmakedefine01 HAVE_SIGACTION
 
+#cmakedefine01 HAVE_PROCESS_VM_READV
+
+#cmakedefine01 HAVE_NR_PROCESS_VM_READV
+
 #endif // #ifndef LLDB_HOST_CONFIG_H

Modified: lldb/trunk/include/lldb/Host/linux/Uio.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Uio.h?rev=304544&r1=304543&r2=304544&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Uio.h (original)
+++ lldb/trunk/include/lldb/Host/linux/Uio.h Fri Jun  2 07:29:08 2017
@@ -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);

Modified: lldb/trunk/source/Host/linux/LibcGlue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/LibcGlue.cpp?rev=304544&r1=304543&r2=304544&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/LibcGlue.cpp (original)
+++ lldb/trunk/source/Host/linux/LibcGlue.cpp Fri Jun  2 07:29:08 2017
@@ -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.




More information about the lldb-commits mailing list