Fix a problem where LLDB could sometimes try to get the size of an Objective-C type without passing an appropriate ExecutionContext

llvm-svn: 250339
This commit is contained in:
Enrico Granata 2015-10-14 22:44:30 +00:00
parent ddcf6b35a2
commit 9543803801
4 changed files with 11 additions and 7 deletions

View File

@ -265,7 +265,7 @@ public:
GetValueDefaultFormat ();
uint64_t
GetValueByteSize (Error *error_ptr);
GetValueByteSize (Error *error_ptr, ExecutionContext *exe_ctx);
Error
GetValueAsData (ExecutionContext *exe_ctx,

View File

@ -260,7 +260,7 @@ Value::ValueOf(ExecutionContext *exe_ctx)
}
uint64_t
Value::GetValueByteSize (Error *error_ptr)
Value::GetValueByteSize (Error *error_ptr, ExecutionContext *exe_ctx)
{
uint64_t byte_size = 0;
@ -277,7 +277,7 @@ Value::GetValueByteSize (Error *error_ptr)
{
const CompilerType &ast_type = GetCompilerType();
if (ast_type.IsValid())
byte_size = ast_type.GetByteSize(nullptr);
byte_size = ast_type.GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
}
break;
}
@ -434,7 +434,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx,
lldb::Encoding type_encoding = ast_type.GetEncoding(type_encoding_count);
if (type_encoding == eEncodingUint || type_encoding == eEncodingSint)
limit_byte_size = ast_type.GetByteSize(nullptr);
limit_byte_size = ast_type.GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
}
if (m_value.GetData (data, limit_byte_size))
@ -639,7 +639,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx,
}
// If we got here, we need to read the value from memory
size_t byte_size = GetValueByteSize (&error);
size_t byte_size = GetValueByteSize (&error, exe_ctx);
// Bail if we encountered any errors getting the byte size
if (error.Fail())

View File

@ -76,7 +76,8 @@ ValueObjectCast::CalculateNumChildren()
uint64_t
ValueObjectCast::GetByteSize()
{
return m_value.GetValueByteSize(NULL);
ExecutionContext exe_ctx (GetExecutionContextRef());
return m_value.GetValueByteSize(nullptr, &exe_ctx);
}
lldb::ValueType

View File

@ -127,7 +127,10 @@ ValueObjectDynamicValue::GetByteSize()
{
const bool success = UpdateValueIfNeeded(false);
if (success && m_dynamic_type_info.HasType())
return m_value.GetValueByteSize(nullptr);
{
ExecutionContext exe_ctx (GetExecutionContextRef());
return m_value.GetValueByteSize(nullptr, &exe_ctx);
}
else
return m_parent->GetByteSize();
}