This revision was automatically updated to reflect the committed changes.
Closed by commit rL304544: cmake: Put PROCESS_VM_READV detection results into 
Config.h (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D33771?vs=101012&id=101192#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33771

Files:
  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

Index: lldb/trunk/source/Host/linux/LibcGlue.cpp
===================================================================
--- lldb/trunk/source/Host/linux/LibcGlue.cpp
+++ lldb/trunk/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.
Index: lldb/trunk/include/lldb/Host/Config.h.cmake
===================================================================
--- lldb/trunk/include/lldb/Host/Config.h.cmake
+++ lldb/trunk/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
Index: lldb/trunk/include/lldb/Host/linux/Uio.h
===================================================================
--- lldb/trunk/include/lldb/Host/linux/Uio.h
+++ lldb/trunk/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);
Index: lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
===================================================================
--- lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
@@ -12,6 +12,15 @@
 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.
Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -334,28 +334,6 @@
   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")
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to