Revert r268591

"Allow LanguageRuntimes to return an error if they fail in the course of dynamic type discovery

This is not meant to report that a value doesn't have a dynamic type - it is only meant as a mechanism to propagate actual type discovery issues (e.g. malformed type metadata for languages that have such a notion)

This information is used by ValueObjectDynamic to set its own m_error, which is a fairly sharp and heavyweight tool to begin with

For the time being, this is an architectural improvement but a practical no-op as no existing runtimes are actually setting errors"

I need to think about what I want to do in this space more carefully - this attempt might be too heavy of a hammer for the nail I am trying to fix, and I don't want to leave it in while I ponder

llvm-svn: 268686
This commit is contained in:
Enrico Granata 2016-05-05 21:10:28 +00:00
parent 5239779465
commit 5f57b6ee0f
16 changed files with 38 additions and 98 deletions

View File

@ -54,8 +54,7 @@ public:
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) = 0;
Value::ValueType &value_type) = 0;
// This call should return a CompilerType given a generic type name
// and an ExecutionContextScope in which one can actually fetch

View File

@ -187,41 +187,23 @@ ValueObjectDynamicValue::UpdateValue ()
LanguageRuntime *runtime = nullptr;
lldb::LanguageType known_type = m_parent->GetObjectRuntimeLanguage();
Error dynamic_type_discovery_error;
if (known_type != lldb::eLanguageTypeUnknown && known_type != lldb::eLanguageTypeC)
{
runtime = process->GetLanguageRuntime (known_type);
if (runtime)
found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent,
m_use_dynamic,
class_type_or_name,
dynamic_address,
value_type,
dynamic_type_discovery_error);
found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address, value_type);
}
else
{
runtime = process->GetLanguageRuntime (lldb::eLanguageTypeC_plus_plus);
if (runtime)
found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent,
m_use_dynamic,
class_type_or_name,
dynamic_address,
value_type,
dynamic_type_discovery_error);
found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address, value_type);
if (!found_dynamic_type)
{
runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC);
if (runtime)
found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent,
m_use_dynamic,
class_type_or_name,
dynamic_address,
value_type,
dynamic_type_discovery_error);
found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address, value_type);
}
}
@ -247,24 +229,16 @@ ValueObjectDynamicValue::UpdateValue ()
m_type_impl.Clear();
}
// If we don't have a dynamic type...
// If we don't have a dynamic type, then make ourselves just a echo of our parent.
// Or we could return false, and make ourselves an echo of our parent?
if (!found_dynamic_type)
{
// ...and it's not because of an error, let's make ourselves an echo of our parent
if (dynamic_type_discovery_error.Success())
{
if (m_dynamic_type_info)
SetValueDidChange(true);
ClearDynamicTypeInformation();
m_dynamic_type_info.Clear();
m_value = m_parent->GetValue();
m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
}
else
{
// ...but if it is because of an error, let's report that to the user
m_error = dynamic_type_discovery_error;
}
if (m_dynamic_type_info)
SetValueDidChange(true);
ClearDynamicTypeInformation();
m_dynamic_type_info.Clear();
m_value = m_parent->GetValue();
m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
return m_error.Success();
}

View File

@ -53,8 +53,7 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &dynamic_address,
Value::ValueType &value_type,
Error &error)
Value::ValueType &value_type)
{
// For Itanium, if the type has a vtable pointer in the object, it will be at offset 0
// in the object. That will point to the "address point" within the vtable (not the beginning of the
@ -64,7 +63,6 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
// start of the value object which holds the dynamic type.
//
error.Clear();
class_type_or_name.Clear();
value_type = Value::ValueType::eValueTypeScalar;

View File

@ -53,8 +53,7 @@ namespace lldb_private {
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
Value::ValueType &value_type) override;
TypeAndOrName
FixUpDynamicType(const TypeAndOrName& type_and_or_name,

View File

@ -140,15 +140,11 @@ GoLanguageRuntime::CouldHaveDynamicValue (ValueObject &in_value)
}
bool
GoLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &dynamic_address,
Value::ValueType &value_type,
Error &error)
GoLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &dynamic_address,
Value::ValueType &value_type)
{
value_type = Value::eValueTypeScalar;
error.Clear();
class_type_or_name.Clear();
if (CouldHaveDynamicValue (in_value))
{

View File

@ -61,12 +61,9 @@ namespace lldb_private {
return false;
}
bool GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
Value::ValueType &value_type) override;
bool CouldHaveDynamicValue(ValueObject &in_value) override;

View File

@ -105,14 +105,10 @@ GetDynamicTypeId(ExecutionContext *exe_ctx, Target *target, ValueObject &in_valu
}
bool
JavaLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &dynamic_address,
Value::ValueType &value_type,
Error &error)
JavaLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &dynamic_address,
Value::ValueType &value_type)
{
error.Clear();
class_type_or_name.Clear();
// null references don't have a dynamic type

View File

@ -74,12 +74,9 @@ public:
CouldHaveDynamicValue(ValueObject &in_value) override;
bool
GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
Value::ValueType &value_type) override;
protected:
JavaLanguageRuntime(Process *process);

View File

@ -270,10 +270,8 @@ AppleObjCRuntime::GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error)
Value::ValueType &value_type)
{
error.Clear();
return false;
}

View File

@ -63,8 +63,7 @@ public:
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
Value::ValueType &value_type) override;
TypeAndOrName
FixUpDynamicType (const TypeAndOrName& type_and_or_name,

View File

@ -50,10 +50,8 @@ AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error)
Value::ValueType &value_type)
{
error.Clear();
class_type_or_name.Clear();
value_type = Value::ValueType::eValueTypeScalar;
if (CouldHaveDynamicValue(in_value))

View File

@ -125,8 +125,7 @@ public:
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
Value::ValueType &value_type) override;
UtilityFunction *
CreateObjectChecker(const char *) override;

View File

@ -407,8 +407,7 @@ AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error)
Value::ValueType &value_type)
{
// We should never get here with a null process...
assert (m_process != NULL);
@ -423,7 +422,6 @@ AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
else
assert (in_value.GetTargetSP().get() == m_process->CalculateTarget().get());
error.Clear();
class_type_or_name.Clear();
value_type = Value::ValueType::eValueTypeScalar;

View File

@ -63,8 +63,7 @@ public:
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
Value::ValueType &value_type) override;
UtilityFunction *
CreateObjectChecker(const char *) override;

View File

@ -906,14 +906,10 @@ RenderScriptRuntime::IsVTableName(const char *name)
}
bool
RenderScriptRuntime::GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error)
RenderScriptRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
Value::ValueType &value_type)
{
error.Clear();
return false;
}

View File

@ -178,12 +178,9 @@ public:
IsVTableName(const char *name) override;
bool
GetDynamicTypeAndAddress(ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address,
Value::ValueType &value_type,
Error &error) override;
GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
Value::ValueType &value_type) override;
TypeAndOrName
FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override;