summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/Debugger.cpp28
-rw-r--r--lldb/source/Core/FormatClasses.cpp2
-rw-r--r--lldb/source/Core/Module.cpp37
-rw-r--r--lldb/source/Core/ModuleList.cpp36
-rw-r--r--lldb/source/Core/ValueObject.cpp88
-rw-r--r--lldb/source/Core/ValueObjectDynamicValue.cpp6
-rw-r--r--lldb/source/Core/ValueObjectMemory.cpp8
-rw-r--r--lldb/source/Core/ValueObjectSyntheticFilter.cpp6
8 files changed, 177 insertions, 34 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index dff2eb00fe8..a217ddb36ec 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1004,16 +1004,28 @@ Debugger::FormatPrompt
switch (var_name_begin[0])
{
case '*':
- {
- if (!vobj)
- break;
- do_deref_pointer = true;
- var_name_begin++;
- }
- // Fall through...
-
case 'v':
+ case 's':
{
+ if (!vobj)
+ break;
+
+ // check for *var and *svar
+ if (*var_name_begin == '*')
+ {
+ do_deref_pointer = true;
+ var_name_begin++;
+ }
+ if (*var_name_begin == 's')
+ {
+ vobj = vobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
+ var_name_begin++;
+ }
+
+ // should be a 'v' by now
+ if (*var_name_begin != 'v')
+ break;
+
ValueObject::ExpressionPathAftermath what_next = (do_deref_pointer ?
ValueObject::eDereference : ValueObject::eNothing);
ValueObject::GetValueForExpressionPathOptions options;
diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/Core/FormatClasses.cpp
index e321a40a310..046cc705d00 100644
--- a/lldb/source/Core/FormatClasses.cpp
+++ b/lldb/source/Core/FormatClasses.cpp
@@ -171,7 +171,7 @@ m_python_class(pclass)
return;
}
- m_interpreter = be->GetUpdatePoint().GetTarget()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ m_interpreter = be->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (m_interpreter == NULL)
m_wrapper = NULL;
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 8b07a76eead..28780f4f99a 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -422,7 +422,7 @@ Module::FindFunctions (const RegularExpression& regex,
}
uint32_t
-Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
{
Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
if (sc.module_sp.get() == NULL || sc.module_sp.get() == this)
@@ -434,6 +434,41 @@ Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool append
return 0;
}
+// depending on implementation details, type lookup might fail because of
+// embedded spurious namespace:: prefixes. this call strips them, paying
+// attention to the fact that a type might have namespace'd type names as
+// arguments to templates, and those must not be stripped off
+static const char*
+StripTypeName(const char* name_cstr)
+{
+ const char* skip_namespace = strstr(name_cstr, "::");
+ const char* template_arg_char = strchr(name_cstr, '<');
+ while (skip_namespace != NULL)
+ {
+ if (template_arg_char != NULL &&
+ skip_namespace > template_arg_char) // but namespace'd template arguments are still good to go
+ break;
+ name_cstr = skip_namespace+2;
+ skip_namespace = strstr(name_cstr, "::");
+ }
+ return name_cstr;
+}
+
+uint32_t
+Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+{
+ uint32_t retval = FindTypes_Impl(sc, name, append, max_matches, types);
+
+ if (retval == 0)
+ {
+ const char *stripped = StripTypeName(name.GetCString());
+ return FindTypes_Impl(sc, ConstString(stripped), append, max_matches, types);
+ }
+ else
+ return retval;
+
+}
+
//uint32_t
//Module::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
//{
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index b063d1647d7..d27b30eabfa 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -389,7 +389,7 @@ ModuleList::FindModule (const UUID &uuid)
uint32_t
-ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+ModuleList::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
{
Mutex::Locker locker(m_modules_mutex);
@@ -409,6 +409,40 @@ ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool ap
return total_matches;
}
+// depending on implementation details, type lookup might fail because of
+// embedded spurious namespace:: prefixes. this call strips them, paying
+// attention to the fact that a type might have namespace'd type names as
+// arguments to templates, and those must not be stripped off
+static const char*
+StripTypeName(const char* name_cstr)
+{
+ const char* skip_namespace = strstr(name_cstr, "::");
+ const char* template_arg_char = strchr(name_cstr, '<');
+ while (skip_namespace != NULL)
+ {
+ if (template_arg_char != NULL &&
+ skip_namespace > template_arg_char) // but namespace'd template arguments are still good to go
+ break;
+ name_cstr = skip_namespace+2;
+ skip_namespace = strstr(name_cstr, "::");
+ }
+ return name_cstr;
+}
+
+uint32_t
+ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+{
+ uint32_t retval = FindTypes_Impl(sc, name, append, max_matches, types);
+
+ if (retval == 0)
+ {
+ const char *stripped = StripTypeName(name.GetCString());
+ return FindTypes_Impl(sc, ConstString(stripped), append, max_matches, types);
+ }
+ else
+ return retval;
+
+}
ModuleSP
ModuleList::FindFirstModuleForFileSpec (const FileSpec &file_spec,
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index a98d0beae93..1ab72c8005b 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -20,6 +20,7 @@
// Project includes
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectChild.h"
#include "lldb/Core/ValueObjectConstResult.h"
@@ -89,6 +90,7 @@ ValueObject::ValueObject (ValueObject &parent) :
m_is_array_item_for_pointer(false),
m_is_bitfield_for_scalar(false),
m_is_expression_path_child(false),
+ m_is_child_at_offset(false),
m_dump_printable_counter(0)
{
m_manager->ManageObject(this);
@@ -132,6 +134,7 @@ ValueObject::ValueObject (ExecutionContextScope *exe_scope) :
m_is_array_item_for_pointer(false),
m_is_bitfield_for_scalar(false),
m_is_expression_path_child(false),
+ m_is_child_at_offset(false),
m_dump_printable_counter(0)
{
m_manager = new ValueObjectManager();
@@ -203,9 +206,12 @@ ValueObject::UpdateValueIfNeeded (bool update_format)
void
ValueObject::UpdateFormatsIfNeeded()
{
- /*printf("CHECKING FOR UPDATES. I am at revision %d, while the format manager is at revision %d\n",
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+ if (log)
+ log->Printf("checking for FormatManager revisions. VO named %s is at revision %d, while the format manager is at revision %d",
+ GetName().GetCString(),
m_last_format_mgr_revision,
- Debugger::ValueFormats::GetCurrentRevision());*/
+ Debugger::Formatting::ValueFormats::GetCurrentRevision());
if (HasCustomSummaryFormat() && m_update_point.GetUpdateID() != m_user_id_of_forced_summary)
{
ClearCustomSummaryFormat();
@@ -441,12 +447,6 @@ ValueObject::SetNumChildren (uint32_t num_children)
}
void
-ValueObject::SetName (const char *name)
-{
- m_name.SetCString(name);
-}
-
-void
ValueObject::SetName (const ConstString &name)
{
m_name = name;
@@ -640,7 +640,11 @@ ValueObject::ReadPointedString(Stream& s,
if (exe_scope)
{
Target *target = exe_scope->CalculateTarget();
- if (target != NULL)
+ if (target == NULL)
+ {
+ s << "<no target to read from>";
+ }
+ else
{
lldb::addr_t cstr_address = LLDB_INVALID_ADDRESS;
AddressType cstr_address_type = eAddressTypeInvalid;
@@ -663,7 +667,11 @@ ValueObject::ReadPointedString(Stream& s,
// We have a pointer
cstr_address = GetPointerValue (cstr_address_type, true);
}
- if (cstr_address != LLDB_INVALID_ADDRESS)
+ if (cstr_address == LLDB_INVALID_ADDRESS)
+ {
+ s << "<invalid address for data>";
+ }
+ else
{
Address cstr_so_addr (NULL, cstr_address);
DataExtractor data;
@@ -695,6 +703,8 @@ ValueObject::ReadPointedString(Stream& s,
s << "...";
s << '"';
}
+ else
+ s << "\"<data not available>\"";
}
else
{
@@ -706,6 +716,8 @@ ValueObject::ReadPointedString(Stream& s,
s << '"';
+ bool any_data = false;
+
data.SetData (&data_buffer.front(), data_buffer.size(), endian::InlHostByteOrder());
while ((bytes_read = target->ReadMemory (cstr_so_addr,
prefer_file_cache,
@@ -713,6 +725,7 @@ ValueObject::ReadPointedString(Stream& s,
k_max_buf_size,
error)) > 0)
{
+ any_data = true;
size_t len = strlen(&data_buffer.front());
if (len == 0)
break;
@@ -741,6 +754,10 @@ ValueObject::ReadPointedString(Stream& s,
cstr_len -= len;
cstr_so_addr.Slide (k_max_buf_size);
}
+
+ if (any_data == false)
+ s << "<data not available>";
+
s << '"';
}
}
@@ -750,6 +767,7 @@ ValueObject::ReadPointedString(Stream& s,
else
{
error.SetErrorString("impossible to read a string from this object");
+ s << "<not a string object>";
}
}
@@ -1350,7 +1368,7 @@ ValueObject::GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create)
{
AddSyntheticChild(index_const_str, synthetic_child);
synthetic_child_sp = synthetic_child->GetSP();
- synthetic_child_sp->SetName(index_str);
+ synthetic_child_sp->SetName(ConstString(index_str));
synthetic_child_sp->m_is_array_item_for_pointer = true;
}
}
@@ -1393,7 +1411,7 @@ ValueObject::GetSyntheticArrayMemberFromArray (int32_t index, bool can_create)
{
AddSyntheticChild(index_const_str, synthetic_child);
synthetic_child_sp = synthetic_child->GetSP();
- synthetic_child_sp->SetName(index_str);
+ synthetic_child_sp->SetName(ConstString(index_str));
synthetic_child_sp->m_is_array_item_for_pointer = true;
}
}
@@ -1434,7 +1452,7 @@ ValueObject::GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_cre
{
AddSyntheticChild(index_const_str, synthetic_child);
synthetic_child_sp = synthetic_child->GetSP();
- synthetic_child_sp->SetName(index_str);
+ synthetic_child_sp->SetName(ConstString(index_str));
synthetic_child_sp->m_is_bitfield_for_scalar = true;
}
}
@@ -1442,6 +1460,46 @@ ValueObject::GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_cre
return synthetic_child_sp;
}
+lldb::ValueObjectSP
+ValueObject::GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create)
+{
+
+ ValueObjectSP synthetic_child_sp;
+
+ char name_str[64];
+ snprintf(name_str, sizeof(name_str), "@%i", offset);
+ ConstString name_const_str(name_str);
+
+ // Check if we have already created a synthetic array member in this
+ // valid object. If we have we will re-use it.
+ synthetic_child_sp = GetSyntheticChild (name_const_str);
+
+ if (synthetic_child_sp.get())
+ return synthetic_child_sp;
+
+ if (!can_create)
+ return lldb::ValueObjectSP();
+
+ ValueObjectChild *synthetic_child = new ValueObjectChild(*this,
+ type.GetASTContext(),
+ type.GetOpaqueQualType(),
+ name_const_str,
+ type.GetTypeByteSize(),
+ offset,
+ 0,
+ 0,
+ false,
+ false);
+ if (synthetic_child)
+ {
+ AddSyntheticChild(name_const_str, synthetic_child);
+ synthetic_child_sp = synthetic_child->GetSP();
+ synthetic_child_sp->SetName(name_const_str);
+ synthetic_child_sp->m_is_child_at_offset = true;
+ }
+ return synthetic_child_sp;
+}
+
// your expression path needs to have a leading . or ->
// (unless it somehow "looks like" an array, in which case it has
// a leading [ symbol). while the [ is meaningful and should be shown
@@ -1477,7 +1535,7 @@ ValueObject::GetSyntheticExpressionPathChild(const char* expression, bool can_cr
if (synthetic_child_sp.get())
{
AddSyntheticChild(name_const_string, synthetic_child_sp.get());
- synthetic_child_sp->SetName(SkipLeadingExpressionPathSeparators(expression));
+ synthetic_child_sp->SetName(ConstString(SkipLeadingExpressionPathSeparators(expression)));
synthetic_child_sp->m_is_expression_path_child = true;
}
}
@@ -1508,7 +1566,7 @@ ValueObject::CalculateDynamicValue (lldb::DynamicValueType use_dynamic)
if (!m_dynamic_value && !IsDynamic())
{
- Process *process = m_update_point.GetProcess();
+ Process *process = m_update_point.GetProcessSP().get();
bool worth_having_dynamic_value = false;
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index c80fd9d592f..885e68fd3bd 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -40,7 +40,7 @@ ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent, lldb::Dyn
m_type_sp(),
m_use_dynamic (use_dynamic)
{
- SetName (parent.GetName().AsCString());
+ SetName (parent.GetName());
}
ValueObjectDynamicValue::~ValueObjectDynamicValue()
@@ -134,7 +134,7 @@ ValueObjectDynamicValue::UpdateValue ()
}
// First make sure our Type and/or Address haven't changed:
- Process *process = m_update_point.GetProcess();
+ Process *process = m_update_point.GetProcessSP().get();
if (!process)
return false;
@@ -201,7 +201,7 @@ ValueObjectDynamicValue::UpdateValue ()
// We've moved, so we should be fine...
m_address = dynamic_address;
- lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTarget());
+ lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTargetSP().get());
m_value.GetScalar() = load_address;
}
diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp
index bfa58378911..098c0fb6410 100644
--- a/lldb/source/Core/ValueObjectMemory.cpp
+++ b/lldb/source/Core/ValueObjectMemory.cpp
@@ -62,9 +62,9 @@ ValueObjectMemory::ValueObjectMemory (ExecutionContextScope *exe_scope,
{
// Do not attempt to construct one of these objects with no variable!
assert (m_type_sp.get() != NULL);
- SetName (name);
+ SetName (ConstString(name));
m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
- lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTarget());
+ lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTargetSP().get());
if (load_address != LLDB_INVALID_ADDRESS)
{
m_value.SetValueType(Value::eValueTypeLoadAddress);
@@ -99,9 +99,9 @@ ValueObjectMemory::ValueObjectMemory (ExecutionContextScope *exe_scope,
assert (m_clang_type.GetASTContext());
assert (m_clang_type.GetOpaqueQualType());
- SetName (name);
+ SetName (ConstString(name));
m_value.SetContext(Value::eContextTypeClangType, m_clang_type.GetOpaqueQualType());
- lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTarget());
+ lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTargetSP().get());
if (load_address != LLDB_INVALID_ADDRESS)
{
m_value.SetValueType(Value::eValueTypeLoadAddress);
diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index 252780cf11f..03b9f12ab91 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -44,7 +44,7 @@ ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::Synthetic
m_children_byindex(),
m_name_toindex()
{
- SetName (parent.GetName().AsCString());
+ SetName (parent.GetName());
}
ValueObjectSynthetic::~ValueObjectSynthetic()
@@ -120,6 +120,10 @@ ValueObjectSynthetic::UpdateValue ()
m_children_byindex.clear();
m_name_toindex.clear();
+ // let our backend do its update
+
+ m_synth_filter->Update();
+
SetValueIsValid(true);
return true;
}
OpenPOWER on IntegriCloud