[Lldb-commits] [lldb] r161108 - in /lldb/branches/apple/python-GIL: ./ include/lldb/API/SBType.h include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/Type.h scripts/Python/interface/SBType.i source/API/SBType.cpp source/Interpreter/ScriptInterpreterPython.cpp source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp source/Symbol/ClangASTContext.cpp source/Symbol/DWARFCallFrameInfo.cpp source/Target/Thread.cpp source/Target/ThreadPlanStepOut.cpp

Filipe Cabecinhas me at filcab.net
Wed Aug 1 03:56:22 PDT 2012


Author: filcab
Date: Wed Aug  1 05:56:22 2012
New Revision: 161108

URL: http://llvm.org/viewvc/llvm-project?rev=161108&view=rev
Log:
Merge changes from ToT trunk.

Modified:
    lldb/branches/apple/python-GIL/   (props changed)
    lldb/branches/apple/python-GIL/include/lldb/API/SBType.h
    lldb/branches/apple/python-GIL/include/lldb/Symbol/ClangASTContext.h
    lldb/branches/apple/python-GIL/include/lldb/Symbol/Type.h
    lldb/branches/apple/python-GIL/scripts/Python/interface/SBType.i
    lldb/branches/apple/python-GIL/source/API/SBType.cpp
    lldb/branches/apple/python-GIL/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/branches/apple/python-GIL/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/branches/apple/python-GIL/source/Symbol/ClangASTContext.cpp
    lldb/branches/apple/python-GIL/source/Symbol/DWARFCallFrameInfo.cpp
    lldb/branches/apple/python-GIL/source/Target/Thread.cpp
    lldb/branches/apple/python-GIL/source/Target/ThreadPlanStepOut.cpp

Propchange: lldb/branches/apple/python-GIL/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug  1 05:56:22 2012
@@ -1 +1 @@
-/lldb/trunk:156467-161013
+/lldb/trunk:156467-161091

Modified: lldb/branches/apple/python-GIL/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/API/SBType.h?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/API/SBType.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/API/SBType.h Wed Aug  1 05:56:22 2012
@@ -44,6 +44,12 @@
     GetOffsetInBits();
 
     bool
+    IsBitfield();
+    
+    uint32_t
+    GetBitfieldSizeInBits();
+
+    bool
     GetDescription (lldb::SBStream &description, 
                     lldb::DescriptionLevel description_level);
     

Modified: lldb/branches/apple/python-GIL/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Symbol/ClangASTContext.h?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Symbol/ClangASTContext.h Wed Aug  1 05:56:22 2012
@@ -603,7 +603,9 @@
                      lldb::clang_type_t clang_type,
                      uint32_t idx, 
                      std::string& name,
-                     uint32_t *bit_offset_ptr);
+                     uint64_t *bit_offset_ptr,
+                     uint32_t *bitfield_bit_size_ptr,
+                     bool *is_bitfield_ptr);
 
     static uint32_t
     GetNumPointeeChildren (lldb::clang_type_t clang_type);

Modified: lldb/branches/apple/python-GIL/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Symbol/Type.h?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Symbol/Type.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Symbol/Type.h Wed Aug  1 05:56:22 2012
@@ -477,16 +477,23 @@
     TypeMemberImpl () :
         m_type_impl_sp (),
         m_bit_offset (0),
-        m_name ()
+        m_name (),
+        m_bitfield_bit_size (0),
+        m_is_bitfield (false)
+
     {
     }
 
     TypeMemberImpl (const lldb::TypeImplSP &type_impl_sp, 
                     uint64_t bit_offset,
-                    const ConstString &name) :
+                    const ConstString &name,
+                    uint32_t bitfield_bit_size = 0,
+                    bool is_bitfield = false) :
         m_type_impl_sp (type_impl_sp),
         m_bit_offset (bit_offset),
-        m_name (name)
+        m_name (name),
+        m_bitfield_bit_size (bitfield_bit_size),
+        m_is_bitfield (is_bitfield)
     {
     }
     
@@ -494,7 +501,9 @@
                     uint64_t bit_offset):
         m_type_impl_sp (type_impl_sp),
         m_bit_offset (bit_offset),
-        m_name ()
+        m_name (),
+        m_bitfield_bit_size (0),
+        m_is_bitfield (false)
     {
     }
 
@@ -516,10 +525,36 @@
         return m_bit_offset;
     }
 
+    uint32_t
+    GetBitfieldBitSize () const
+    {
+        return m_bitfield_bit_size;
+    }
+
+    void
+    SetBitfieldBitSize (uint32_t bitfield_bit_size)
+    {
+        m_bitfield_bit_size = bitfield_bit_size;
+    }
+
+    bool
+    GetIsBitfield () const
+    {
+        return m_is_bitfield;
+    }
+    
+    void
+    SetIsBitfield (bool is_bitfield)
+    {
+        m_is_bitfield = is_bitfield;
+    }
+
 protected:
     lldb::TypeImplSP m_type_impl_sp;
     uint64_t m_bit_offset;
     ConstString m_name;
+    uint32_t m_bitfield_bit_size; // Bit size for bitfield members only
+    bool m_is_bitfield;
 };
 
     

Modified: lldb/branches/apple/python-GIL/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/interface/SBType.i?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/interface/SBType.i (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/interface/SBType.i Wed Aug  1 05:56:22 2012
@@ -37,6 +37,12 @@
     uint64_t
     GetOffsetInBits();
     
+    bool
+    IsBitfield();
+    
+    uint32_t
+    GetBitfieldSizeInBits();
+
     %pythoncode %{
         __swig_getmethods__["name"] = GetName
         if _newclass: name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''')
@@ -49,7 +55,14 @@
         
         __swig_getmethods__["bit_offset"] = GetOffsetInBits
         if _newclass: bit_offset = property(GetOffsetInBits, None, doc='''A read only property that returns offset in bits for this member as an integer.''')
-    %}    
+
+        __swig_getmethods__["is_bitfield"] = IsBitfield
+        if _newclass: is_bitfield = property(IsBitfield, None, doc='''A read only property that returns true if this member is a bitfield.''')
+
+        __swig_getmethods__["bitfield_bit_size"] = GetBitfieldSizeInBits
+        if _newclass: bitfield_bit_size = property(GetBitfieldSizeInBits, None, doc='''A read only property that returns the bitfield size in bits for this member as an integer, or zero if this member is not a bitfield.''')
+
+    %}
 
 protected:
     std::auto_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
@@ -245,6 +258,78 @@
         
         __swig_getmethods__["is_complete"] = IsTypeComplete
         if _newclass: is_complete = property(IsTypeComplete, None, doc='''A read only property that returns a boolean value that indicates if this type is a complete type (True) or a forward declaration (False).''')
+
+        def get_bases_array(self):
+            '''An accessor function that returns a list() that contains all direct base classes in a lldb.SBType object.'''
+            bases = []
+            for idx in range(self.GetNumberOfDirectBaseClasses()):
+                bases.append(self.GetDirectBaseClassAtIndex(idx))
+            return bases
+
+        def get_vbases_array(self):
+            '''An accessor function that returns a list() that contains all fields in a lldb.SBType object.'''
+            vbases = []
+            for idx in range(self.GetNumberOfVirtualBaseClasses()):
+                vbases.append(self.GetVirtualBaseClassAtIndex(idx))
+            return vbases
+
+        def get_fields_array(self):
+            '''An accessor function that returns a list() that contains all fields in a lldb.SBType object.'''
+            fields = []
+            for idx in range(self.GetNumberOfFields()):
+                fields.append(self.GetFieldAtIndex(idx))
+            return fields
+
+        def get_members_array(self):
+            '''An accessor function that returns a list() that contains all members (base classes and fields) in a lldb.SBType object in ascending bit offset order.'''
+            members = []
+            bases = self.get_bases_array()
+            fields = self.get_fields_array()
+            vbases = self.get_vbases_array()
+            for base in bases:
+                bit_offset = base.bit_offset
+                added = False
+                for idx, member in enumerate(members):
+                    if member.bit_offset > bit_offset:
+                        members.insert(idx, base)
+                        added = True
+                        break
+                if not added:
+                    members.append(base)
+            for vbase in vbases:
+                bit_offset = vbase.bit_offset
+                added = False
+                for idx, member in enumerate(members):
+                    if member.bit_offset > bit_offset:
+                        members.insert(idx, vbase)
+                        added = True
+                        break
+                if not added:
+                    members.append(vbase)
+            for field in fields:
+                bit_offset = field.bit_offset
+                added = False
+                for idx, member in enumerate(members):
+                    if member.bit_offset > bit_offset:
+                        members.insert(idx, field)
+                        added = True
+                        break
+                if not added:
+                    members.append(field)
+            return members
+
+        __swig_getmethods__["bases"] = get_bases_array
+        if _newclass: bases = property(get_bases_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes for this type.''')
+        
+        __swig_getmethods__["vbases"] = get_vbases_array
+        if _newclass: vbases = property(get_vbases_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the virtual base classes for this type.''')
+        
+        __swig_getmethods__["fields"] = get_fields_array
+        if _newclass: fields = property(get_fields_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the fields for this type.''')
+
+        __swig_getmethods__["members"] = get_members_array
+        if _newclass: members = property(get_members_array, None, doc='''A read only property that returns a list() of all lldb.SBTypeMember objects that represent all of the base classes, virtual base classes and fields for this type in ascending bit offset order.''')
+
         %}
 
 };

Modified: lldb/branches/apple/python-GIL/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/API/SBType.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/API/SBType.cpp (original)
+++ lldb/branches/apple/python-GIL/source/API/SBType.cpp Wed Aug  1 05:56:22 2012
@@ -410,17 +410,19 @@
     SBTypeMember sb_type_member;
     if (IsValid())
     {
-        uint32_t bit_offset = 0;
+        uint64_t bit_offset = 0;
+        uint32_t bitfield_bit_size = 0;
+        bool is_bitfield = false;
         clang::ASTContext* ast = m_opaque_sp->GetASTContext();
         std::string name_sstr;
-        clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &bit_offset);
+        clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &bit_offset, &bitfield_bit_size, &is_bitfield);
         if (clang_type)
         {
             ConstString name;
             if (!name_sstr.empty())
                 name.SetCString(name_sstr.c_str());
             TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
-            sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset, name));
+            sb_type_member.reset (new TypeMemberImpl (type_impl_sp, bit_offset, name, bitfield_bit_size, is_bitfield));
         }        
     }
     return sb_type_member;
@@ -627,7 +629,7 @@
 SBTypeMember::GetOffsetInBytes()
 {
     if (m_opaque_ap.get())
-        return (m_opaque_ap->GetBitOffset() + 7) / 8u;
+        return m_opaque_ap->GetBitOffset() / 8u;
     return 0;
 }
 
@@ -640,21 +642,48 @@
 }
 
 bool
+SBTypeMember::IsBitfield()
+{
+    if (m_opaque_ap.get())
+        return m_opaque_ap->GetIsBitfield();
+    return false;
+}
+
+uint32_t
+SBTypeMember::GetBitfieldSizeInBits()
+{
+    if (m_opaque_ap.get())
+        return m_opaque_ap->GetBitfieldBitSize();
+    return 0;
+}
+
+
+bool
 SBTypeMember::GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level)
 {
     Stream &strm = description.ref();
 
     if (m_opaque_ap.get())
     {
-        const uint32_t byte_offset = (m_opaque_ap->GetBitOffset() + 7) / 8u;
+        const uint32_t bit_offset = m_opaque_ap->GetBitOffset();
+        const uint32_t byte_offset = bit_offset / 8u;
+        const uint32_t byte_bit_offset = bit_offset % 8u;
         const char *name = m_opaque_ap->GetName().GetCString();
-        strm.Printf ("+%u: (", byte_offset);
+        if (byte_bit_offset)
+            strm.Printf ("+%u + %u bits: (", byte_offset, byte_bit_offset);
+        else
+            strm.Printf ("+%u: (", byte_offset);
         
         TypeImplSP type_impl_sp (m_opaque_ap->GetTypeImpl());
         if (type_impl_sp)
             type_impl_sp->GetDescription(strm, description_level);
         
         strm.Printf (") %s", name);
+        if (m_opaque_ap->GetIsBitfield())
+        {
+            const uint32_t bitfield_bit_size = m_opaque_ap->GetBitfieldBitSize();
+            strm.Printf (" : %u", bitfield_bit_size);
+        }
     }
     else
     {

Modified: lldb/branches/apple/python-GIL/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Interpreter/ScriptInterpreterPython.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Interpreter/ScriptInterpreterPython.cpp Wed Aug  1 05:56:22 2012
@@ -305,7 +305,7 @@
                     StreamString run_string;
                     char error_str[1024];
                     const char *pty_slave_name = script_interpreter->m_embedded_python_pty.GetSlaveName (error_str, sizeof (error_str));
-                    if (pty_slave_name != NULL)
+                    if (pty_slave_name != NULL && PyThreadState_GetDict() != NULL)
                     {
                         ScriptInterpreterPython::Locker locker(script_interpreter,
                                                                ScriptInterpreterPython::Locker::AcquireLock | ScriptInterpreterPython::Locker::InitSession,
@@ -404,7 +404,7 @@
             StreamString run_string;
             char error_str[1024];
             const char *pty_slave_name = script_interpreter->m_embedded_python_pty.GetSlaveName (error_str, sizeof (error_str));
-            if (pty_slave_name != NULL)
+            if (pty_slave_name != NULL && PyThreadState_GetDict() != NULL)
             {
                 ScriptInterpreterPython::Locker locker(script_interpreter,
                                                        ScriptInterpreterPython::Locker::AcquireLock | ScriptInterpreterPython::Locker::InitSession,

Modified: lldb/branches/apple/python-GIL/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Wed Aug  1 05:56:22 2012
@@ -753,12 +753,12 @@
             for (uint32_t idx = 0; idx < num_children; idx++)
             {
                 std::string name;
-                uint32_t field_bit_offset;
+                uint64_t field_bit_offset = 0;
                 bool is_signed;
                 bool is_complex;
                 uint32_t count;
                 
-                clang_type_t field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, ret_value_type, idx, name, &field_bit_offset);
+                clang_type_t field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, ret_value_type, idx, name, &field_bit_offset, NULL, NULL);
                 size_t field_bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, field_clang_type);
 
                 // If there are any unaligned fields, this is stored in memory.
@@ -840,12 +840,14 @@
                                 in_gpr = false;
                             else
                             {
-                                uint32_t next_field_bit_offset;
-                                clang_type_t next_field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, 
+                                uint64_t next_field_bit_offset = 0;
+                                clang_type_t next_field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context,
                                                                                                        ret_value_type, 
                                                                                                        idx + 1, 
                                                                                                        name, 
-                                                                                                       &next_field_bit_offset);
+                                                                                                       &next_field_bit_offset,
+                                                                                                       NULL,
+                                                                                                       NULL);
                                 if (ClangASTContext::IsIntegerType (next_field_clang_type, is_signed))
                                     in_gpr = true;
                                 else
@@ -864,12 +866,14 @@
                                 in_gpr = false;
                             else
                             {
-                                uint32_t prev_field_bit_offset;
+                                uint64_t prev_field_bit_offset = 0;
                                 clang_type_t prev_field_clang_type = ClangASTContext::GetFieldAtIndex (ast_context, 
                                                                                                        ret_value_type, 
                                                                                                        idx - 1, 
                                                                                                        name, 
-                                                                                                       &prev_field_bit_offset);
+                                                                                                       &prev_field_bit_offset,
+                                                                                                       NULL,
+                                                                                                       NULL);
                                 if (ClangASTContext::IsIntegerType (prev_field_clang_type, is_signed))
                                     in_gpr = true;
                                 else

Modified: lldb/branches/apple/python-GIL/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Symbol/ClangASTContext.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Symbol/ClangASTContext.cpp Wed Aug  1 05:56:22 2012
@@ -3499,7 +3499,9 @@
                                   clang_type_t clang_type,
                                   uint32_t idx, 
                                   std::string& name,
-                                  uint32_t *bit_offset_ptr)
+                                  uint64_t *bit_offset_ptr,
+                                  uint32_t *bitfield_bit_size_ptr,
+                                  bool *is_bitfield_ptr)
 {
     if (clang_type == NULL)
         return 0;
@@ -3531,6 +3533,25 @@
                             *bit_offset_ptr = record_layout.getFieldOffset (field_idx);
                         }
                         
+                        const bool is_bitfield = field->isBitField();
+                        
+                        if (bitfield_bit_size_ptr)
+                        {
+                            *bitfield_bit_size_ptr = 0;
+
+                            if (is_bitfield && ast)
+                            {
+                                Expr *bitfield_bit_size_expr = field->getBitWidth();
+                                llvm::APSInt bitfield_apsint;
+                                if (bitfield_bit_size_expr && bitfield_bit_size_expr->EvaluateAsInt(bitfield_apsint, *ast))
+                                {
+                                    *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
+                                }
+                            }
+                        }
+                        if (is_bitfield_ptr)
+                            *is_bitfield_ptr = is_bitfield;
+
                         return field->getType().getAsOpaquePtr();
                     }
                 }
@@ -3570,6 +3591,25 @@
                                         *bit_offset_ptr = interface_layout.getFieldOffset (ivar_idx);
                                     }
                                     
+                                    const bool is_bitfield = ivar_pos->isBitField();
+                                    
+                                    if (bitfield_bit_size_ptr)
+                                    {
+                                        *bitfield_bit_size_ptr = 0;
+                                        
+                                        if (is_bitfield && ast)
+                                        {
+                                            Expr *bitfield_bit_size_expr = ivar_pos->getBitWidth();
+                                            llvm::APSInt bitfield_apsint;
+                                            if (bitfield_bit_size_expr && bitfield_bit_size_expr->EvaluateAsInt(bitfield_apsint, *ast))
+                                            {
+                                                *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
+                                            }
+                                        }
+                                    }
+                                    if (is_bitfield_ptr)
+                                        *is_bitfield_ptr = is_bitfield;
+                                    
                                     return ivar_qual_type.getAsOpaquePtr();
                                 }
                             }
@@ -3585,14 +3625,18 @@
                                                      cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
                                                      idx,
                                                      name,
-                                                     bit_offset_ptr);
+                                                     bit_offset_ptr,
+                                                     bitfield_bit_size_ptr,
+                                                     is_bitfield_ptr);
             
         case clang::Type::Elaborated:
             return  ClangASTContext::GetFieldAtIndex (ast, 
                                                       cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
                                                       idx,
                                                       name,
-                                                      bit_offset_ptr);
+                                                      bit_offset_ptr,
+                                                      bitfield_bit_size_ptr,
+                                                      is_bitfield_ptr);
             
         default:
             break;

Modified: lldb/branches/apple/python-GIL/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Symbol/DWARFCallFrameInfo.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Symbol/DWARFCallFrameInfo.cpp Wed Aug  1 05:56:22 2012
@@ -427,6 +427,9 @@
                         // value and adding (delta * code_align). All other
                         // values in the new row are initially identical to the current row.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset(extended_opcode * code_align);
                     }
                     break;
@@ -477,6 +480,9 @@
                         // are initially identical to the current row. The new location value
                         // should always be greater than the current one.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SetOffset(m_cfi_data.GetPointer(&offset) - startaddr.GetFileAddress());
                     }
                     break;
@@ -487,6 +493,9 @@
                         // This instruction is identical to DW_CFA_advance_loc except for the
                         // encoding and size of the delta argument.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset (m_cfi_data.GetU8(&offset) * code_align);
                     }
                     break;
@@ -497,6 +506,9 @@
                         // This instruction is identical to DW_CFA_advance_loc except for the
                         // encoding and size of the delta argument.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset (m_cfi_data.GetU16(&offset) * code_align);
                     }
                     break;
@@ -507,6 +519,9 @@
                         // This instruction is identical to DW_CFA_advance_loc except for the
                         // encoding and size of the delta argument.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset (m_cfi_data.GetU32(&offset) * code_align);
                     }
                     break;
@@ -570,14 +585,19 @@
                     break;
 
                 case DW_CFA_remember_state      : // 0xA
-                    // These instructions define a stack of information. Encountering the
-                    // DW_CFA_remember_state instruction means to save the rules for every
-                    // register on the current row on the stack. Encountering the
-                    // DW_CFA_restore_state instruction means to pop the set of rules off
-                    // the stack and place them in the current row. (This operation is
-                    // useful for compilers that move epilogue code into the body of a
-                    // function.)
-                    unwind_plan.AppendRow (row);
+                    {
+                        // These instructions define a stack of information. Encountering the
+                        // DW_CFA_remember_state instruction means to save the rules for every
+                        // register on the current row on the stack. Encountering the
+                        // DW_CFA_restore_state instruction means to pop the set of rules off
+                        // the stack and place them in the current row. (This operation is
+                        // useful for compilers that move epilogue code into the body of a
+                        // function.)
+                        unwind_plan.AppendRow (row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
+                    }
                     break;
 
                 case DW_CFA_restore_state       : // 0xB

Modified: lldb/branches/apple/python-GIL/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Target/Thread.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Target/Thread.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Target/Thread.cpp Wed Aug  1 05:56:22 2012
@@ -975,8 +975,16 @@
                                                         stop_vote, 
                                                         run_vote, 
                                                         frame_idx));
-    QueueThreadPlan (thread_plan_sp, abort_other_plans);
-    return thread_plan_sp.get();
+    
+    if (thread_plan_sp->ValidatePlan(NULL))
+    {
+        QueueThreadPlan (thread_plan_sp, abort_other_plans);
+        return thread_plan_sp.get();
+    }
+    else
+    {
+        return NULL;
+    }
 }
 
 ThreadPlan *

Modified: lldb/branches/apple/python-GIL/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Target/ThreadPlanStepOut.cpp?rev=161108&r1=161107&r2=161108&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Target/ThreadPlanStepOut.cpp Wed Aug  1 05:56:22 2012
@@ -95,6 +95,10 @@
         // FIXME - can we do this more securely if we know first_insn?
 
         m_return_addr = return_frame_sp->GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess()->GetTarget());
+        
+        if (m_return_addr == LLDB_INVALID_ADDRESS)
+            return;
+        
         Breakpoint *return_bp = m_thread.CalculateTarget()->CreateBreakpoint (m_return_addr, true).get();
         if (return_bp != NULL)
         {
@@ -157,7 +161,8 @@
         return m_step_through_inline_plan_sp->ValidatePlan (error);
     else if (m_return_bp_id == LLDB_INVALID_BREAK_ID)
     {
-        error->PutCString("Could not create return address breakpoint.");
+        if (error)
+            error->PutCString("Could not create return address breakpoint.");
         return false;
     }
     else





More information about the lldb-commits mailing list