[Lldb-commits] [lldb] r257234 - Fix a thinko in the asserts in GetDynamicTypeAndAddress. It was requiring that the

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 8 15:44:51 PST 2016


Author: jingham
Date: Fri Jan  8 17:44:51 2016
New Revision: 257234

URL: http://llvm.org/viewvc/llvm-project?rev=257234&view=rev
Log:
Fix a thinko in the asserts in GetDynamicTypeAndAddress.  It was requiring that the
process in the incoming value be non-null, but Value Objects created off the target
don't necessarily have a process.  In that case, having the targets the same is good
enough.

<rdar://problem/24097805>

Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=257234&r1=257233&r2=257234&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Jan  8 17:44:51 2016
@@ -405,9 +405,18 @@ AppleObjCRuntimeV2::GetDynamicTypeAndAdd
                                               Address &address,
                                               Value::ValueType &value_type)
 {
-    // The Runtime is attached to a particular process, you shouldn't pass in a value from another process.
-    assert (in_value.GetProcessSP().get() == m_process);
+    // We should never get here with a null process...
     assert (m_process != NULL);
+
+    // The Runtime is attached to a particular process, you shouldn't pass in a value from another process.
+    // Note, however, the process might be NULL (e.g. if the value was made with SBTarget::EvaluateExpression...)
+    // in which case it is sufficient if the target's match:
+    
+    Process *process = in_value.GetProcessSP().get();
+    if (process)
+        assert (process == m_process);
+    else
+        assert (in_value.GetTargetSP().get() == m_process->CalculateTarget().get());
     
     class_type_or_name.Clear();
     value_type = Value::ValueType::eValueTypeScalar;




More information about the lldb-commits mailing list