summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2014-10-03 01:48:32 +0000
committerEnrico Granata <egranata@apple.com>2014-10-03 01:48:32 +0000
commite7687adc60e07af6850af7ad07786b58b40e19e2 (patch)
tree2a429c60afe148b710a39149b28ca1477d80c1c4
parentfb924fdf386875144ef9672bf3d4bfad15a6c66f (diff)
downloadbcm5719-llvm-e7687adc60e07af6850af7ad07786b58b40e19e2.tar.gz
bcm5719-llvm-e7687adc60e07af6850af7ad07786b58b40e19e2.zip
Issuing a "type category disable *" command followed by a "type category enable *" command does not honor the order in which categories were previously enabled
While we didn't really promise it would, it seems like it should This checkin enables just that, and fixes rdar://18527468 llvm-svn: 218949
-rw-r--r--lldb/include/lldb/DataFormatters/DataVisualization.h6
-rw-r--r--lldb/include/lldb/DataFormatters/FormatManager.h12
-rw-r--r--lldb/include/lldb/DataFormatters/TypeCategory.h12
-rw-r--r--lldb/include/lldb/DataFormatters/TypeCategoryMap.h6
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp26
-rw-r--r--lldb/source/DataFormatters/DataVisualization.cpp12
-rw-r--r--lldb/source/DataFormatters/TypeCategory.cpp4
-rw-r--r--lldb/source/DataFormatters/TypeCategoryMap.cpp25
8 files changed, 77 insertions, 26 deletions
diff --git a/lldb/include/lldb/DataFormatters/DataVisualization.h b/lldb/include/lldb/DataFormatters/DataVisualization.h
index c52c9ccd6e8..a0b2e58bba2 100644
--- a/lldb/include/lldb/DataFormatters/DataVisualization.h
+++ b/lldb/include/lldb/DataFormatters/DataVisualization.h
@@ -144,6 +144,12 @@ public:
Disable (const lldb::TypeCategoryImplSP& category);
static void
+ EnableStar ();
+
+ static void
+ DisableStar ();
+
+ static void
LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
static uint32_t
diff --git a/lldb/include/lldb/DataFormatters/FormatManager.h b/lldb/include/lldb/DataFormatters/FormatManager.h
index e13cd3971f6..37dae653676 100644
--- a/lldb/include/lldb/DataFormatters/FormatManager.h
+++ b/lldb/include/lldb/DataFormatters/FormatManager.h
@@ -86,6 +86,18 @@ public:
m_categories_map.Disable(category);
}
+ void
+ EnableAllCategories ()
+ {
+ m_categories_map.EnableAllCategories ();
+ }
+
+ void
+ DisableAllCategories ()
+ {
+ m_categories_map.DisableAllCategories ();
+ }
+
bool
DeleteCategory (const ConstString& category_name)
{
diff --git a/lldb/include/lldb/DataFormatters/TypeCategory.h b/lldb/include/lldb/DataFormatters/TypeCategory.h
index 2ff85558984..e32efa420a5 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategory.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -302,6 +302,18 @@ namespace lldb_private {
Enable(false, UINT32_MAX);
}
+ uint32_t
+ GetLastEnabledPosition ()
+ {
+ return m_enabled_position;
+ }
+
+ void
+ SetEnabledPosition (uint32_t p)
+ {
+ m_enabled_position = p;
+ }
+
friend class TypeCategoryMap;
friend class FormattersContainer<ConstString, TypeFormatImpl>;
diff --git a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
index fe9880f5954..41b170d5335 100644
--- a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
+++ b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -63,6 +63,12 @@ namespace lldb_private {
bool
Disable (ValueSP category);
+
+ void
+ EnableAllCategories ();
+
+ void
+ DisableAllCategories ();
void
Clear ();
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 640fd6dd3fa..461feb35fdf 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -2465,22 +2465,7 @@ protected:
if (argc == 1 && strcmp(command.GetArgumentAtIndex(0),"*") == 0)
{
- // we want to make sure to enable "system" last and "default" first
- DataVisualization::Categories::Enable(ConstString("default"), TypeCategoryMap::First);
- uint32_t num_categories = DataVisualization::Categories::GetCount();
- for (uint32_t i = 0; i < num_categories; i++)
- {
- lldb::TypeCategoryImplSP category_sp = DataVisualization::Categories::GetCategoryAtIndex(i);
- if (category_sp)
- {
- if ( ::strcmp(category_sp->GetName(), "system") == 0 ||
- ::strcmp(category_sp->GetName(), "default") == 0 )
- continue;
- else
- DataVisualization::Categories::Enable(category_sp, TypeCategoryMap::Default);
- }
- }
- DataVisualization::Categories::Enable(ConstString("system"), TypeCategoryMap::Last);
+ DataVisualization::Categories::EnableStar();
}
else
{
@@ -2630,14 +2615,7 @@ protected:
if (argc == 1 && strcmp(command.GetArgumentAtIndex(0),"*") == 0)
{
- uint32_t num_categories = DataVisualization::Categories::GetCount();
- for (uint32_t i = 0; i < num_categories; i++)
- {
- lldb::TypeCategoryImplSP category_sp = DataVisualization::Categories::GetCategoryAtIndex(i);
- // no need to check if the category is enabled - disabling a disabled category has no effect
- if (category_sp)
- DataVisualization::Categories::Disable(category_sp);
- }
+ DataVisualization::Categories::DisableStar();
}
else
{
diff --git a/lldb/source/DataFormatters/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp
index 8799c59103e..7ef0be50efe 100644
--- a/lldb/source/DataFormatters/DataVisualization.cpp
+++ b/lldb/source/DataFormatters/DataVisualization.cpp
@@ -196,6 +196,18 @@ DataVisualization::Categories::Disable (const lldb::TypeCategoryImplSP& category
}
void
+DataVisualization::Categories::EnableStar ()
+{
+ GetFormatManager().EnableAllCategories ();
+}
+
+void
+DataVisualization::Categories::DisableStar ()
+{
+ GetFormatManager().DisableAllCategories();
+}
+
+void
DataVisualization::Categories::LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton)
{
GetFormatManager().LoopThroughCategories(callback, callback_baton);
diff --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp
index d3291aa5545..3df6884fe67 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -564,8 +564,8 @@ void
TypeCategoryImpl::Enable (bool value, uint32_t position)
{
Mutex::Locker locker(m_mutex);
- m_enabled = value;
- m_enabled_position = position;
+ if ( (m_enabled = value) )
+ m_enabled_position = position;
if (m_change_listener)
m_change_listener->Changed();
}
diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp
index 45444327882..c5f22b06628 100644
--- a/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -120,6 +120,31 @@ TypeCategoryMap::Disable (ValueSP category)
}
void
+TypeCategoryMap::EnableAllCategories ()
+{
+ Mutex::Locker locker(m_map_mutex);
+ std::vector<ValueSP> sorted_categories(m_map.size(), ValueSP());
+ MapType::iterator iter = m_map.begin(), end = m_map.end();
+ for (; iter != end; ++iter)
+ sorted_categories.at(iter->second->GetLastEnabledPosition()) = iter->second;
+ decltype(sorted_categories)::iterator viter = sorted_categories.begin(), vend = sorted_categories.end();
+ for (; viter != vend; viter++)
+ Enable(*viter, Last);
+}
+
+void
+TypeCategoryMap::DisableAllCategories ()
+{
+ Mutex::Locker locker(m_map_mutex);
+ Position p = First;
+ for (; false == m_active_categories.empty(); p++)
+ {
+ m_active_categories.front()->SetEnabledPosition(p);
+ Disable(m_active_categories.front());
+ }
+}
+
+void
TypeCategoryMap::Clear ()
{
Mutex::Locker locker(m_map_mutex);
OpenPOWER on IntegriCloud