Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139160 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 25d3743..812d906 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -623,10 +623,20 @@
}
size_t
-Target::ReadMemory (const Address& addr, bool prefer_file_cache, void *dst, size_t dst_len, Error &error)
+Target::ReadMemory (const Address& addr,
+ bool prefer_file_cache,
+ void *dst,
+ size_t dst_len,
+ Error &error,
+ lldb::addr_t *load_addr_ptr)
{
error.Clear();
+ // if we end up reading this from process memory, we will fill this
+ // with the actual load address
+ if (load_addr_ptr)
+ *load_addr_ptr = LLDB_INVALID_ADDRESS;
+
bool process_is_valid = m_process_sp && m_process_sp->IsAlive();
size_t bytes_read = 0;
@@ -692,7 +702,11 @@
}
}
if (bytes_read)
+ {
+ if (load_addr_ptr)
+ *load_addr_ptr = load_addr;
return bytes_read;
+ }
// If the address is not section offset we have an address that
// doesn't resolve to any address in any currently loaded shared
// libaries and we failed to read memory so there isn't anything
@@ -1579,6 +1593,7 @@
#define TSC_SKIP_PROLOGUE "skip-prologue"
#define TSC_SOURCE_MAP "source-map"
#define TSC_MAX_CHILDREN "max-children-count"
+#define TSC_MAX_STRLENSUMMARY "max-string-summary-length"
static const ConstString &
@@ -1623,6 +1638,12 @@
return g_const_string;
}
+static const ConstString &
+GetSettingNameForMaxStringSummaryLength ()
+{
+ static ConstString g_const_string (TSC_MAX_STRLENSUMMARY);
+ return g_const_string;
+}
bool
Target::SettingsController::SetGlobalVariable (const ConstString &var_name,
@@ -1676,7 +1697,8 @@
m_prefer_dynamic_value (2),
m_skip_prologue (true, true),
m_source_map (NULL, NULL),
- m_max_children_display(256)
+ m_max_children_display(256),
+ m_max_strlen_length(1024)
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for TargetInstanceSettings are properly set up, i.e. AFTER all the initializers.
@@ -1703,7 +1725,8 @@
m_prefer_dynamic_value (rhs.m_prefer_dynamic_value),
m_skip_prologue (rhs.m_skip_prologue),
m_source_map (rhs.m_source_map),
- m_max_children_display(rhs.m_max_children_display)
+ m_max_children_display(rhs.m_max_children_display),
+ m_max_strlen_length(rhs.m_max_strlen_length)
{
if (m_instance_name != InstanceSettings::GetDefaultName())
{
@@ -1787,6 +1810,13 @@
if (ok)
m_max_children_display = new_value;
}
+ else if (var_name == GetSettingNameForMaxStringSummaryLength())
+ {
+ bool ok;
+ uint32_t new_value = Args::StringToUInt32(value, 0, 10, &ok);
+ if (ok)
+ m_max_strlen_length = new_value;
+ }
else if (var_name == GetSettingNameForSourcePathMap ())
{
switch (op)
@@ -1858,6 +1888,7 @@
m_prefer_dynamic_value = new_settings_ptr->m_prefer_dynamic_value;
m_skip_prologue = new_settings_ptr->m_skip_prologue;
m_max_children_display = new_settings_ptr->m_max_children_display;
+ m_max_strlen_length = new_settings_ptr->m_max_strlen_length;
}
bool
@@ -1893,6 +1924,12 @@
count_str.Printf ("%d", m_max_children_display);
value.AppendString (count_str.GetData());
}
+ else if (var_name == GetSettingNameForMaxStringSummaryLength())
+ {
+ StreamString count_str;
+ count_str.Printf ("%d", m_max_strlen_length);
+ value.AppendString (count_str.GetData());
+ }
else
{
if (err)
@@ -1940,12 +1977,13 @@
SettingEntry
Target::SettingsController::instance_settings_table[] =
{
- // var-name var-type default enum init'd hidden help-text
- // ================= ================== =============== ======================= ====== ====== =========================================================================
- { TSC_EXPR_PREFIX , eSetVarTypeString , NULL , NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." },
- { TSC_PREFER_DYNAMIC, eSetVarTypeEnum , NULL , g_dynamic_value_types, false, false, "Should printed values be shown as their dynamic value." },
- { TSC_SKIP_PROLOGUE , eSetVarTypeBoolean, "true" , NULL, false, false, "Skip function prologues when setting breakpoints by name." },
- { TSC_SOURCE_MAP , eSetVarTypeArray , NULL , NULL, false, false, "Source path remappings to use when locating source files from debug information." },
- { TSC_MAX_CHILDREN , eSetVarTypeInt , "256" , NULL, true, false, "Maximum number of children to expand in any level of depth." },
- { NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL }
+ // var-name var-type default enum init'd hidden help-text
+ // ================= ================== =============== ======================= ====== ====== =========================================================================
+ { TSC_EXPR_PREFIX , eSetVarTypeString , NULL , NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." },
+ { TSC_PREFER_DYNAMIC , eSetVarTypeEnum , NULL , g_dynamic_value_types, false, false, "Should printed values be shown as their dynamic value." },
+ { TSC_SKIP_PROLOGUE , eSetVarTypeBoolean, "true" , NULL, false, false, "Skip function prologues when setting breakpoints by name." },
+ { TSC_SOURCE_MAP , eSetVarTypeArray , NULL , NULL, false, false, "Source path remappings to use when locating source files from debug information." },
+ { TSC_MAX_CHILDREN , eSetVarTypeInt , "256" , NULL, true, false, "Maximum number of children to expand in any level of depth." },
+ { TSC_MAX_STRLENSUMMARY , eSetVarTypeInt , "1024" , NULL, true, false, "Maximum number of characters to show when using %s in summary strings." },
+ { NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL }
};