forked from OSchip/llvm-project
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
This commit is contained in:
parent
b67bc4ea0d
commit
f0340c9ab5
|
@ -29,7 +29,7 @@ namespace lldb_private {
|
|||
{
|
||||
const char *name;
|
||||
OptionValue::Type type;
|
||||
bool global;
|
||||
bool global; // false == this setting is a global setting by default
|
||||
uintptr_t default_uint_value;
|
||||
const char *default_cstr_value;
|
||||
OptionEnumValueElement *enum_values;
|
||||
|
|
|
@ -68,6 +68,9 @@ public:
|
|||
bool
|
||||
GetDisableMemoryCache() const;
|
||||
|
||||
uint64_t
|
||||
GetMemoryCacheLineSize () const;
|
||||
|
||||
Args
|
||||
GetExtraStartupCommands () const;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue