[Lldb-commits] [lldb] r250339 - Fix a problem where LLDB could sometimes try to get the size of an Objective-C type without passing an appropriate ExecutionContext
Enrico Granata via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 14 15:44:31 PDT 2015
Author: enrico
Date: Wed Oct 14 17:44:30 2015
New Revision: 250339
URL: http://llvm.org/viewvc/llvm-project?rev=250339&view=rev
Log:
Fix a problem where LLDB could sometimes try to get the size of an Objective-C type without passing an appropriate ExecutionContext
Modified:
lldb/trunk/include/lldb/Core/Value.h
lldb/trunk/source/Core/Value.cpp
lldb/trunk/source/Core/ValueObjectCast.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
Modified: lldb/trunk/include/lldb/Core/Value.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=250339&r1=250338&r2=250339&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Value.h (original)
+++ lldb/trunk/include/lldb/Core/Value.h Wed Oct 14 17:44:30 2015
@@ -265,7 +265,7 @@ public:
GetValueDefaultFormat ();
uint64_t
- GetValueByteSize (Error *error_ptr);
+ GetValueByteSize (Error *error_ptr, ExecutionContext *exe_ctx);
Error
GetValueAsData (ExecutionContext *exe_ctx,
Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=250339&r1=250338&r2=250339&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Wed Oct 14 17:44:30 2015
@@ -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_pt
{
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
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
}
// 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())
Modified: lldb/trunk/source/Core/ValueObjectCast.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectCast.cpp?rev=250339&r1=250338&r2=250339&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectCast.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectCast.cpp Wed Oct 14 17:44:30 2015
@@ -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
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=250339&r1=250338&r2=250339&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Wed Oct 14 17:44:30 2015
@@ -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();
}
More information about the lldb-commits
mailing list