summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/Debugger.cpp301
-rw-r--r--lldb/source/Core/FormatClasses.cpp6
-rw-r--r--lldb/source/Core/FormatManager.cpp307
-rw-r--r--lldb/source/Core/ValueObject.cpp19
4 files changed, 327 insertions, 306 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 529fae63b8b..a975f3e429d 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -82,7 +82,6 @@ Debugger::Initialize ()
if (g_shared_debugger_refcount == 0)
{
lldb_private::Initialize();
- Debugger::FormatManagerInitialize();
}
g_shared_debugger_refcount++;
@@ -96,7 +95,6 @@ Debugger::Terminate ()
g_shared_debugger_refcount--;
if (g_shared_debugger_refcount == 0)
{
- Debugger::FormatManagerTerminate();
lldb_private::WillTerminate();
lldb_private::Terminate();
@@ -829,7 +827,7 @@ ScanBracketedRange(const char* var_name_begin,
static ValueObjectSP
-ExpandExpressionPath(ValueObject* vobj,
+ExpandExpressionPath(ValueObject* valobj,
StackFrame* frame,
bool* do_deref_pointer,
const char* var_name_begin,
@@ -846,7 +844,7 @@ ExpandExpressionPath(ValueObject* vobj,
log->Printf("been told to deref_pointer by caller");
sstring.PutChar('*');
}
- else if (vobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(vobj->GetParent()->GetClangType()) && !vobj->IsArrayItemForPointer())
+ else if (valobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(valobj->GetParent()->GetClangType()) && !valobj->IsArrayItemForPointer())
{
if (log)
log->Printf("decided to deref_pointer myself");
@@ -854,7 +852,7 @@ ExpandExpressionPath(ValueObject* vobj,
*do_deref_pointer = true;
}
- vobj->GetExpressionPath(sstring, true, ValueObject::eHonorPointers);
+ valobj->GetExpressionPath(sstring, true, ValueObject::eHonorPointers);
if (log)
log->Printf("expression path to expand in phase 0: %s",sstring.GetData());
sstring.PutRawBytes(var_name_begin+3, var_name_final-var_name_begin-3);
@@ -870,7 +868,7 @@ ExpandExpressionPath(ValueObject* vobj,
}
static ValueObjectSP
-ExpandIndexedExpression(ValueObject* vobj,
+ExpandIndexedExpression(ValueObject* valobj,
uint32_t index,
StackFrame* frame,
bool deref_pointer)
@@ -886,7 +884,7 @@ ExpandIndexedExpression(ValueObject* vobj,
ValueObject::ExpressionPathEndResultType final_value_type;
ValueObject::ExpressionPathScanEndReason reason_to_stop;
ValueObject::ExpressionPathAftermath what_next = (deref_pointer ? ValueObject::eDereference : ValueObject::eNothing);
- ValueObjectSP item = vobj->GetValueForExpressionPath (ptr_deref_buffer.get(),
+ ValueObjectSP item = valobj->GetValueForExpressionPath (ptr_deref_buffer.get(),
&first_unparsed,
&reason_to_stop,
&final_value_type,
@@ -918,19 +916,19 @@ Debugger::FormatPrompt
const Address *addr,
Stream &s,
const char **end,
- ValueObject* vobj
+ ValueObject* valobj
)
{
- ValueObject* realvobj = NULL; // makes it super-easy to parse pointers
+ ValueObject* realvalobj = NULL; // makes it super-easy to parse pointers
bool success = true;
const char *p;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
for (p = format; *p != '\0'; ++p)
{
- if (realvobj)
+ if (realvalobj)
{
- vobj = realvobj;
- realvobj = NULL;
+ valobj = realvalobj;
+ realvalobj = NULL;
}
size_t non_special_chars = ::strcspn (p, "${}\\");
if (non_special_chars > 0)
@@ -959,7 +957,7 @@ Debugger::FormatPrompt
++p; // Skip the '{'
- if (FormatPrompt (p, sc, exe_ctx, addr, sub_strm, &p, vobj))
+ if (FormatPrompt (p, sc, exe_ctx, addr, sub_strm, &p, valobj))
{
// The stream had all it needed
s.Write(sub_strm.GetData(), sub_strm.GetSize());
@@ -1011,7 +1009,7 @@ Debugger::FormatPrompt
case 'v':
case 's':
{
- if (!vobj)
+ if (!valobj)
break;
if (log)
@@ -1029,7 +1027,7 @@ Debugger::FormatPrompt
if (*var_name_begin == 's')
{
- vobj = vobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
+ valobj = valobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
var_name_begin++;
}
@@ -1058,18 +1056,18 @@ Debugger::FormatPrompt
bool is_array_range = false;
const char* first_unparsed;
- if (!vobj) break;
- // simplest case ${var}, just print vobj's value
+ if (!valobj) break;
+ // simplest case ${var}, just print valobj's value
if (::strncmp (var_name_begin, "var}", strlen("var}")) == 0)
{
- target = vobj;
+ target = valobj;
val_obj_display = ValueObject::eDisplayValue;
}
else if (::strncmp(var_name_begin,"var%",strlen("var%")) == 0)
{
// this is a variable with some custom format applied to it
const char* percent_position;
- target = vobj;
+ target = valobj;
val_obj_display = ValueObject::eDisplayValue;
ScanFormatDescriptor (var_name_begin,
var_name_end,
@@ -1111,7 +1109,7 @@ Debugger::FormatPrompt
if (log)
log->Printf("symbol to expand: %s",expr_path.get());
- target = vobj->GetValueForExpressionPath(expr_path.get(),
+ target = valobj->GetValueForExpressionPath(expr_path.get(),
&first_unparsed,
&reason_to_stop,
&final_value_type,
@@ -1200,7 +1198,7 @@ Debugger::FormatPrompt
var_success = true;
if (index_higher < 0)
- index_higher = vobj->GetNumChildren() - 1;
+ index_higher = valobj->GetNumChildren() - 1;
uint32_t max_num_children = target->GetUpdatePoint().GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
@@ -1776,267 +1774,6 @@ Debugger::FormatPrompt
return success;
}
-
-static FormatManager&
-GetFormatManager() {
- static FormatManager g_format_manager;
- return g_format_manager;
-}
-
-// The platform should be responsible for initializing its own formatters
-// (e.g. to handle versioning, different runtime libraries, ...)
-// Currently, basic formatters for std:: objects as implemented by
-// the GNU libstdc++ are defined regardless, and enabled by default
-// This is going to be moved to some platform-dependent location
-// (in the meanwhile, these formatters should work for Mac OS X & Linux)
-void
-Debugger::FormatManagerInitialize()
-{
- static bool g_initialized = false;
-
- if (!g_initialized)
- {
- g_initialized = true;
- ConstString gnulib("gnu-libstdc++");
- FormatManager& format_mgr = GetFormatManager();
- lldb::FormatCategorySP osxcpp = format_mgr.Category(gnulib.AsCString());
- osxcpp->Summary()->Add(ConstString("std::string").AsCString(),
- SummaryFormatSP(new StringSummaryFormat(true,
- false,
- false,
- true,
- true,
- false,
- "${var._M_dataplus._M_p}")));
- osxcpp->Summary()->Add(ConstString("std::basic_string<char>").AsCString(),
- SummaryFormatSP(new StringSummaryFormat(true,
- false,
- false,
- true,
- true,
- false,
- "${var._M_dataplus._M_p}")));
- osxcpp->Summary()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >").AsCString(),
- SummaryFormatSP(new StringSummaryFormat(true,
- false,
- false,
- true,
- true,
- false,
- "${var._M_dataplus._M_p}")));
- osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::vector<")),
- SyntheticChildrenSP(new SyntheticScriptProvider(true,
- false,
- false,
- "StdVectorSynthProvider")));
- osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::map<")),
- SyntheticChildrenSP(new SyntheticScriptProvider(true,
- false,
- false,
- "StdMapSynthProvider")));
- osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::list<")),
- SyntheticChildrenSP(new SyntheticScriptProvider(true,
- false,
- false,
- "StdListSynthProvider")));
-
- format_mgr.EnableCategory(gnulib.AsCString());
-
- }
-}
-
-void
-Debugger::FormatManagerTerminate()
-{}
-
-void
-Debugger::Formatting::ForceUpdate()
-{
- GetFormatManager().Changed();
-}
-
-bool
-Debugger::Formatting::ValueFormats::Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
-{
- return GetFormatManager().Value().Get(vobj,entry, use_dynamic);
-}
-
-void
-Debugger::Formatting::ValueFormats::Add(const ConstString &type, const ValueFormat::SharedPointer &entry)
-{
- GetFormatManager().Value().Add(type.AsCString(),entry);
-}
-
-bool
-Debugger::Formatting::ValueFormats::Delete(const ConstString &type)
-{
- return GetFormatManager().Value().Delete(type.AsCString());
-}
-
-void
-Debugger::Formatting::ValueFormats::Clear()
-{
- GetFormatManager().Value().Clear();
-}
-
-void
-Debugger::Formatting::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
-{
- GetFormatManager().Value().LoopThrough(callback, callback_baton);
-}
-
-uint32_t
-Debugger::Formatting::ValueFormats::GetCurrentRevision()
-{
- return GetFormatManager().GetCurrentRevision();
-}
-
-uint32_t
-Debugger::Formatting::ValueFormats::GetCount()
-{
- return GetFormatManager().Value().GetCount();
-}
-
-bool
-Debugger::Formatting::GetSummaryFormat(ValueObject& vobj,
- lldb::DynamicValueType use_dynamic,
- lldb::SummaryFormatSP& entry)
-{
- return GetFormatManager().Get(vobj, entry, use_dynamic);
-}
-bool
-Debugger::Formatting::GetSyntheticChildren(ValueObject& vobj,
- lldb::DynamicValueType use_dynamic,
- lldb::SyntheticChildrenSP& entry)
-{
- return GetFormatManager().Get(vobj, entry, use_dynamic);
-}
-
-bool
-Debugger::Formatting::AnyMatches(ConstString type_name,
- FormatCategory::FormatCategoryItems items,
- bool only_enabled,
- const char** matching_category,
- FormatCategory::FormatCategoryItems* matching_type)
-{
- return GetFormatManager().AnyMatches(type_name,
- items,
- only_enabled,
- matching_category,
- matching_type);
-}
-
-bool
-Debugger::Formatting::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
-{
- entry = GetFormatManager().Category(category.GetCString());
- return true;
-}
-
-void
-Debugger::Formatting::Categories::Add(const ConstString &category)
-{
- GetFormatManager().Category(category.GetCString());
-}
-
-bool
-Debugger::Formatting::Categories::Delete(const ConstString &category)
-{
- GetFormatManager().DisableCategory(category.GetCString());
- return GetFormatManager().Categories().Delete(category.GetCString());
-}
-
-void
-Debugger::Formatting::Categories::Clear()
-{
- GetFormatManager().Categories().Clear();
-}
-
-void
-Debugger::Formatting::Categories::Clear(ConstString &category)
-{
- GetFormatManager().Category(category.GetCString())->ClearSummaries();
-}
-
-void
-Debugger::Formatting::Categories::Enable(ConstString& category)
-{
- if (GetFormatManager().Category(category.GetCString())->IsEnabled() == false)
- GetFormatManager().EnableCategory(category.GetCString());
- else
- {
- GetFormatManager().DisableCategory(category.GetCString());
- GetFormatManager().EnableCategory(category.GetCString());
- }
-}
-
-void
-Debugger::Formatting::Categories::Disable(ConstString& category)
-{
- if (GetFormatManager().Category(category.GetCString())->IsEnabled() == true)
- GetFormatManager().DisableCategory(category.GetCString());
-}
-
-void
-Debugger::Formatting::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
-{
- GetFormatManager().LoopThroughCategories(callback, callback_baton);
-}
-
-uint32_t
-Debugger::Formatting::Categories::GetCurrentRevision()
-{
- return GetFormatManager().GetCurrentRevision();
-}
-
-uint32_t
-Debugger::Formatting::Categories::GetCount()
-{
- return GetFormatManager().Categories().GetCount();
-}
-
-bool
-Debugger::Formatting::NamedSummaryFormats::Get(const ConstString &type, SummaryFormat::SharedPointer &entry)
-{
- return GetFormatManager().NamedSummary().Get(type.AsCString(),entry);
-}
-
-void
-Debugger::Formatting::NamedSummaryFormats::Add(const ConstString &type, const SummaryFormat::SharedPointer &entry)
-{
- GetFormatManager().NamedSummary().Add(type.AsCString(),entry);
-}
-
-bool
-Debugger::Formatting::NamedSummaryFormats::Delete(const ConstString &type)
-{
- return GetFormatManager().NamedSummary().Delete(type.AsCString());
-}
-
-void
-Debugger::Formatting::NamedSummaryFormats::Clear()
-{
- GetFormatManager().NamedSummary().Clear();
-}
-
-void
-Debugger::Formatting::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
-{
- GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
-}
-
-uint32_t
-Debugger::Formatting::NamedSummaryFormats::GetCurrentRevision()
-{
- return GetFormatManager().GetCurrentRevision();
-}
-
-uint32_t
-Debugger::Formatting::NamedSummaryFormats::GetCount()
-{
- return GetFormatManager().NamedSummary().GetCount();
-}
-
#pragma mark Debugger::SettingsController
//--------------------------------------------------
diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/Core/FormatClasses.cpp
index 843b9862ee4..9a7b32cd63f 100644
--- a/lldb/source/Core/FormatClasses.cpp
+++ b/lldb/source/Core/FormatClasses.cpp
@@ -69,15 +69,15 @@ StringSummaryFormat::FormatObject(lldb::ValueObjectSP object)
if (m_show_members_oneliner)
{
- ValueObjectSP synth_vobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
- const uint32_t num_children = synth_vobj->GetNumChildren();
+ ValueObjectSP synth_valobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
+ const uint32_t num_children = synth_valobj->GetNumChildren();
if (num_children)
{
s.PutChar('(');
for (uint32_t idx=0; idx<num_children; ++idx)
{
- lldb::ValueObjectSP child_sp(synth_vobj->GetChildAtIndex(idx, true));
+ lldb::ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
if (child_sp.get())
{
if (idx)
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp
index 2210e37f111..9cb15c77ee0 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/Core/FormatManager.cpp
@@ -156,14 +156,14 @@ FormatManager::GetFormatAsCString (Format format)
template<>
bool
-FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key, SummaryFormat::SharedPointer& value)
+FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(ConstString key, SummaryFormat::SharedPointer& value)
{
Mutex::Locker(m_format_map.mutex());
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if (regex->Execute(key))
+ if (regex->Execute(key.AsCString()))
{
value = pos->second;
return true;
@@ -174,14 +174,14 @@ FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key,
template<>
bool
-FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* type)
+FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(ConstString type)
{
Mutex::Locker(m_format_map.mutex());
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if ( ::strcmp(type,regex->GetText()) == 0)
+ if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
{
m_format_map.map().erase(pos);
if (m_format_map.listener)
@@ -194,14 +194,14 @@ FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* ty
template<>
bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key, SyntheticFilter::SharedPointer& value)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(ConstString key, SyntheticFilter::SharedPointer& value)
{
Mutex::Locker(m_format_map.mutex());
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if (regex->Execute(key))
+ if (regex->Execute(key.AsCString()))
{
value = pos->second;
return true;
@@ -212,14 +212,14 @@ FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key
template<>
bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char* type)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(ConstString type)
{
Mutex::Locker(m_format_map.mutex());
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if ( ::strcmp(type,regex->GetText()) == 0)
+ if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
{
m_format_map.map().erase(pos);
if (m_format_map.listener)
@@ -232,14 +232,14 @@ FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char*
template<>
bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const char* key, SyntheticFilter::SharedPointer& value)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(ConstString key, SyntheticFilter::SharedPointer& value)
{
Mutex::Locker(m_format_map.mutex());
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if (regex->Execute(key))
+ if (regex->Execute(key.AsCString()))
{
value = pos->second;
return true;
@@ -250,14 +250,14 @@ FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const c
template<>
bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(const char* type)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(ConstString type)
{
Mutex::Locker(m_format_map.mutex());
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
- if ( ::strcmp(type,regex->GetText()) == 0)
+ if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
{
m_format_map.map().erase(pos);
if (m_format_map.listener)
@@ -297,3 +297,286 @@ FormatManager::GetSingleItemFormat(lldb::Format vector_format)
return lldb::eFormatInvalid;
}
}
+
+FormatManager::FormatManager() :
+ m_value_nav("format",this),
+ m_named_summaries_map(this),
+ m_last_revision(0),
+ m_categories_map(this),
+ m_default_cs(ConstString("default")),
+ m_system_cs(ConstString("system")),
+ m_gnu_stdcpp_cs(ConstString("gnu-libstdc++"))
+{
+
+ // build default categories
+
+ m_default_category_name = m_default_cs.GetCString();
+ m_system_category_name = m_system_cs.GetCString();
+ m_gnu_cpp_category_name = m_gnu_stdcpp_cs.AsCString();
+
+ // add some default stuff
+ // most formats, summaries, ... actually belong to the users' lldbinit file rather than here
+ SummaryFormat::SharedPointer string_format(new StringSummaryFormat(false,
+ true,
+ false,
+ true,
+ false,
+ false,
+ "${var%s}"));
+
+
+ SummaryFormat::SharedPointer string_array_format(new StringSummaryFormat(false,
+ true,
+ false,
+ false,
+ false,
+ false,
+ "${var%s}"));
+
+ lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
+
+
+ Category(m_system_category_name)->Summary()->Add(ConstString("char *"), string_format);
+ Category(m_system_category_name)->Summary()->Add(ConstString("const char *"), string_format);
+ Category(m_system_category_name)->RegexSummary()->Add(any_size_char_arr, string_array_format);
+
+ Category(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
+
+ // WARNING: temporary code!!
+ // The platform should be responsible for initializing its own formatters
+ // (e.g. to handle versioning, different runtime libraries, ...)
+ // Currently, basic formatters for std:: objects as implemented by
+ // the GNU libstdc++ are defined regardless, and enabled by default
+ // This is going to be moved to some platform-dependent location
+ // (in the meanwhile, these formatters should work for Mac OS X & Linux)
+ lldb::SummaryFormatSP std_string_summary_sp(new StringSummaryFormat(true,
+ false,
+ false,
+ true,
+ true,
+ false,
+ "${var._M_dataplus._M_p}"));
+ Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::string"),
+ std_string_summary_sp);
+ Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::basic_string<char>"),
+ std_string_summary_sp);
+ Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
+ std_string_summary_sp);
+
+ Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::vector<")),
+ SyntheticChildrenSP(new SyntheticScriptProvider(true,
+ false,
+ false,
+ "StdVectorSynthProvider")));
+ Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::map<")),
+ SyntheticChildrenSP(new SyntheticScriptProvider(true,
+ false,
+ false,
+ "StdMapSynthProvider")));
+ Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::list<")),
+ SyntheticChildrenSP(new SyntheticScriptProvider(true,
+ false,
+ false,
+ "StdListSynthProvider")));
+
+ // DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
+ EnableCategory(m_system_category_name);
+ EnableCategory(m_gnu_cpp_category_name);
+ EnableCategory(m_default_category_name);
+
+}
+
+
+static FormatManager&
+GetFormatManager() {
+ static FormatManager g_format_manager;
+ return g_format_manager;
+}
+
+void
+DataVisualization::ForceUpdate()
+{
+ GetFormatManager().Changed();
+}
+
+bool
+DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
+{
+ return GetFormatManager().Value().Get(valobj,entry, use_dynamic);
+}
+
+void
+DataVisualization::ValueFormats::Add(const ConstString &type, const ValueFormat::SharedPointer &entry)
+{
+ GetFormatManager().Value().Add(type,entry);
+}
+
+bool
+DataVisualization::ValueFormats::Delete(const ConstString &type)
+{
+ return GetFormatManager().Value().Delete(type);
+}
+
+void
+DataVisualization::ValueFormats::Clear()
+{
+ GetFormatManager().Value().Clear();
+}
+
+void
+DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
+{
+ GetFormatManager().Value().LoopThrough(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::ValueFormats::GetCurrentRevision()
+{
+ return GetFormatManager().GetCurrentRevision();
+}
+
+uint32_t
+DataVisualization::ValueFormats::GetCount()
+{
+ return GetFormatManager().Value().GetCount();
+}
+
+bool
+DataVisualization::GetSummaryFormat(ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic,
+ lldb::SummaryFormatSP& entry)
+{
+ return GetFormatManager().Get(valobj, entry, use_dynamic);
+}
+bool
+DataVisualization::GetSyntheticChildren(ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic,
+ lldb::SyntheticChildrenSP& entry)
+{
+ return GetFormatManager().Get(valobj, entry, use_dynamic);
+}
+
+bool
+DataVisualization::AnyMatches(ConstString type_name,
+ FormatCategory::FormatCategoryItems items,
+ bool only_enabled,
+ const char** matching_category,
+ FormatCategory::FormatCategoryItems* matching_type)
+{
+ return GetFormatManager().AnyMatches(type_name,
+ items,
+ only_enabled,
+ matching_category,
+ matching_type);
+}
+
+bool
+DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
+{
+ entry = GetFormatManager().Category(category.GetCString());
+ return true;
+}
+
+void
+DataVisualization::Categories::Add(const ConstString &category)
+{
+ GetFormatManager().Category(category.GetCString());
+}
+
+bool
+DataVisualization::Categories::Delete(const ConstString &category)
+{
+ GetFormatManager().DisableCategory(category.GetCString());
+ return GetFormatManager().Categories().Delete(category.GetCString());
+}
+
+void
+DataVisualization::Categories::Clear()
+{
+ GetFormatManager().Categories().Clear();
+}
+
+void
+DataVisualization::Categories::Clear(ConstString &category)
+{
+ GetFormatManager().Category(category.GetCString())->ClearSummaries();
+}
+
+void
+DataVisualization::Categories::Enable(ConstString& category)
+{
+ if (GetFormatManager().Category(category.GetCString())->IsEnabled() == false)
+ GetFormatManager().EnableCategory(category.GetCString());
+ else
+ {
+ GetFormatManager().DisableCategory(category.GetCString());
+ GetFormatManager().EnableCategory(category.GetCString());
+ }
+}
+
+void
+DataVisualization::Categories::Disable(ConstString& category)
+{
+ if (GetFormatManager().Category(category.GetCString())->IsEnabled() == true)
+ GetFormatManager().DisableCategory(category.GetCString());
+}
+
+void
+DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
+{
+ GetFormatManager().LoopThroughCategories(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::Categories::GetCurrentRevision()
+{
+ return GetFormatManager().GetCurrentRevision();
+}
+
+uint32_t
+DataVisualization::Categories::GetCount()
+{
+ return GetFormatManager().Categories().GetCount();
+}
+
+bool
+DataVisualization::NamedSummaryFormats::Get(const ConstString &type, SummaryFormat::SharedPointer &entry)
+{
+ return GetFormatManager().NamedSummary().Get(type,entry);
+}
+
+void
+DataVisualization::NamedSummaryFormats::Add(const ConstString &type, const SummaryFormat::SharedPointer &entry)
+{
+ GetFormatManager().NamedSummary().Add(type,entry);
+}
+
+bool
+DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
+{
+ return GetFormatManager().NamedSummary().Delete(type);
+}
+
+void
+DataVisualization::NamedSummaryFormats::Clear()
+{
+ GetFormatManager().NamedSummary().Clear();
+}
+
+void
+DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
+{
+ GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::NamedSummaryFormats::GetCurrentRevision()
+{
+ return GetFormatManager().GetCurrentRevision();
+}
+
+uint32_t
+DataVisualization::NamedSummaryFormats::GetCount()
+{
+ return GetFormatManager().NamedSummary().GetCount();
+} \ No newline at end of file
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index e02dda7f7e3..c05c227d879 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -20,6 +20,7 @@
// Project includes
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/Core/FormatManager.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectChild.h"
@@ -223,13 +224,13 @@ ValueObject::UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic)
log->Printf("checking for FormatManager revisions. VO named %s is at revision %d, while the format manager is at revision %d",
GetName().GetCString(),
m_last_format_mgr_revision,
- Debugger::Formatting::ValueFormats::GetCurrentRevision());
+ DataVisualization::ValueFormats::GetCurrentRevision());
if (HasCustomSummaryFormat() && m_update_point.GetModID() != m_user_id_of_forced_summary)
{
ClearCustomSummaryFormat();
m_summary_str.clear();
}
- if ( (m_last_format_mgr_revision != Debugger::Formatting::ValueFormats::GetCurrentRevision()) ||
+ if ( (m_last_format_mgr_revision != DataVisualization::ValueFormats::GetCurrentRevision()) ||
m_last_format_mgr_dynamic != use_dynamic)
{
if (m_last_summary_format.get())
@@ -241,11 +242,11 @@ ValueObject::UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic)
m_synthetic_value = NULL;
- Debugger::Formatting::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
- Debugger::Formatting::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
- Debugger::Formatting::GetSyntheticChildren(*this, use_dynamic, m_last_synthetic_filter);
+ DataVisualization::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
+ DataVisualization::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
+ DataVisualization::GetSyntheticChildren(*this, use_dynamic, m_last_synthetic_filter);
- m_last_format_mgr_revision = Debugger::Formatting::ValueFormats::GetCurrentRevision();
+ m_last_format_mgr_revision = DataVisualization::ValueFormats::GetCurrentRevision();
m_last_format_mgr_dynamic = use_dynamic;
ClearUserVisibleData();
@@ -2852,10 +2853,10 @@ ValueObject::DumpValueObject
if (print_children && (!entry || entry->DoesPrintChildren() || !sum_cstr))
{
- ValueObjectSP synth_vobj = valobj->GetSyntheticValue(use_synth ?
+ ValueObjectSP synth_valobj = valobj->GetSyntheticValue(use_synth ?
lldb::eUseSyntheticFilter :
lldb::eNoSyntheticFilter);
- uint32_t num_children = synth_vobj->GetNumChildren();
+ uint32_t num_children = synth_valobj->GetNumChildren();
bool print_dotdotdot = false;
if (num_children)
{
@@ -2881,7 +2882,7 @@ ValueObject::DumpValueObject
for (uint32_t idx=0; idx<num_children; ++idx)
{
- ValueObjectSP child_sp(synth_vobj->GetChildAtIndex(idx, true));
+ ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
if (child_sp.get())
{
DumpValueObject (s,
OpenPOWER on IntegriCloud