This is an archive of the discontinued LLVM Phabricator instance.

[NativeProcessLinux] Use fast memory reads, if the system supports it
ClosedPublic

Authored by labath on Jun 16 2015, 3:45 PM.

Details

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.

Diff Detail

Event Timeline

labath updated this revision to Diff 27789.Jun 16 2015, 3:45 PM
labath retitled this revision from to [NativeProcessLinux] Use fast memory reads, if the system supports it.
labath updated this object.
labath edited the test plan for this revision. (Show Details)
labath added reviewers: ovyalov, vharron.
labath added a subscriber: Unknown Object (MLST).
ovyalov added inline comments.Jun 16 2015, 5:12 PM
source/Plugins/Process/Linux/NativeProcessLinux.cpp
84

Could you wrap check with std::call_once to make sure that it's thread-safe?

85

Indentation.

102

ditto.

3282

indentation.

3299

Please add separation spaces - success?"Success":strerror(errno))

labath updated this revision to Diff 27843.Jun 17 2015, 10:24 AM
  • Address review comments.
source/Plugins/Process/Linux/NativeProcessLinux.cpp
84

done.

85

Oops. I blame new editor. :(

102

done.

3282

done.

3299

done.

ovyalov accepted this revision.Jun 17 2015, 10:30 AM
ovyalov edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Jun 17 2015, 10:30 AM
This revision was automatically updated to reflect the committed changes.