summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/FormatManager.cpp
diff options
context:
space:
mode:
authorEnrico Granata <granata.enrico@gmail.com>2011-07-02 00:25:22 +0000
committerEnrico Granata <granata.enrico@gmail.com>2011-07-02 00:25:22 +0000
commit0a3958e046662b4442d45b2f6071b40617ab1091 (patch)
treefea321776712941eb81e702a69790126c81b2bdc /lldb/source/Core/FormatManager.cpp
parentbf15d2b311f60c5f59e81ea4184cf4302e9057c7 (diff)
downloadbcm5719-llvm-0a3958e046662b4442d45b2f6071b40617ab1091.tar.gz
bcm5719-llvm-0a3958e046662b4442d45b2f6071b40617ab1091.zip
several improvements to "type summary":
- type names can now be regular expressions (exact matching is done first, and is faster) - integral (and floating) types can be printed as bitfields, i.e. ${var[low-high]} will extract bits low thru high of the value and print them - array subscripts are supported, both for arrays and for pointers. the syntax is ${*var[low-high]}, or ${*var[]} to print the whole array (the latter only works for statically sized arrays) - summary is now printed by default when a summary string references a variable. if that variable's type has no summary, value is printed instead. to force value, you can use %V as a format specifier - basic support for ObjectiveC: - ObjectiveC inheritance chains are now walked through - %@ can be specified as a summary format, to print the ObjectiveC runtime description for an object - some bug fixes llvm-svn: 134293
Diffstat (limited to 'lldb/source/Core/FormatManager.cpp')
-rw-r--r--lldb/source/Core/FormatManager.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp
index 8f8a60d3b49..75d025f6dfe 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/Core/FormatManager.cpp
@@ -151,3 +151,40 @@ FormatManager::GetFormatAsCString (Format format)
return g_format_infos[format].format_name;
return NULL;
}
+
+template<>
+bool
+FormatNavigator<std::map<lldb::RegularExpressionSP, SummaryFormat::SharedPointer>, SummaryFormat::RegexSummaryCallback>::Get(const char* key,
+ SummaryFormat::SharedPointer& value)
+{
+ Mutex::Locker(m_map_mutex);
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (regex->Execute(key))
+ {
+ value = pos->second;
+ return true;
+ }
+ }
+ return false;
+}
+
+template<>
+bool
+FormatNavigator<std::map<lldb::RegularExpressionSP, SummaryFormat::SharedPointer>, SummaryFormat::RegexSummaryCallback>::Delete(const char* type)
+{
+ Mutex::Locker(m_map_mutex);
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ lldb::RegularExpressionSP regex = pos->first;
+ if ( ::strcmp(type,regex->GetText()) == 0)
+ {
+ m_map.erase(pos);
+ return true;
+ }
+ }
+ return false;
+}
OpenPOWER on IntegriCloud