summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2014-09-03 22:30:54 +0000
committerJason Molenda <jmolenda@apple.com>2014-09-03 22:30:54 +0000
commitf0340c9ab5ee7c087703951948571fc02bada900 (patch)
treee8a7a0b11730e9ceba0f0a33cfda25410f702352 /lldb/source/Target
parentb67bc4ea0d23c2dc11d2123aaf37d1b3ef83c940 (diff)
downloadbcm5719-llvm-f0340c9ab5ee7c087703951948571fc02bada900.tar.gz
bcm5719-llvm-f0340c9ab5ee7c087703951948571fc02bada900.zip
Add a new target.process.memory-cache-line-size to change the size of
lldb's internal memory cache chunks that are read from the remote system. For a remote connection that is especially slow, a user may need to reduce it; reading a 512 byte chunk of memory whenever a 4-byte region is requested may not be the right decision in these kinds of environments. <rdar://problem/18175117> llvm-svn: 217083
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Memory.cpp3
-rw-r--r--lldb/source/Target/Process.cpp11
-rw-r--r--lldb/source/Target/Target.cpp5
3 files changed, 17 insertions, 2 deletions
diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp
index b212fcd23a4..0ff1d078bae 100644
--- a/lldb/source/Target/Memory.cpp
+++ b/lldb/source/Target/Memory.cpp
@@ -26,7 +26,7 @@ using namespace lldb_private;
//----------------------------------------------------------------------
MemoryCache::MemoryCache(Process &process) :
m_process (process),
- m_cache_line_byte_size (512),
+ m_cache_line_byte_size (process.GetMemoryCacheLineSize()),
m_mutex (Mutex::eMutexTypeRecursive),
m_cache (),
m_invalid_ranges ()
@@ -47,6 +47,7 @@ MemoryCache::Clear(bool clear_invalid_ranges)
m_cache.clear();
if (clear_invalid_ranges)
m_invalid_ranges.Clear();
+ m_cache_line_byte_size = m_process.GetMemoryCacheLineSize();
}
void
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index a1049787d82..02f96358433 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -108,6 +108,7 @@ g_properties[] =
{ "python-os-plugin-path", OptionValue::eTypeFileSpec, false, true, NULL, NULL, "A path to a python OS plug-in module file that contains a OperatingSystemPlugIn class." },
{ "stop-on-sharedlibrary-events" , OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, stop when a shared library is loaded or unloaded." },
{ "detach-keeps-stopped" , OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, detach will attempt to keep the process stopped." },
+ { "memory-cache-line-size" , OptionValue::eTypeUInt64, false, 512, NULL, NULL, "The memory cache line size" },
{ NULL , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL }
};
@@ -118,7 +119,8 @@ enum {
ePropertyUnwindOnErrorInExpressions,
ePropertyPythonOSPluginPath,
ePropertyStopOnSharedLibraryEvents,
- ePropertyDetachKeepsStopped
+ ePropertyDetachKeepsStopped,
+ ePropertyMemCacheLineSize
};
ProcessProperties::ProcessProperties (bool is_global) :
@@ -148,6 +150,13 @@ ProcessProperties::GetDisableMemoryCache() const
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
+uint64_t
+ProcessProperties::GetMemoryCacheLineSize() const
+{
+ const uint32_t idx = ePropertyMemCacheLineSize;
+ return m_collection_sp->GetPropertyAtIndexAsUInt64 (NULL, idx, g_properties[idx].default_uint_value);
+}
+
Args
ProcessProperties::GetExtraStartupCommands () const
{
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index d2d0b509855..946b0e3f280 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1436,7 +1436,12 @@ Target::ReadCStringFromMemory (const Address& addr, char *dst, size_t dst_max_le
Error error;
addr_t curr_addr = addr.GetLoadAddress(this);
Address address(addr);
+
+ // We could call m_process_sp->GetMemoryCacheLineSize() but I don't
+ // think this really needs to be tied to the memory cache subsystem's
+ // cache line size, so leave this as a fixed constant.
const size_t cache_line_size = 512;
+
size_t bytes_left = dst_max_len - 1;
char *curr_dst = dst;
OpenPOWER on IntegriCloud