Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
3 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//===-- Uio.h ---------------------------------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef liblldb_Host_linux_Uio_h_ | ||
#define liblldb_Host_linux_Uio_h_ | ||
|
||
#include <sys/uio.h> | ||
|
||
// Android does not define the process_vm_readv wrapper | ||
#ifdef __ANDROID_NDK__ | ||
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); | ||
#endif | ||
|
||
#endif // liblldb_Host_linux_Uio_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters