llvm-project/lldb/source/Host
Antonio Afonso a7335393f5 Add ReadCStringFromMemory for faster string reads
Summary:
This is the fifth patch to improve module loading in a series that started here (where I explain the motivation and solution): D62499

Reading strings with ReadMemory is really slow when reading the path of the shared library. This is because we don't know the length of the path so use PATH_MAX (4096) and these strings are actually super close to the boundary of an unreadable page. So even though we use process_vm_readv it will usually fail because the read size spans to the unreadable page and we then default to read the string word by word with ptrace.

This new function is very similar to another ReadCStringFromMemory that already exists in lldb that makes sure it never reads cross page boundaries and checks if we already read the entire string by finding '\0'.

I was able to reduce the GetLoadedSharedLibraries call from 30ms to 4ms (or something of that order).

Reviewers: clayborg, xiaobai, labath

Reviewed By: labath

Subscribers: emaste, lldb-commits

Tags: #lldb

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

llvm-svn: 363750
2019-06-18 23:27:57 +00:00
..
android Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
common Add ReadCStringFromMemory for faster string reads 2019-06-18 23:27:57 +00:00
freebsd Move ProcessInfo from Host to Utility. 2019-03-04 21:51:03 +00:00
linux [lldb] NFC modernize codebase with modernize-use-nullptr 2019-05-23 11:14:47 +00:00
macosx Fix integer literals which are cast to bool 2019-05-24 00:44:33 +00:00
netbsd Move ProcessInfo from Host to Utility. 2019-03-04 21:51:03 +00:00
openbsd Move ProcessInfo from Host to Utility. 2019-03-04 21:51:03 +00:00
posix Fix problem with r362192 2019-05-31 05:55:07 +00:00
windows [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t' 2019-05-23 15:17:39 +00:00
CMakeLists.txt [CMake] Move link dependencies where they are used. 2019-03-29 17:47:26 +00:00