summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-05-18 23:20:01 +0000
committerGreg Clayton <gclayton@apple.com>2012-05-18 23:20:01 +0000
commit4c82d425fa074662f28da3af0ff8c551f06d600d (patch)
treeea09ff6a73d4b777248e2233cdcfb6a8e14cfb80 /lldb/source/Target/Process.cpp
parent457ace7611d82047265f718cf1ea3f67c5d7b70f (diff)
downloadbcm5719-llvm-4c82d425fa074662f28da3af0ff8c551f06d600d.tar.gz
bcm5719-llvm-4c82d425fa074662f28da3af0ff8c551f06d600d.zip
Found a quick way to improve the speed with which we can read object files from memory when they are in the shared cache: always read the symbol table strings from memory and let the process' memory cache do the work.
llvm-svn: 157083
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 4225b807c76..a3c76d62d54 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1960,6 +1960,28 @@ Process::ReadMemory (addr_t addr, void *buf, size_t size, Error &error)
#endif // #else for #if defined (ENABLE_MEMORY_CACHING)
+size_t
+Process::ReadCStringFromMemory (addr_t addr, std::string &out_str, Error &error)
+{
+ char buf[32];
+ out_str.clear();
+ addr_t curr_addr = addr;
+ while (1)
+ {
+ size_t length = ReadCStringFromMemory (curr_addr, buf, sizeof(buf), error);
+ if (length == 0)
+ break;
+ out_str.append(buf, length);
+ // If we got "length - 1" bytes, we didn't get the whole C string, we
+ // need to read some more characters
+ if (length == sizeof(buf) - 1)
+ curr_addr += length;
+ else
+ break;
+ }
+ return out_str.size();
+}
+
size_t
Process::ReadCStringFromMemory (addr_t addr, char *dst, size_t dst_max_len, Error &result_error)
OpenPOWER on IntegriCloud