[Lldb-commits] [lldb] r156440 - in /lldb/branches/lldb-platform-work: ./ include/lldb/API/ include/lldb/Core/ include/lldb/Target/ scripts/Python/interface/ source/API/ source/Core/ source/Target/ test/functionalities/data-formatter/data-formatter-advanced/ tools/driver/

Johnny Chen johnny.chen at apple.com
Tue May 8 16:25:16 PDT 2012


Author: johnny
Date: Tue May  8 18:25:16 2012
New Revision: 156440

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


svn merge -r 156424:156433 https://johnny@llvm.org/svn/llvm-project/lldb/trunk

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/include/lldb/API/SBDebugger.h
    lldb/branches/lldb-platform-work/include/lldb/API/SBTypeNameSpecifier.h
    lldb/branches/lldb-platform-work/include/lldb/Core/DataVisualization.h
    lldb/branches/lldb-platform-work/include/lldb/Core/FormatManager.h
    lldb/branches/lldb-platform-work/include/lldb/Target/TargetList.h
    lldb/branches/lldb-platform-work/scripts/Python/interface/SBDebugger.i
    lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp
    lldb/branches/lldb-platform-work/source/Core/DataVisualization.cpp
    lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
    lldb/branches/lldb-platform-work/source/Core/FormatManager.cpp
    lldb/branches/lldb-platform-work/source/Target/TargetList.cpp
    lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
    lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp
    lldb/branches/lldb-platform-work/tools/driver/Driver.cpp

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May  8 18:25:16 2012
@@ -1 +1 @@
-/lldb/trunk:154223-156424
+/lldb/trunk:154223-156439

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBDebugger.h?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBDebugger.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBDebugger.h Tue May  8 18:25:16 2012
@@ -127,6 +127,9 @@
 
     lldb::SBTarget
     GetTargetAtIndex (uint32_t idx);
+    
+    uint32_t
+    GetIndexOfTarget (lldb::SBTarget target);
 
     lldb::SBTarget
     FindTargetWithProcessID (pid_t pid);

Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBTypeNameSpecifier.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBTypeNameSpecifier.h?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBTypeNameSpecifier.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBTypeNameSpecifier.h Tue May  8 18:25:16 2012
@@ -58,6 +58,7 @@
         operator != (lldb::SBTypeNameSpecifier &rhs);
         
     protected:
+        friend class SBDebugger;
         friend class SBTypeCategory;
         
         lldb::TypeNameSpecifierImplSP

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/DataVisualization.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/DataVisualization.h?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/DataVisualization.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/DataVisualization.h Tue May  8 18:25:16 2012
@@ -70,6 +70,18 @@
     static lldb::TypeSummaryImplSP
     GetSummaryFormat(ValueObject& valobj,
                      lldb::DynamicValueType use_dynamic);
+
+    static lldb::TypeSummaryImplSP
+    GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
+    
+    static lldb::SyntheticChildrenSP
+    GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp);
+    
+    static lldb::TypeFilterImplSP
+    GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+    static lldb::TypeSyntheticImplSP
+    GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
     
     static lldb::SyntheticChildrenSP
     GetSyntheticChildren(ValueObject& valobj,

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/FormatManager.h?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/FormatManager.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/FormatManager.h Tue May  8 18:25:16 2012
@@ -99,6 +99,54 @@
         return RegexFilterNavigatorSP(m_regex_filter_nav);
     }
     
+    SummaryNavigator::MapValueType
+    GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
+    {
+        SummaryNavigator::MapValueType retval;
+        
+        if (type_sp)
+        {
+            if (type_sp->IsRegex())
+                m_regex_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
+            else
+                m_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
+        }
+
+        return retval;
+    }
+    
+    FilterNavigator::MapValueType
+    GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
+    {
+        FilterNavigator::MapValueType retval;
+        
+        if (type_sp)
+        {
+            if (type_sp->IsRegex())
+                m_regex_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
+            else
+                m_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
+        }
+        
+        return retval;
+    }
+    
+    SynthNavigator::MapValueType
+    GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
+    {
+        SynthNavigator::MapValueType retval;
+        
+        if (type_sp)
+        {
+            if (type_sp->IsRegex())
+                m_regex_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
+            else
+                m_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
+        }
+        
+        return retval;
+    }
+    
     lldb::TypeNameSpecifierImplSP
     GetTypeNameSpecifierForSummaryAtIndex (uint32_t index)
     {
@@ -601,6 +649,18 @@
         return m_categories_map.GetSummaryFormat(valobj, use_dynamic);
     }
     
+    lldb::TypeSummaryImplSP
+    GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+    lldb::TypeFilterImplSP
+    GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+    lldb::TypeSyntheticImplSP
+    GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
+    
+    lldb::SyntheticChildrenSP
+    GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp);
+    
     lldb::SyntheticChildrenSP
     GetSyntheticChildren (ValueObject& valobj,
                           lldb::DynamicValueType use_dynamic)

Modified: lldb/branches/lldb-platform-work/include/lldb/Target/TargetList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/TargetList.h?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/TargetList.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/TargetList.h Tue May  8 18:25:16 2012
@@ -142,6 +142,9 @@
 
     lldb::TargetSP
     GetTargetAtIndex (uint32_t index) const;
+    
+    uint32_t
+    GetIndexOfTarget (lldb::TargetSP target_sp) const;
 
     //------------------------------------------------------------------
     /// Find the target that contains has an executable whose path

Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBDebugger.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBDebugger.i?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBDebugger.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBDebugger.i Tue May  8 18:25:16 2012
@@ -209,6 +209,9 @@
     lldb::SBTarget
     GetTargetAtIndex (uint32_t idx);
 
+    uint32_t
+    GetIndexOfTarget (lldb::SBTarget target);
+
     lldb::SBTarget
     FindTargetWithProcessID (pid_t pid);
 

Modified: lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBDebugger.cpp Tue May  8 18:25:16 2012
@@ -678,6 +678,20 @@
     return sb_target;
 }
 
+uint32_t
+SBDebugger::GetIndexOfTarget (lldb::SBTarget target)
+{
+
+    lldb::TargetSP target_sp = target.GetSP();
+    if (!target_sp)
+        return UINT32_MAX;
+
+    if (!m_opaque_sp)
+        return UINT32_MAX;
+
+    return m_opaque_sp->GetTargetList().GetIndexOfTarget (target.GetSP());
+}
+
 SBTarget
 SBDebugger::FindTargetWithProcessID (pid_t pid)
 {
@@ -1146,75 +1160,27 @@
 SBTypeSummary
 SBDebugger::GetSummaryForType (SBTypeNameSpecifier type_name)
 {
-    SBTypeSummary summary_chosen;
-    uint32_t num_categories = GetNumCategories();
-    SBTypeCategory category_sb;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sb = GetCategoryAtIndex(category_id);
-        if (category_sb.GetEnabled() == false)
-            continue;
-        SBTypeSummary summary_current = category_sb.GetSummaryForType(type_name);
-        if (summary_current.IsValid() && (summary_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
-            summary_chosen = summary_current;
-        }
-    }
-    return summary_chosen;
+    if (type_name.IsValid() == false)
+        return SBTypeSummary();
+    return SBTypeSummary(DataVisualization::GetSummaryForType(type_name.GetSP()));
 }
 #endif // LLDB_DISABLE_PYTHON
 
 SBTypeFilter
 SBDebugger::GetFilterForType (SBTypeNameSpecifier type_name)
 {
-    SBTypeFilter filter_chosen;
-    uint32_t num_categories = GetNumCategories();
-    SBTypeCategory category_sb;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sb = GetCategoryAtIndex(category_id);
-        if (category_sb.GetEnabled() == false)
-            continue;
-        SBTypeFilter filter_current = category_sb.GetFilterForType(type_name);
-        if (filter_current.IsValid() && (filter_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
-            filter_chosen = filter_current;
-        }
-    }
-    return filter_chosen;
+    if (type_name.IsValid() == false)
+        return SBTypeFilter();
+    return SBTypeFilter(DataVisualization::GetFilterForType(type_name.GetSP()));
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 SBTypeSynthetic
 SBDebugger::GetSyntheticForType (SBTypeNameSpecifier type_name)
 {
-    SBTypeSynthetic synth_chosen;
-    uint32_t num_categories = GetNumCategories();
-    SBTypeCategory category_sb;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sb = GetCategoryAtIndex(category_id);
-        if (category_sb.GetEnabled() == false)
-            continue;
-        SBTypeSynthetic synth_current = category_sb.GetSyntheticForType(type_name);
-        if (synth_current.IsValid() && (synth_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
-            synth_chosen = synth_current;
-        }
-    }
-    return synth_chosen;
+    if (type_name.IsValid() == false)
+        return SBTypeSynthetic();
+    return SBTypeSynthetic(DataVisualization::GetSyntheticForType(type_name.GetSP()));
 }
 #endif // LLDB_DISABLE_PYTHON
 

Modified: lldb/branches/lldb-platform-work/source/Core/DataVisualization.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/DataVisualization.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/DataVisualization.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/DataVisualization.cpp Tue May  8 18:25:16 2012
@@ -103,6 +103,12 @@
     return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
 }
 
+lldb::TypeSummaryImplSP
+DataVisualization::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    return GetFormatManager().GetSummaryForType(type_sp);
+}
+
 lldb::SyntheticChildrenSP
 DataVisualization::GetSyntheticChildren (ValueObject& valobj,
                                          lldb::DynamicValueType use_dynamic)
@@ -110,6 +116,24 @@
     return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
 }
 
+lldb::SyntheticChildrenSP
+DataVisualization::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    return GetFormatManager().GetSyntheticChildrenForType(type_sp);
+}
+
+lldb::TypeFilterImplSP
+DataVisualization::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    return GetFormatManager().GetFilterForType(type_sp);
+}
+
+lldb::TypeSyntheticImplSP
+DataVisualization::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    return GetFormatManager().GetSyntheticForType(type_sp);
+}
+
 bool
 DataVisualization::AnyMatches (ConstString type_name,
                                TypeCategoryImpl::FormatCategoryItems items,

Modified: lldb/branches/lldb-platform-work/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/Debugger.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/Debugger.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/Debugger.cpp Tue May  8 18:25:16 2012
@@ -16,6 +16,7 @@
 
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ConnectionFileDescriptor.h"
+#include "lldb/Core/DataVisualization.h"
 #include "lldb/Core/FormatManager.h"
 #include "lldb/Core/InputReader.h"
 #include "lldb/Core/RegisterValue.h"
@@ -1215,6 +1216,7 @@
                                 const char* first_unparsed;
                                 bool was_plain_var = false;
                                 bool was_var_format = false;
+                                bool was_var_indexed = false;
 
                                 if (!valobj) break;
                                 // simplest case ${var}, just print valobj's value
@@ -1241,7 +1243,8 @@
                                     // this is ${var.something} or multiple .something nested
                                 else if (::strncmp (var_name_begin, "var", strlen("var")) == 0)
                                 {
-
+                                    if (::strncmp(var_name_begin, "var[", strlen("var[")) == 0)
+                                        was_var_indexed = true;
                                     const char* percent_position;
                                     ScanFormatDescriptor (var_name_begin,
                                                           var_name_end,
@@ -1318,6 +1321,20 @@
                                     do_deref_pointer = false;
                                 }
                                 
+                                // <rdar://problem/11338654>
+                                // we do not want to use the summary for a bitfield of type T:n
+                                // if we were originally dealing with just a T - that would get
+                                // us into an endless recursion
+                                if (target->IsBitfield() && was_var_indexed)
+                                {
+                                    // TODO: check for a (T:n)-specific summary - we should still obey that
+                                    StreamString bitfield_name;
+                                    bitfield_name.Printf("%s:%d", target->GetTypeName().AsCString(), target->GetBitfieldBitSize());
+                                    lldb::TypeNameSpecifierImplSP type_sp(new TypeNameSpecifierImpl(bitfield_name.GetData(),false));
+                                    if (!DataVisualization::GetSummaryForType(type_sp))
+                                        val_obj_display = ValueObject::eValueObjectRepresentationStyleValue;
+                                }
+                                
                                 // TODO use flags for these
                                 bool is_array = ClangASTContext::IsArrayType(target->GetClangType());
                                 bool is_pointer = ClangASTContext::IsPointerType(target->GetClangType());

Modified: lldb/branches/lldb-platform-work/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/FormatManager.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/FormatManager.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/FormatManager.cpp Tue May  8 18:25:16 2012
@@ -445,6 +445,97 @@
     return lldb::TypeSummaryImplSP();
 }
 
+lldb::TypeSummaryImplSP
+FormatManager::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    if (!type_sp)
+        return lldb::TypeSummaryImplSP();
+    lldb::TypeSummaryImplSP summary_chosen_sp;
+    uint32_t num_categories = m_categories_map.GetCount();
+    lldb::TypeCategoryImplSP category_sp;
+    uint32_t prio_category = UINT32_MAX;
+    for (uint32_t category_id = 0;
+         category_id < num_categories;
+         category_id++)
+    {
+        category_sp = GetCategoryAtIndex(category_id);
+        if (category_sp->IsEnabled() == false)
+            continue;
+        lldb::TypeSummaryImplSP summary_current_sp = category_sp->GetSummaryForType(type_sp);
+        if (summary_current_sp && (summary_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
+        {
+            prio_category = category_sp->GetEnabledPosition();
+            summary_chosen_sp = summary_current_sp;
+        }
+    }
+    return summary_chosen_sp;
+}
+
+lldb::TypeFilterImplSP
+FormatManager::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    if (!type_sp)
+        return lldb::TypeFilterImplSP();
+    lldb::TypeFilterImplSP filter_chosen_sp;
+    uint32_t num_categories = m_categories_map.GetCount();
+    lldb::TypeCategoryImplSP category_sp;
+    uint32_t prio_category = UINT32_MAX;
+    for (uint32_t category_id = 0;
+         category_id < num_categories;
+         category_id++)
+    {
+        category_sp = GetCategoryAtIndex(category_id);
+        if (category_sp->IsEnabled() == false)
+            continue;
+        lldb::TypeFilterImplSP filter_current_sp((TypeFilterImpl*)category_sp->GetFilterForType(type_sp).get());
+        if (filter_current_sp && (filter_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
+        {
+            prio_category = category_sp->GetEnabledPosition();
+            filter_chosen_sp = filter_current_sp;
+        }
+    }
+    return filter_chosen_sp;
+}
+
+lldb::TypeSyntheticImplSP
+FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    if (!type_sp)
+        return lldb::TypeSyntheticImplSP();
+    lldb::TypeSyntheticImplSP synth_chosen_sp;
+    uint32_t num_categories = m_categories_map.GetCount();
+    lldb::TypeCategoryImplSP category_sp;
+    uint32_t prio_category = UINT32_MAX;
+    for (uint32_t category_id = 0;
+         category_id < num_categories;
+         category_id++)
+    {
+        category_sp = GetCategoryAtIndex(category_id);
+        if (category_sp->IsEnabled() == false)
+            continue;
+        lldb::TypeSyntheticImplSP synth_current_sp((TypeSyntheticImpl*)category_sp->GetSyntheticForType(type_sp).get());
+        if (synth_current_sp && (synth_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
+        {
+            prio_category = category_sp->GetEnabledPosition();
+            synth_chosen_sp = synth_current_sp;
+        }
+    }
+    return synth_chosen_sp;
+}
+
+lldb::SyntheticChildrenSP
+FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+    if (!type_sp)
+        return lldb::SyntheticChildrenSP();
+    lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
+    lldb::TypeSyntheticImplSP synth_sp = GetSyntheticForType(type_sp);
+    if (filter_sp->GetRevision() > synth_sp->GetRevision())
+        return lldb::SyntheticChildrenSP(filter_sp.get());
+    else
+        return lldb::SyntheticChildrenSP(synth_sp.get());
+}
+
 lldb::SyntheticChildrenSP
 CategoryMap::GetSyntheticChildren (ValueObject& valobj,
                                    lldb::DynamicValueType use_dynamic)

Modified: lldb/branches/lldb-platform-work/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/TargetList.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/TargetList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/TargetList.cpp Tue May  8 18:25:16 2012
@@ -421,6 +421,19 @@
 }
 
 uint32_t
+TargetList::GetIndexOfTarget (lldb::TargetSP target_sp) const
+{
+    Mutex::Locker locker (m_target_list_mutex);
+    size_t num_targets = m_target_list.size();
+    for (size_t idx = 0; idx < num_targets; idx++)
+    {
+        if (target_sp == m_target_list[idx])
+            return idx;
+    }
+    return UINT32_MAX;
+}
+
+uint32_t
 TargetList::SetSelectedTarget (Target* target)
 {
     Mutex::Locker locker (m_target_list_mutex);

Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py Tue May  8 18:25:16 2012
@@ -105,6 +105,11 @@
             substrs = ['0x',
                        '2'])
 
+        # check fix for <rdar://problem/11338654> LLDB crashes when using a "type summary" that uses bitfields with no format
+        self.runCmd("type summary add --summary-string \"${var[0-1]}\" int")
+        self.expect("frame variable iAmInt",
+            substrs = ['9 1'])
+
         self.expect("frame variable cool_array[3].floating",
             substrs = ['0x'])
                     

Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/data-formatter-advanced/main.cpp Tue May  8 18:25:16 2012
@@ -133,7 +133,7 @@
 int main (int argc, const char * argv[])
 {
     
-    int iAmInt = 1;
+    int iAmInt = 9;
     
     i_am_cool cool_boy(1,0.5,3);
     i_am_cooler cooler_boy(1,2,0.1,0.2,'A','B');

Modified: lldb/branches/lldb-platform-work/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/driver/Driver.cpp?rev=156440&r1=156439&r2=156440&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/driver/Driver.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/driver/Driver.cpp Tue May  8 18:25:16 2012
@@ -945,11 +945,26 @@
             }
             else
             {
-                SBCommandReturnObject result;
-                UpdateSelectedThread ();
-                m_debugger.GetCommandInterpreter().HandleCommand("process status", result, false);
-                m_io_channel_ap->ErrWrite (result.GetError(), result.GetErrorSize(), ASYNC);
-                m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize(), ASYNC);
+                if (GetDebugger().GetSelectedTarget() == process.GetTarget())
+                {
+                    SBCommandReturnObject result;
+                    UpdateSelectedThread ();
+                    m_debugger.GetCommandInterpreter().HandleCommand("process status", result, false);
+                    m_io_channel_ap->ErrWrite (result.GetError(), result.GetErrorSize(), ASYNC);
+                    m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize(), ASYNC);
+                }
+                else
+                {
+                    SBStream out_stream;
+                    uint32_t target_idx = GetDebugger().GetIndexOfTarget(process.GetTarget());
+                    if (target_idx != UINT32_MAX)
+                        out_stream.Printf ("Target %d: (", target_idx);
+                    else
+                        out_stream.Printf ("Target <unknown index>: (");
+                    process.GetTarget().GetDescription (out_stream, eDescriptionLevelBrief);
+                    out_stream.Printf (") stopped.\n");
+                    m_io_channel_ap->OutWrite (out_stream.GetData(), out_stream.GetSize(), ASYNC);
+                }
             }
             break;
         }





More information about the lldb-commits mailing list