[Lldb-commits] [lldb] r147587 - in /lldb/trunk/source: Core/ValueObjectConstResult.cpp Target/ABI.cpp

Sean Callanan scallanan at apple.com
Wed Jan 4 17:11:10 PST 2012


Author: spyffe
Date: Wed Jan  4 19:11:09 2012
New Revision: 147587

URL: http://llvm.org/viewvc/llvm-project?rev=147587&view=rev
Log:
Fixed a dangling pointer bug associated with the
result variable on a "finish" statement.  The
ownership of the result value was not being properly
assigned to the newly-created persistent result
variable; now it is.

Modified:
    lldb/trunk/source/Core/ValueObjectConstResult.cpp
    lldb/trunk/source/Target/ABI.cpp

Modified: lldb/trunk/source/Core/ValueObjectConstResult.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResult.cpp?rev=147587&r1=147586&r2=147587&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResult.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResult.cpp Wed Jan  4 19:11:09 2012
@@ -98,6 +98,13 @@
     m_impl(this, address)
 {
     m_data = data;
+    
+    if (!m_data.GetSharedDataBuffer())
+    {
+        DataBufferSP shared_data_buffer(new DataBufferHeap(data.GetDataStart(), data.GetByteSize()));
+        m_data.SetData(shared_data_buffer);
+    }
+    
     m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
     m_value.SetValueType(Value::eValueTypeHostAddress);
     m_value.SetContext(Value::eContextTypeClangType, clang_type);

Modified: lldb/trunk/source/Target/ABI.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=147587&r1=147586&r2=147587&view=diff
==============================================================================
--- lldb/trunk/source/Target/ABI.cpp (original)
+++ lldb/trunk/source/Target/ABI.cpp Wed Jan  4 19:11:09 2012
@@ -156,6 +156,7 @@
             // we don't do anything with these for now
             break;
         case Value::eValueTypeScalar:
+            clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsFreezeDried;
             clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
             clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
             break;
@@ -164,8 +165,8 @@
             clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsProgramReference;
             break;
         }
+        
         return_valobj_sp = clang_expr_variable_sp->GetValueObject();
-
     }
     return return_valobj_sp;
 }





More information about the lldb-commits mailing list