From df7c69952bd7e25993a09eccb00e206c65853874 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 17 Jun 2015 18:38:49 +0000 Subject: [NativeProcessLinux] Use fast memory reads, if the system supports it Summary: Memory reads using the ptrace API need to be executed on a designated thread and in 4-byte increments. The process_vm_read syscall has no such requirements and it is about 50 times faster. This patch makes lldb-server use the faster API if the target kernel supports it. Kernel support for this feature is determined at runtime. Using process_vm_writev in the same manner is more complicated since this syscall (unlike ptrace) respects page protection settings and so it cannot be used to set a breakpoint, since code pages are typically read-only. However, memory writes are not currently a performance bottleneck as they happen much more rarely. Test Plan: all tests continue to pass Reviewers: ovyalov, vharron Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D10488 llvm-svn: 239924 --- lldb/source/Host/android/LibcGlue.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lldb/source/Host/android') diff --git a/lldb/source/Host/android/LibcGlue.cpp b/lldb/source/Host/android/LibcGlue.cpp index d443a92724e..d127d6b01ad 100644 --- a/lldb/source/Host/android/LibcGlue.cpp +++ b/lldb/source/Host/android/LibcGlue.cpp @@ -11,12 +11,14 @@ #include +#include +#include + #if __ANDROID_API__ < 21 #include #include #include -#include #include #include "lldb/Host/Time.h" @@ -37,3 +39,11 @@ int posix_openpt(int flags) } #endif + +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) +{ + return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov, riovcnt, flags); +} -- cgit v1.2.1