summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-01-28 23:47:25 +0000
committerEnrico Granata <egranata@apple.com>2013-01-28 23:47:25 +0000
commit5548cb50b20c97f8615f48785cb0951b430136a0 (patch)
treeafcf2917d66215a9710874657c4b1c256c543527
parente233fbfc16fee2718290d159f6f7bab67ef2e15a (diff)
downloadbcm5719-llvm-5548cb50b20c97f8615f48785cb0951b430136a0.tar.gz
bcm5719-llvm-5548cb50b20c97f8615f48785cb0951b430136a0.zip
<rdar://problem/12978143>
Data formatters now cache themselves. This commit provides a new formatter cache mechanism. Upon resolving a formatter (summary or synthetic), LLDB remembers the resolution for later faster retrieval. Also moved the data formatters subsystem from the core to its own group and folder for easier management, and done some code reorganization. The ObjC runtime v1 now returns a class name if asked for the dynamic type of an object. This is required for formatters caching to work with the v1 runtime. Lastly, this commit disposes of the old hack where ValueObjects had to remember whether they were queried for formatters with their static or dynamic type. Now the ValueObjectDynamicValue class works well enough that we can use its dynamic value setting for the same purpose. llvm-svn: 173728
-rw-r--r--lldb/include/lldb/API/SBTypeSynthetic.h8
-rw-r--r--lldb/include/lldb/Core/Debugger.h2
-rw-r--r--lldb/include/lldb/Core/FormatClasses.h1598
-rw-r--r--lldb/include/lldb/Core/FormatManager.h776
-rw-r--r--lldb/include/lldb/Core/ValueObject.h26
-rw-r--r--lldb/include/lldb/Core/ValueObjectDynamicValue.h6
-rw-r--r--lldb/include/lldb/Core/ValueObjectSyntheticFilter.h6
-rw-r--r--lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h (renamed from lldb/include/lldb/Core/CXXFormatterFunctions.h)17
-rw-r--r--lldb/include/lldb/DataFormatters/DataVisualization.h (renamed from lldb/include/lldb/Core/DataVisualization.h)18
-rw-r--r--lldb/include/lldb/DataFormatters/FormatCache.h105
-rw-r--r--lldb/include/lldb/DataFormatters/FormatClasses.h128
-rw-r--r--lldb/include/lldb/DataFormatters/FormatManager.h251
-rw-r--r--lldb/include/lldb/DataFormatters/FormatNavigator.h (renamed from lldb/include/lldb/Core/FormatNavigator.h)64
-rw-r--r--lldb/include/lldb/DataFormatters/TypeCategory.h230
-rw-r--r--lldb/include/lldb/DataFormatters/TypeCategoryMap.h148
-rw-r--r--lldb/include/lldb/DataFormatters/TypeFormat.h220
-rw-r--r--lldb/include/lldb/DataFormatters/TypeSummary.h547
-rw-r--r--lldb/include/lldb/DataFormatters/TypeSynthetic.h585
-rw-r--r--lldb/include/lldb/lldb-forward.h5
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj96
-rw-r--r--lldb/source/API/SBDebugger.cpp2
-rw-r--r--lldb/source/API/SBTypeCategory.cpp6
-rw-r--r--lldb/source/API/SBTypeFilter.cpp2
-rw-r--r--lldb/source/API/SBTypeFormat.cpp2
-rw-r--r--lldb/source/API/SBTypeNameSpecifier.cpp2
-rw-r--r--lldb/source/API/SBTypeSummary.cpp2
-rw-r--r--lldb/source/API/SBTypeSynthetic.cpp14
-rw-r--r--lldb/source/API/SBValue.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp26
-rw-r--r--lldb/source/Core/Debugger.cpp4
-rw-r--r--lldb/source/Core/Timer.cpp18
-rw-r--r--lldb/source/Core/ValueObject.cpp65
-rw-r--r--lldb/source/Core/ValueObjectDynamicValue.cpp1
-rw-r--r--lldb/source/Core/ValueObjectSyntheticFilter.cpp20
-rw-r--r--lldb/source/DataFormatters/CXXFormatterFunctions.cpp (renamed from lldb/source/Core/CXXFormatterFunctions.cpp)14
-rw-r--r--lldb/source/DataFormatters/DataVisualization.cpp (renamed from lldb/source/Core/DataVisualization.cpp)16
-rw-r--r--lldb/source/DataFormatters/FormatCache.cpp163
-rw-r--r--lldb/source/DataFormatters/FormatClasses.cpp33
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp (renamed from lldb/source/Core/FormatManager.cpp)560
-rw-r--r--lldb/source/DataFormatters/TypeCategory.cpp378
-rw-r--r--lldb/source/DataFormatters/TypeCategoryMap.cpp283
-rw-r--r--lldb/source/DataFormatters/TypeFormat.cpp50
-rw-r--r--lldb/source/DataFormatters/TypeSummary.cpp (renamed from lldb/source/Core/FormatClasses.cpp)250
-rw-r--r--lldb/source/DataFormatters/TypeSynthetic.cpp112
-rw-r--r--lldb/source/Interpreter/Args.cpp2
-rw-r--r--lldb/source/Interpreter/CommandObjectScript.cpp7
-rw-r--r--lldb/source/Interpreter/OptionGroupVariable.cpp4
-rw-r--r--lldb/source/Interpreter/OptionValueArch.cpp2
-rw-r--r--lldb/source/Interpreter/OptionValueDictionary.cpp2
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpec.cpp2
-rw-r--r--lldb/source/Interpreter/OptionValueFormat.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp15
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py1
54 files changed, 3686 insertions, 3216 deletions
diff --git a/lldb/include/lldb/API/SBTypeSynthetic.h b/lldb/include/lldb/API/SBTypeSynthetic.h
index d5ba4f2134d..e77cbfef598 100644
--- a/lldb/include/lldb/API/SBTypeSynthetic.h
+++ b/lldb/include/lldb/API/SBTypeSynthetic.h
@@ -79,15 +79,15 @@ namespace lldb {
friend class SBTypeCategory;
friend class SBValue;
- lldb::TypeSyntheticImplSP
+ lldb::ScriptedSyntheticChildrenSP
GetSP ();
void
- SetSP (const lldb::TypeSyntheticImplSP &typefilter_impl_sp);
+ SetSP (const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
- lldb::TypeSyntheticImplSP m_opaque_sp;
+ lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
- SBTypeSynthetic (const lldb::TypeSyntheticImplSP &);
+ SBTypeSynthetic (const lldb::ScriptedSyntheticChildrenSP &);
bool
CopyOnWrite_Impl();
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 4543536abd5..88096f0e29e 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -23,13 +23,13 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/InputReaderStack.h"
#include "lldb/Core/Listener.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Target/ExecutionContext.h"
diff --git a/lldb/include/lldb/Core/FormatClasses.h b/lldb/include/lldb/Core/FormatClasses.h
deleted file mode 100644
index 0d66ca5da86..00000000000
--- a/lldb/include/lldb/Core/FormatClasses.h
+++ /dev/null
@@ -1,1598 +0,0 @@
-//===-- FormatClasses.h -----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_FormatClasses_h_
-#define lldb_FormatClasses_h_
-
-// C Includes
-#include <stdint.h>
-#include <unistd.h>
-
-// C++ Includes
-#include <string>
-#include <vector>
-
-// Other libraries and framework includes
-
-// Project includes
-#include "lldb/lldb-public.h"
-#include "lldb/lldb-enumerations.h"
-
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
-#include "lldb/Symbol/Type.h"
-
-namespace lldb_private {
-
-class TypeFormatImpl
-{
-public:
- class Flags
- {
- public:
-
- Flags () :
- m_flags (lldb::eTypeOptionCascade)
- {}
-
- Flags (const Flags& other) :
- m_flags (other.m_flags)
- {}
-
- Flags (uint32_t value) :
- m_flags (value)
- {}
-
- Flags&
- operator = (const Flags& rhs)
- {
- if (&rhs != this)
- m_flags = rhs.m_flags;
-
- return *this;
- }
-
- Flags&
- operator = (const uint32_t& rhs)
- {
- m_flags = rhs;
- return *this;
- }
-
- Flags&
- Clear()
- {
- m_flags = 0;
- return *this;
- }
-
- bool
- GetCascades () const
- {
- return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
- }
-
- Flags&
- SetCascades (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionCascade;
- else
- m_flags &= ~lldb::eTypeOptionCascade;
- return *this;
- }
-
- bool
- GetSkipPointers () const
- {
- return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
- }
-
- Flags&
- SetSkipPointers (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionSkipPointers;
- else
- m_flags &= ~lldb::eTypeOptionSkipPointers;
- return *this;
- }
-
- bool
- GetSkipReferences () const
- {
- return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
- }
-
- Flags&
- SetSkipReferences (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionSkipReferences;
- else
- m_flags &= ~lldb::eTypeOptionSkipReferences;
- return *this;
- }
-
- uint32_t
- GetValue ()
- {
- return m_flags;
- }
-
- void
- SetValue (uint32_t value)
- {
- m_flags = value;
- }
-
- private:
- uint32_t m_flags;
- };
-
- TypeFormatImpl (lldb::Format f = lldb::eFormatInvalid,
- const Flags& flags = Flags());
-
- typedef STD_SHARED_PTR(TypeFormatImpl) SharedPointer;
- typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
-
- ~TypeFormatImpl ()
- {
- }
-
- bool
- Cascades () const
- {
- return m_flags.GetCascades();
- }
- bool
- SkipsPointers () const
- {
- return m_flags.GetSkipPointers();
- }
- bool
- SkipsReferences () const
- {
- return m_flags.GetSkipReferences();
- }
-
- void
- SetCascades (bool value)
- {
- m_flags.SetCascades(value);
- }
-
- void
- SetSkipsPointers (bool value)
- {
- m_flags.SetSkipPointers(value);
- }
-
- void
- SetSkipsReferences (bool value)
- {
- m_flags.SetSkipReferences(value);
- }
-
- lldb::Format
- GetFormat () const
- {
- return m_format;
- }
-
- void
- SetFormat (lldb::Format fmt)
- {
- m_format = fmt;
- }
-
- uint32_t
- GetOptions ()
- {
- return m_flags.GetValue();
- }
-
- void
- SetOptions (uint32_t value)
- {
- m_flags.SetValue(value);
- }
-
- uint32_t&
- GetRevision ()
- {
- return m_my_revision;
- }
-
- std::string
- GetDescription();
-
-protected:
- Flags m_flags;
- lldb::Format m_format;
- uint32_t m_my_revision;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
-};
-
-class SyntheticChildrenFrontEnd
-{
-protected:
- ValueObject &m_backend;
-public:
-
- SyntheticChildrenFrontEnd (ValueObject &backend) :
- m_backend(backend)
- {}
-
- virtual
- ~SyntheticChildrenFrontEnd ()
- {
- }
-
- virtual size_t
- CalculateNumChildren () = 0;
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx) = 0;
-
- virtual uint32_t
- GetIndexOfChildWithName (const ConstString &name) = 0;
-
- // this function is assumed to always succeed and it if fails, the front-end should know to deal
- // with it in the correct way (most probably, by refusing to return any children)
- // the return value of Update() should actually be interpreted as "ValueObjectSyntheticFilter cache is good/bad"
- // if =true, ValueObjectSyntheticFilter is allowed to use the children it fetched previously and cached
- // if =false, ValueObjectSyntheticFilter must throw away its cache, and query again for children
- virtual bool
- Update () = 0;
-
- // if this function returns false, then CalculateNumChildren() MUST return 0 since UI frontends
- // might validly decide not to inquire for children given a false return value from this call
- // if it returns true, then CalculateNumChildren() can return any number >= 0 (0 being valid)
- // it should if at all possible be more efficient than CalculateNumChildren()
- virtual bool
- MightHaveChildren () = 0;
-
- typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
- typedef std::auto_ptr<SyntheticChildrenFrontEnd> AutoPointer;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
-};
-
-class SyntheticChildren
-{
-public:
-
- class Flags
- {
- public:
-
- Flags () :
- m_flags (lldb::eTypeOptionCascade)
- {}
-
- Flags (const Flags& other) :
- m_flags (other.m_flags)
- {}
-
- Flags (uint32_t value) :
- m_flags (value)
- {}
-
- Flags&
- operator = (const Flags& rhs)
- {
- if (&rhs != this)
- m_flags = rhs.m_flags;
-
- return *this;
- }
-
- Flags&
- operator = (const uint32_t& rhs)
- {
- m_flags = rhs;
- return *this;
- }
-
- Flags&
- Clear()
- {
- m_flags = 0;
- return *this;
- }
-
- bool
- GetCascades () const
- {
- return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
- }
-
- Flags&
- SetCascades (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionCascade;
- else
- m_flags &= ~lldb::eTypeOptionCascade;
- return *this;
- }
-
- bool
- GetSkipPointers () const
- {
- return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
- }
-
- Flags&
- SetSkipPointers (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionSkipPointers;
- else
- m_flags &= ~lldb::eTypeOptionSkipPointers;
- return *this;
- }
-
- bool
- GetSkipReferences () const
- {
- return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
- }
-
- Flags&
- SetSkipReferences (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionSkipReferences;
- else
- m_flags &= ~lldb::eTypeOptionSkipReferences;
- return *this;
- }
-
- uint32_t
- GetValue ()
- {
- return m_flags;
- }
-
- void
- SetValue (uint32_t value)
- {
- m_flags = value;
- }
-
- private:
- uint32_t m_flags;
- };
-
- SyntheticChildren (const Flags& flags) :
- m_flags(flags)
- {
- }
-
- virtual
- ~SyntheticChildren ()
- {
- }
-
- bool
- Cascades () const
- {
- return m_flags.GetCascades();
- }
- bool
- SkipsPointers () const
- {
- return m_flags.GetSkipPointers();
- }
- bool
- SkipsReferences () const
- {
- return m_flags.GetSkipReferences();
- }
-
- void
- SetCascades (bool value)
- {
- m_flags.SetCascades(value);
- }
-
- void
- SetSkipsPointers (bool value)
- {
- m_flags.SetSkipPointers(value);
- }
-
- void
- SetSkipsReferences (bool value)
- {
- m_flags.SetSkipReferences(value);
- }
-
- uint32_t
- GetOptions ()
- {
- return m_flags.GetValue();
- }
-
- void
- SetOptions (uint32_t value)
- {
- m_flags.SetValue(value);
- }
-
- virtual bool
- IsScripted () = 0;
-
- virtual std::string
- GetDescription () = 0;
-
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd (ValueObject &backend) = 0;
-
- typedef STD_SHARED_PTR(SyntheticChildren) SharedPointer;
- typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
-
- uint32_t&
- GetRevision ()
- {
- return m_my_revision;
- }
-
-protected:
- uint32_t m_my_revision;
- Flags m_flags;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
-};
-
-class TypeFilterImpl : public SyntheticChildren
-{
- std::vector<std::string> m_expression_paths;
-public:
- TypeFilterImpl(const SyntheticChildren::Flags& flags) :
- SyntheticChildren(flags),
- m_expression_paths()
- {
- }
-
- void
- AddExpressionPath (const char* path)
- {
- AddExpressionPath(std::string(path));
- }
-
- void
- Clear()
- {
- m_expression_paths.clear();
- }
-
- size_t
- GetCount() const
- {
- return m_expression_paths.size();
- }
-
- const char*
- GetExpressionPathAtIndex(size_t i) const
- {
- return m_expression_paths[i].c_str();
- }
-
- bool
- SetExpressionPathAtIndex (int i, const char* path)
- {
- return SetExpressionPathAtIndex(i, std::string(path));
- }
-
- void
- AddExpressionPath (std::string path)
- {
- bool need_add_dot = true;
- if (path[0] == '.' ||
- (path[0] == '-' && path[1] == '>') ||
- path[0] == '[')
- need_add_dot = false;
- // add a '.' symbol to help forgetful users
- if(!need_add_dot)
- m_expression_paths.push_back(path);
- else
- m_expression_paths.push_back(std::string(".") + path);
- }
-
- bool
- SetExpressionPathAtIndex (int i, std::string path)
- {
- if (i >= GetCount())
- return false;
- bool need_add_dot = true;
- if (path[0] == '.' ||
- (path[0] == '-' && path[1] == '>') ||
- path[0] == '[')
- need_add_dot = false;
- // add a '.' symbol to help forgetful users
- if(!need_add_dot)
- m_expression_paths[i] = path;
- else
- m_expression_paths[i] = std::string(".") + path;
- return true;
- }
-
- bool
- IsScripted()
- {
- return false;
- }
-
- std::string
- GetDescription();
-
- class FrontEnd : public SyntheticChildrenFrontEnd
- {
- private:
- TypeFilterImpl* filter;
- public:
-
- FrontEnd(TypeFilterImpl* flt,
- ValueObject &backend) :
- SyntheticChildrenFrontEnd(backend),
- filter(flt)
- {}
-
- virtual
- ~FrontEnd()
- {
- }
-
- virtual size_t
- CalculateNumChildren()
- {
- return filter->GetCount();
- }
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx)
- {
- if (idx >= filter->GetCount())
- return lldb::ValueObjectSP();
- return m_backend.GetSyntheticExpressionPathChild(filter->GetExpressionPathAtIndex(idx), true);
- }
-
- virtual bool
- Update() { return false; }
-
- virtual bool
- MightHaveChildren ()
- {
- return filter->GetCount() > 0;
- }
-
- virtual uint32_t
- GetIndexOfChildWithName (const ConstString &name)
- {
- const char* name_cstr = name.GetCString();
- for (int i = 0; i < filter->GetCount(); i++)
- {
- const char* expr_cstr = filter->GetExpressionPathAtIndex(i);
- if (expr_cstr)
- {
- if (*expr_cstr == '.')
- expr_cstr++;
- else if (*expr_cstr == '-' && *(expr_cstr+1) == '>')
- expr_cstr += 2;
- }
- if (!::strcmp(name_cstr, expr_cstr))
- return i;
- }
- return UINT32_MAX;
- }
-
- typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(FrontEnd);
- };
-
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd(ValueObject &backend)
- {
- return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
- }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
-};
-
- class CXXSyntheticChildren : public SyntheticChildren
- {
- public:
- typedef SyntheticChildrenFrontEnd* (*CreateFrontEndCallback) (CXXSyntheticChildren*, lldb::ValueObjectSP);
- protected:
- CreateFrontEndCallback m_create_callback;
- std::string m_description;
- public:
- CXXSyntheticChildren(const SyntheticChildren::Flags& flags,
- const char* description,
- CreateFrontEndCallback callback) :
- SyntheticChildren(flags),
- m_create_callback(callback),
- m_description(description ? description : "")
- {
- }
-
- bool
- IsScripted()
- {
- return false;
- }
-
- std::string
- GetDescription();
-
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd(ValueObject &backend)
- {
- return SyntheticChildrenFrontEnd::AutoPointer(m_create_callback(this, backend.GetSP()));
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
- };
-
-#ifndef LLDB_DISABLE_PYTHON
-
-class TypeSyntheticImpl : public SyntheticChildren
-{
- std::string m_python_class;
- std::string m_python_code;
-public:
-
- TypeSyntheticImpl(const SyntheticChildren::Flags& flags,
- const char* pclass,
- const char* pcode = NULL) :
- SyntheticChildren(flags),
- m_python_class(),
- m_python_code()
- {
- if (pclass)
- m_python_class = pclass;
- if (pcode)
- m_python_code = pcode;
- }
-
- const char*
- GetPythonClassName()
- {
- return m_python_class.c_str();
- }
-
- const char*
- GetPythonCode()
- {
- return m_python_code.c_str();
- }
-
- void
- SetPythonClassName (const char* fname)
- {
- m_python_class.assign(fname);
- m_python_code.clear();
- }
-
- void
- SetPythonCode (const char* script)
- {
- m_python_code.assign(script);
- }
-
- std::string
- GetDescription();
-
- bool
- IsScripted()
- {
- return true;
- }
-
- class FrontEnd : public SyntheticChildrenFrontEnd
- {
- private:
- std::string m_python_class;
- lldb::ScriptInterpreterObjectSP m_wrapper_sp;
- ScriptInterpreter *m_interpreter;
- public:
-
- FrontEnd(std::string pclass,
- ValueObject &backend);
-
- virtual
- ~FrontEnd();
-
- virtual size_t
- CalculateNumChildren()
- {
- if (!m_wrapper_sp || m_interpreter == NULL)
- return 0;
- return m_interpreter->CalculateNumChildren(m_wrapper_sp);
- }
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update()
- {
- if (!m_wrapper_sp || m_interpreter == NULL)
- return false;
-
- return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp);
- }
-
- virtual bool
- MightHaveChildren()
- {
- if (!m_wrapper_sp || m_interpreter == NULL)
- return false;
-
- return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp);
- }
-
- virtual uint32_t
- GetIndexOfChildWithName (const ConstString &name)
- {
- if (!m_wrapper_sp || m_interpreter == NULL)
- return UINT32_MAX;
- return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp, name.GetCString());
- }
-
- typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(FrontEnd);
- };
-
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd(ValueObject &backend)
- {
- return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(m_python_class, backend));
- }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeSyntheticImpl);
-};
-
-#endif // #ifndef LLDB_DISABLE_PYTHON
-class SyntheticArrayView : public SyntheticChildren
-{
-public:
-
- struct SyntheticArrayRange
- {
- private:
- int m_low;
- int m_high;
- SyntheticArrayRange* m_next;
-
- public:
-
- SyntheticArrayRange () :
- m_low(-1),
- m_high(-2),
- m_next(NULL)
- {}
-
- SyntheticArrayRange (int L) :
- m_low(L),
- m_high(L),
- m_next(NULL)
- {}
-
- SyntheticArrayRange (int L, int H) :
- m_low(L),
- m_high(H),
- m_next(NULL)
- {}
-
- SyntheticArrayRange (int L, int H, SyntheticArrayRange* N) :
- m_low(L),
- m_high(H),
- m_next(N)
- {}
-
- inline int
- GetLow ()
- {
- return m_low;
- }
-
- inline int
- GetHigh ()
- {
- return m_high;
- }
-
- inline void
- SetLow (int L)
- {
- m_low = L;
- }
-
- inline void
- SetHigh (int H)
- {
- m_high = H;
- }
-
- inline int
- GetSelfCount()
- {
- return GetHigh() - GetLow() + 1;
- }
-
- int
- GetCount()
- {
- int count = GetSelfCount();
- if (m_next)
- count += m_next->GetCount();
- return count;
- }
-
- inline SyntheticArrayRange*
- GetNext()
- {
- return m_next;
- }
-
- void
- SetNext(SyntheticArrayRange* N)
- {
- if (m_next)
- delete m_next;
- m_next = N;
- }
-
- void
- SetNext(int L, int H)
- {
- if (m_next)
- delete m_next;
- m_next = new SyntheticArrayRange(L, H);
- }
-
- void
- SetNext(int L)
- {
- if (m_next)
- delete m_next;
- m_next = new SyntheticArrayRange(L);
- }
-
- ~SyntheticArrayRange()
- {
- delete m_next;
- m_next = NULL;
- }
-
- };
-
- SyntheticArrayView(const SyntheticChildren::Flags& flags) :
- SyntheticChildren(flags),
- m_head(),
- m_tail(&m_head)
- {
- }
-
- void
- AddRange(int L, int H)
- {
- m_tail->SetLow(L);
- m_tail->SetHigh(H);
- m_tail->SetNext(new SyntheticArrayRange());
- m_tail = m_tail->GetNext();
- }
-
- int
- GetCount()
- {
- return m_head.GetCount();
- }
-
- int
- GetRealIndexForIndex(size_t i);
-
- bool
- IsScripted()
- {
- return false;
- }
-
- std::string
- GetDescription();
-
- class FrontEnd : public SyntheticChildrenFrontEnd
- {
- private:
- SyntheticArrayView* filter;
- public:
-
- FrontEnd(SyntheticArrayView* flt,
- ValueObject &backend) :
- SyntheticChildrenFrontEnd(backend),
- filter(flt)
- {}
-
- virtual
- ~FrontEnd()
- {
- }
-
- virtual size_t
- CalculateNumChildren()
- {
- return filter->GetCount();
- }
-
- virtual bool
- MightHaveChildren ()
- {
- return filter->GetCount() > 0;
- }
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx)
- {
- if (idx >= filter->GetCount())
- return lldb::ValueObjectSP();
- return m_backend.GetSyntheticArrayMember(filter->GetRealIndexForIndex(idx), true);
- }
-
- virtual bool
- Update() { return false; }
-
- virtual uint32_t
- GetIndexOfChildWithName (const ConstString &name_cs);
-
- typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(FrontEnd);
- };
-
- virtual SyntheticChildrenFrontEnd::AutoPointer
- GetFrontEnd(ValueObject &backend)
- {
- return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
- }
-private:
- SyntheticArrayRange m_head;
- SyntheticArrayRange *m_tail;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(SyntheticArrayView);
-};
-
-
-class TypeSummaryImpl
-{
-public:
- class Flags
- {
- public:
-
- Flags () :
- m_flags (lldb::eTypeOptionCascade)
- {}
-
- Flags (const Flags& other) :
- m_flags (other.m_flags)
- {}
-
- Flags (uint32_t value) :
- m_flags (value)
- {}
-
- Flags&
- operator = (const Flags& rhs)
- {
- if (&rhs != this)
- m_flags = rhs.m_flags;
-
- return *this;
- }
-
- Flags&
- operator = (const uint32_t& rhs)
- {
- m_flags = rhs;
- return *this;
- }
-
- Flags&
- Clear()
- {
- m_flags = 0;
- return *this;
- }
-
- bool
- GetCascades () const
- {
- return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
- }
-
- Flags&
- SetCascades (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionCascade;
- else
- m_flags &= ~lldb::eTypeOptionCascade;
- return *this;
- }
-
- bool
- GetSkipPointers () const
- {
- return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
- }
-
- Flags&
- SetSkipPointers (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionSkipPointers;
- else
- m_flags &= ~lldb::eTypeOptionSkipPointers;
- return *this;
- }
-
- bool
- GetSkipReferences () const
- {
- return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
- }
-
- Flags&
- SetSkipReferences (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionSkipReferences;
- else
- m_flags &= ~lldb::eTypeOptionSkipReferences;
- return *this;
- }
-
- bool
- GetDontShowChildren () const
- {
- return (m_flags & lldb::eTypeOptionHideChildren) == lldb::eTypeOptionHideChildren;
- }
-
- Flags&
- SetDontShowChildren (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionHideChildren;
- else
- m_flags &= ~lldb::eTypeOptionHideChildren;
- return *this;
- }
-
- bool
- GetDontShowValue () const
- {
- return (m_flags & lldb::eTypeOptionHideValue) == lldb::eTypeOptionHideValue;
- }
-
- Flags&
- SetDontShowValue (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionHideValue;
- else
- m_flags &= ~lldb::eTypeOptionHideValue;
- return *this;
- }
-
- bool
- GetShowMembersOneLiner () const
- {
- return (m_flags & lldb::eTypeOptionShowOneLiner) == lldb::eTypeOptionShowOneLiner;
- }
-
- Flags&
- SetShowMembersOneLiner (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionShowOneLiner;
- else
- m_flags &= ~lldb::eTypeOptionShowOneLiner;
- return *this;
- }
-
- bool
- GetHideItemNames () const
- {
- return (m_flags & lldb::eTypeOptionHideNames) == lldb::eTypeOptionHideNames;
- }
-
- Flags&
- SetHideItemNames (bool value = true)
- {
- if (value)
- m_flags |= lldb::eTypeOptionHideNames;
- else
- m_flags &= ~lldb::eTypeOptionHideNames;
- return *this;
- }
-
- uint32_t
- GetValue ()
- {
- return m_flags;
- }
-
- void
- SetValue (uint32_t value)
- {
- m_flags = value;
- }
-
- private:
- uint32_t m_flags;
- };
-
- typedef enum Type
- {
- eTypeUnknown,
- eTypeString,
- eTypeScript,
- eTypeCallback
- } Type;
-
- TypeSummaryImpl (const TypeSummaryImpl::Flags& flags);
-
- bool
- Cascades () const
- {
- return m_flags.GetCascades();
- }
- bool
- SkipsPointers () const
- {
- return m_flags.GetSkipPointers();
- }
- bool
- SkipsReferences () const
- {
- return m_flags.GetSkipReferences();
- }
-
- bool
- DoesPrintChildren () const
- {
- return !m_flags.GetDontShowChildren();
- }
-
- bool
- DoesPrintValue () const
- {
- return !m_flags.GetDontShowValue();
- }
-
- bool
- IsOneliner () const
- {
- return m_flags.GetShowMembersOneLiner();
- }
-
- bool
- HideNames () const
- {
- return m_flags.GetHideItemNames();
- }
-
- void
- SetCascades (bool value)
- {
- m_flags.SetCascades(value);
- }
-
- void
- SetSkipsPointers (bool value)
- {
- m_flags.SetSkipPointers(value);
- }
-
- void
- SetSkipsReferences (bool value)
- {
- m_flags.SetSkipReferences(value);
- }
-
- void
- SetDoesPrintChildren (bool value)
- {
- m_flags.SetDontShowChildren(!value);
- }
-
- void
- SetDoesPrintValue (bool value)
- {
- m_flags.SetDontShowValue(!value);
- }
-
- void
- SetIsOneliner (bool value)
- {
- m_flags.SetShowMembersOneLiner(value);
- }
-
- void
- SetHideNames (bool value)
- {
- m_flags.SetHideItemNames(value);
- }
-
- uint32_t
- GetOptions ()
- {
- return m_flags.GetValue();
- }
-
- void
- SetOptions (uint32_t value)
- {
- m_flags.SetValue(value);
- }
-
- virtual
- ~TypeSummaryImpl ()
- {
- }
-
- // we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
- // extended periods of time and we trust the ValueObject to stay around for as long as it is required
- // for us to generate its summary
- virtual bool
- FormatObject (ValueObject *valobj,
- std::string& dest) = 0;
-
- virtual std::string
- GetDescription () = 0;
-
- virtual bool
- IsScripted() = 0;
-
- virtual Type
- GetType () = 0;
-
- uint32_t&
- GetRevision ()
- {
- return m_my_revision;
- }
-
- typedef STD_SHARED_PTR(TypeSummaryImpl) SharedPointer;
- typedef bool(*SummaryCallback)(void*, ConstString, const lldb::TypeSummaryImplSP&);
- typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::TypeSummaryImplSP&);
-
-protected:
- uint32_t m_my_revision;
- Flags m_flags;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
-};
-
-// simple string-based summaries, using ${var to show data
-struct StringSummaryFormat : public TypeSummaryImpl
-{
- std::string m_format;
-
- StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
- const char* f);
-
- const char*
- GetSummaryString () const
- {
- return m_format.c_str();
- }
-
- void
- SetSummaryString (const char* data)
- {
- if (data)
- m_format.assign(data);
- else
- m_format.clear();
- }
-
- virtual
- ~StringSummaryFormat()
- {
- }
-
- virtual bool
- FormatObject(ValueObject *valobj,
- std::string& dest);
-
- virtual std::string
- GetDescription();
-
- virtual bool
- IsScripted()
- {
- return false;
- }
-
-
- virtual Type
- GetType ()
- {
- return TypeSummaryImpl::eTypeString;
- }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
-};
-
-// summaries implemented via a C++ function
-struct CXXFunctionSummaryFormat : public TypeSummaryImpl
-{
-
- // we should convert these to SBValue and SBStream if we ever cross
- // the boundary towards the external world
- typedef bool (*Callback)(ValueObject& valobj,
- Stream& dest);
-
-
- Callback m_impl;
- std::string m_description;
-
- CXXFunctionSummaryFormat(const TypeSummaryImpl::Flags& flags,
- Callback impl,
- const char* description);
-
- Callback
- GetBackendFunction () const
- {
- return m_impl;
- }
-
- const char*
- GetTextualInfo () const
- {
- return m_description.c_str();
- }
-
- void
- SetBackendFunction (Callback cb_func)
- {
- m_impl = cb_func;
- }
-
- void
- SetTextualInfo (const char* descr)
- {
- if (descr)
- m_description.assign(descr);
- else
- m_description.clear();
- }
-
- virtual
- ~CXXFunctionSummaryFormat()
- {
- }
-
- virtual bool
- FormatObject(ValueObject *valobj,
- std::string& dest);
-
- virtual std::string
- GetDescription();
-
- virtual bool
- IsScripted()
- {
- return false;
- }
-
- virtual Type
- GetType ()
- {
- return TypeSummaryImpl::eTypeCallback;
- }
-
- typedef STD_SHARED_PTR(CXXFunctionSummaryFormat) SharedPointer;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
-};
-
-#ifndef LLDB_DISABLE_PYTHON
-
-// Python-based summaries, running script code to show data
-struct ScriptSummaryFormat : public TypeSummaryImpl
-{
- std::string m_function_name;
- std::string m_python_script;
- lldb::ScriptInterpreterObjectSP m_script_function_sp;
-
- ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
- const char *function_name,
- const char* python_script = NULL);
-
- const char*
- GetFunctionName () const
- {
- return m_function_name.c_str();
- }
-
- const char*
- GetPythonScript () const
- {
- return m_python_script.c_str();
- }
-
- void
- SetFunctionName (const char* function_name)
- {
- if (function_name)
- m_function_name.assign(function_name);
- else
- m_function_name.clear();
- m_python_script.clear();
- }
-
- void
- SetPythonScript (const char* script)
- {
- if (script)
- m_python_script.assign(script);
- else
- m_python_script.clear();
- }
-
- virtual
- ~ScriptSummaryFormat()
- {
- }
-
- virtual bool
- FormatObject(ValueObject *valobj,
- std::string& dest);
-
- virtual std::string
- GetDescription();
-
- virtual bool
- IsScripted()
- {
- return true;
- }
-
- virtual Type
- GetType ()
- {
- return TypeSummaryImpl::eTypeScript;
- }
-
- typedef STD_SHARED_PTR(ScriptSummaryFormat) SharedPointer;
-
-
-private:
- DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
-};
-
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
-// TODO: at the moment, this class is only used as a backing store for SBTypeNameSpecifier in the public API
-// In the future, this might be used as the basic unit for typename-to-formatter matching, replacing
-// the current plain/regexp distinction in FormatNavigator<>
-class TypeNameSpecifierImpl
-{
-public:
-
- TypeNameSpecifierImpl() :
- m_is_regex(false),
- m_type()
- {
- }
-
- TypeNameSpecifierImpl (const char* name, bool is_regex) :
- m_is_regex(is_regex),
- m_type()
- {
- if (name)
- m_type.m_type_name.assign(name);
- }
-
- // if constructing with a given type, is_regex cannot be true since we are
- // giving an exact type to match
- TypeNameSpecifierImpl (lldb::TypeSP type) :
- m_is_regex(false),
- m_type()
- {
- if (type)
- {
- m_type.m_type_name.assign(type->GetName().GetCString());
- m_type.m_typeimpl_sp = lldb::TypeImplSP(new TypeImpl(type));
- }
- }
-
- TypeNameSpecifierImpl (ClangASTType type) :
- m_is_regex(false),
- m_type()
- {
- if (type.IsValid())
- {
- m_type.m_type_name.assign(type.GetConstTypeName().GetCString());
- m_type.m_typeimpl_sp = lldb::TypeImplSP(new TypeImpl(type));
- }
- }
-
- const char*
- GetName()
- {
- if (m_type.m_type_name.size())
- return m_type.m_type_name.c_str();
- return NULL;
- }
-
- lldb::TypeSP
- GetTypeSP ()
- {
- if (m_type.m_typeimpl_sp && m_type.m_typeimpl_sp->IsValid())
- return m_type.m_typeimpl_sp->GetTypeSP();
- return lldb::TypeSP();
- }
-
- ClangASTType
- GetClangASTType ()
- {
- if (m_type.m_typeimpl_sp && m_type.m_typeimpl_sp->IsValid())
- return m_type.m_typeimpl_sp->GetClangASTType();
- return ClangASTType();
- }
-
- bool
- IsRegex()
- {
- return m_is_regex;
- }
-
-private:
- bool m_is_regex;
- // this works better than TypeAndOrName because the latter only wraps a TypeSP
- // whereas TypeImplSP can also be backed by a ClangASTType which is more commonly
- // used in LLDB. moreover, TypeImplSP is also what is currently backing SBType
- struct TypeOrName
- {
- std::string m_type_name;
- lldb::TypeImplSP m_typeimpl_sp;
- };
- TypeOrName m_type;
-
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
-};
-
-} // namespace lldb_private
-
-#endif // lldb_FormatClasses_h_
diff --git a/lldb/include/lldb/Core/FormatManager.h b/lldb/include/lldb/Core/FormatManager.h
deleted file mode 100644
index 600ae74d132..00000000000
--- a/lldb/include/lldb/Core/FormatManager.h
+++ /dev/null
@@ -1,776 +0,0 @@
-//===-- FormatManager.h -------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_FormatManager_h_
-#define lldb_FormatManager_h_
-
-// C Includes
-// C++ Includes
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-public.h"
-#include "lldb/lldb-enumerations.h"
-
-#include "lldb/Core/FormatNavigator.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
-#include "lldb/Target/ExecutionContext.h"
-#include "lldb/Target/Platform.h"
-
-using lldb::LogSP;
-
-namespace lldb_private {
-
-// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
-// class DataVisualization is the high-level front-end of this feature
-// clients should refer to that class as the entry-point into the data formatters
-// unless they have a good reason to bypass it and prefer to use this file's objects directly
-
-class CategoryMap;
-
-class TypeCategoryImpl
-{
-private:
-
- typedef FormatNavigator<ConstString, TypeSummaryImpl> SummaryNavigator;
- typedef FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl> RegexSummaryNavigator;
-
- typedef FormatNavigator<ConstString, TypeFilterImpl> FilterNavigator;
- typedef FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl> RegexFilterNavigator;
-
-#ifndef LLDB_DISABLE_PYTHON
- typedef FormatNavigator<ConstString, TypeSyntheticImpl> SynthNavigator;
- typedef FormatNavigator<lldb::RegularExpressionSP, TypeSyntheticImpl> RegexSynthNavigator;
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
- typedef SummaryNavigator::MapType SummaryMap;
- typedef RegexSummaryNavigator::MapType RegexSummaryMap;
- typedef FilterNavigator::MapType FilterMap;
- typedef RegexFilterNavigator::MapType RegexFilterMap;
-#ifndef LLDB_DISABLE_PYTHON
- typedef SynthNavigator::MapType SynthMap;
- typedef RegexSynthNavigator::MapType RegexSynthMap;
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
-public:
-
- typedef uint16_t FormatCategoryItems;
- static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
-
- typedef SummaryNavigator::SharedPointer SummaryNavigatorSP;
- typedef RegexSummaryNavigator::SharedPointer RegexSummaryNavigatorSP;
- typedef FilterNavigator::SharedPointer FilterNavigatorSP;
- typedef RegexFilterNavigator::SharedPointer RegexFilterNavigatorSP;
-#ifndef LLDB_DISABLE_PYTHON
- typedef SynthNavigator::SharedPointer SynthNavigatorSP;
- typedef RegexSynthNavigator::SharedPointer RegexSynthNavigatorSP;
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
- TypeCategoryImpl (IFormatChangeListener* clist,
- ConstString name);
-
- SummaryNavigatorSP
- GetSummaryNavigator ()
- {
- return SummaryNavigatorSP(m_summary_nav);
- }
-
- RegexSummaryNavigatorSP
- GetRegexSummaryNavigator ()
- {
- return RegexSummaryNavigatorSP(m_regex_summary_nav);
- }
-
- FilterNavigatorSP
- GetFilterNavigator ()
- {
- return FilterNavigatorSP(m_filter_nav);
- }
-
- RegexFilterNavigatorSP
- GetRegexFilterNavigator ()
- {
- 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;
- }
-
-#ifndef LLDB_DISABLE_PYTHON
- 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;
- }
-#endif
-
- lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierForSummaryAtIndex (size_t index)
- {
- if (index < m_summary_nav->GetCount())
- return m_summary_nav->GetTypeNameSpecifierAtIndex(index);
- else
- return m_regex_summary_nav->GetTypeNameSpecifierAtIndex(index-m_summary_nav->GetCount());
- }
-
- SummaryNavigator::MapValueType
- GetSummaryAtIndex (size_t index)
- {
- if (index < m_summary_nav->GetCount())
- return m_summary_nav->GetAtIndex(index);
- else
- return m_regex_summary_nav->GetAtIndex(index-m_summary_nav->GetCount());
- }
-
- FilterNavigator::MapValueType
- GetFilterAtIndex (size_t index)
- {
- if (index < m_filter_nav->GetCount())
- return m_filter_nav->GetAtIndex(index);
- else
- return m_regex_filter_nav->GetAtIndex(index-m_filter_nav->GetCount());
- }
-
- lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierForFilterAtIndex (size_t index)
- {
- if (index < m_filter_nav->GetCount())
- return m_filter_nav->GetTypeNameSpecifierAtIndex(index);
- else
- return m_regex_filter_nav->GetTypeNameSpecifierAtIndex(index-m_filter_nav->GetCount());
- }
-
-#ifndef LLDB_DISABLE_PYTHON
- SynthNavigatorSP
- GetSyntheticNavigator ()
- {
- return SynthNavigatorSP(m_synth_nav);
- }
-
- RegexSynthNavigatorSP
- GetRegexSyntheticNavigator ()
- {
- return RegexSynthNavigatorSP(m_regex_synth_nav);
- }
-
- SynthNavigator::MapValueType
- GetSyntheticAtIndex (size_t index)
- {
- if (index < m_synth_nav->GetCount())
- return m_synth_nav->GetAtIndex(index);
- else
- return m_regex_synth_nav->GetAtIndex(index-m_synth_nav->GetCount());
- }
-
- lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierForSyntheticAtIndex (size_t index)
- {
- if (index < m_synth_nav->GetCount())
- return m_synth_nav->GetTypeNameSpecifierAtIndex(index);
- else
- return m_regex_synth_nav->GetTypeNameSpecifierAtIndex(index - m_synth_nav->GetCount());
- }
-
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
- bool
- IsEnabled () const
- {
- return m_enabled;
- }
-
- uint32_t
- GetEnabledPosition()
- {
- if (m_enabled == false)
- return UINT32_MAX;
- else
- return m_enabled_position;
- }
-
- bool
- Get (ValueObject& valobj,
- lldb::TypeSummaryImplSP& entry,
- lldb::DynamicValueType use_dynamic,
- uint32_t* reason = NULL);
-
- bool
- Get (ValueObject& valobj,
- lldb::SyntheticChildrenSP& entry,
- lldb::DynamicValueType use_dynamic,
- uint32_t* reason = NULL);
-
- void
- Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
-
- bool
- Delete (ConstString name,
- FormatCategoryItems items = ALL_ITEM_TYPES);
-
- uint32_t
- GetCount (FormatCategoryItems items = ALL_ITEM_TYPES);
-
- const char*
- GetName ()
- {
- return m_name.GetCString();
- }
-
- bool
- AnyMatches (ConstString type_name,
- FormatCategoryItems items = ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- FormatCategoryItems* matching_type = NULL);
-
- typedef STD_SHARED_PTR(TypeCategoryImpl) SharedPointer;
-
-private:
- SummaryNavigator::SharedPointer m_summary_nav;
- RegexSummaryNavigator::SharedPointer m_regex_summary_nav;
- FilterNavigator::SharedPointer m_filter_nav;
- RegexFilterNavigator::SharedPointer m_regex_filter_nav;
-#ifndef LLDB_DISABLE_PYTHON
- SynthNavigator::SharedPointer m_synth_nav;
- RegexSynthNavigator::SharedPointer m_regex_synth_nav;
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
- bool m_enabled;
-
- IFormatChangeListener* m_change_listener;
-
- Mutex m_mutex;
-
- ConstString m_name;
-
- uint32_t m_enabled_position;
-
- void
- Enable (bool value,
- uint32_t position)
- {
- Mutex::Locker locker(m_mutex);
- m_enabled = value;
- m_enabled_position = position;
- if (m_change_listener)
- m_change_listener->Changed();
- }
-
- void
- Disable ()
- {
- Enable(false, UINT32_MAX);
- }
-
- friend class CategoryMap;
-
- friend class FormatNavigator<ConstString, TypeSummaryImpl>;
- friend class FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl>;
-
- friend class FormatNavigator<ConstString, TypeFilterImpl>;
- friend class FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl>;
-
-#ifndef LLDB_DISABLE_PYTHON
- friend class FormatNavigator<ConstString, TypeSyntheticImpl>;
- friend class FormatNavigator<lldb::RegularExpressionSP, TypeSyntheticImpl>;
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
-
-};
-
-class CategoryMap
-{
-private:
- typedef ConstString KeyType;
- typedef TypeCategoryImpl ValueType;
- typedef ValueType::SharedPointer ValueSP;
- typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
- typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
-
-public:
- typedef std::map<KeyType, ValueSP> MapType;
- typedef MapType::iterator MapIterator;
- typedef bool(*CallbackType)(void*, const ValueSP&);
- typedef uint32_t Position;
-
- static const Position First = 0;
- static const Position Default = 1;
- static const Position Last = UINT32_MAX;
-
- CategoryMap (IFormatChangeListener* lst) :
- m_map_mutex(Mutex::eMutexTypeRecursive),
- listener(lst),
- m_map(),
- m_active_categories()
- {
- ConstString default_cs("default");
- lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
- Add(default_cs,default_sp);
- Enable(default_cs,First);
- }
-
- void
- Add (KeyType name,
- const ValueSP& entry)
- {
- Mutex::Locker locker(m_map_mutex);
- m_map[name] = entry;
- if (listener)
- listener->Changed();
- }
-
- bool
- Delete (KeyType name)
- {
- Mutex::Locker locker(m_map_mutex);
- MapIterator iter = m_map.find(name);
- if (iter == m_map.end())
- return false;
- m_map.erase(name);
- Disable(name);
- if (listener)
- listener->Changed();
- return true;
- }
-
- bool
- Enable (KeyType category_name,
- Position pos = Default)
- {
- Mutex::Locker locker(m_map_mutex);
- ValueSP category;
- if (!Get(category_name,category))
- return false;
- return Enable(category, pos);
- }
-
- bool
- Disable (KeyType category_name)
- {
- Mutex::Locker locker(m_map_mutex);
- ValueSP category;
- if (!Get(category_name,category))
- return false;
- return Disable(category);
- }
-
- bool
- Enable (ValueSP category,
- Position pos = Default)
- {
- Mutex::Locker locker(m_map_mutex);
- if (category.get())
- {
- Position pos_w = pos;
- if (pos == First || m_active_categories.size() == 0)
- m_active_categories.push_front(category);
- else if (pos == Last || pos == m_active_categories.size())
- m_active_categories.push_back(category);
- else if (pos < m_active_categories.size())
- {
- ActiveCategoriesList::iterator iter = m_active_categories.begin();
- while (pos_w)
- {
- pos_w--,iter++;
- }
- m_active_categories.insert(iter,category);
- }
- else
- return false;
- category->Enable(true,
- pos);
- return true;
- }
- return false;
- }
-
- bool
- Disable (ValueSP category)
- {
- Mutex::Locker locker(m_map_mutex);
- if (category.get())
- {
- m_active_categories.remove_if(delete_matching_categories(category));
- category->Disable();
- return true;
- }
- return false;
- }
-
- void
- Clear ()
- {
- Mutex::Locker locker(m_map_mutex);
- m_map.clear();
- m_active_categories.clear();
- if (listener)
- listener->Changed();
- }
-
- bool
- Get (KeyType name,
- ValueSP& entry)
- {
- Mutex::Locker locker(m_map_mutex);
- MapIterator iter = m_map.find(name);
- if (iter == m_map.end())
- return false;
- entry = iter->second;
- return true;
- }
-
- bool
- Get (uint32_t pos,
- ValueSP& entry)
- {
- Mutex::Locker locker(m_map_mutex);
- MapIterator iter = m_map.begin();
- MapIterator end = m_map.end();
- while (pos > 0)
- {
- iter++;
- pos--;
- if (iter == end)
- return false;
- }
- entry = iter->second;
- return false;
- }
-
- void
- LoopThrough (CallbackType callback, void* param);
-
- lldb::TypeCategoryImplSP
- GetAtIndex (size_t index);
-
- bool
- AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
-
- size_t
- GetCount ()
- {
- return m_map.size();
- }
-
- lldb::TypeSummaryImplSP
- GetSummaryFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic);
-
-#ifndef LLDB_DISABLE_PYTHON
- lldb::SyntheticChildrenSP
- GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic);
-#endif
-
-private:
-
- class delete_matching_categories
- {
- lldb::TypeCategoryImplSP ptr;
- public:
- delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
- {}
-
- bool operator()(const lldb::TypeCategoryImplSP& other)
- {
- return ptr.get() == other.get();
- }
- };
-
- Mutex m_map_mutex;
- IFormatChangeListener* listener;
-
- MapType m_map;
- ActiveCategoriesList m_active_categories;
-
- MapType& map ()
- {
- return m_map;
- }
-
- ActiveCategoriesList& active_list ()
- {
- return m_active_categories;
- }
-
- Mutex& mutex ()
- {
- return m_map_mutex;
- }
-
- friend class FormatNavigator<KeyType, ValueType>;
- friend class FormatManager;
-};
-
-class FormatManager : public IFormatChangeListener
-{
- typedef FormatNavigator<ConstString, TypeFormatImpl> ValueNavigator;
- typedef ValueNavigator::MapType ValueMap;
- typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
- typedef CategoryMap::MapType::iterator CategoryMapIterator;
-public:
-
- typedef CategoryMap::CallbackType CategoryCallback;
-
- FormatManager ();
-
- ValueNavigator&
- GetValueNavigator ()
- {
- return m_value_nav;
- }
-
- NamedSummariesMap&
- GetNamedSummaryNavigator ()
- {
- return m_named_summaries_map;
- }
-
- void
- EnableCategory (const ConstString& category_name,
- CategoryMap::Position pos = CategoryMap::Default)
- {
- m_categories_map.Enable(category_name,
- pos);
- }
-
- void
- DisableCategory (const ConstString& category_name)
- {
- m_categories_map.Disable(category_name);
- }
-
- void
- EnableCategory (const lldb::TypeCategoryImplSP& category,
- CategoryMap::Position pos = CategoryMap::Default)
- {
- m_categories_map.Enable(category,
- pos);
- }
-
- void
- DisableCategory (const lldb::TypeCategoryImplSP& category)
- {
- m_categories_map.Disable(category);
- }
-
- bool
- DeleteCategory (const ConstString& category_name)
- {
- return m_categories_map.Delete(category_name);
- }
-
- void
- ClearCategories ()
- {
- return m_categories_map.Clear();
- }
-
- size_t
- GetCategoriesCount ()
- {
- return m_categories_map.GetCount();
- }
-
- lldb::TypeCategoryImplSP
- GetCategoryAtIndex (size_t index)
- {
- return m_categories_map.GetAtIndex(index);
- }
-
- void
- LoopThroughCategories (CategoryCallback callback, void* param)
- {
- m_categories_map.LoopThrough(callback, param);
- }
-
- lldb::TypeCategoryImplSP
- GetCategory (const char* category_name = NULL,
- bool can_create = true)
- {
- if (!category_name)
- return GetCategory(m_default_category_name);
- return GetCategory(ConstString(category_name));
- }
-
- lldb::TypeCategoryImplSP
- GetCategory (const ConstString& category_name,
- bool can_create = true);
-
- lldb::TypeSummaryImplSP
- GetSummaryFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
- {
- return m_categories_map.GetSummaryFormat(valobj, use_dynamic);
- }
-
- lldb::TypeSummaryImplSP
- GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
-
- lldb::TypeFilterImplSP
- GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
-
-#ifndef LLDB_DISABLE_PYTHON
- lldb::TypeSyntheticImplSP
- GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
- lldb::SyntheticChildrenSP
- GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp);
-#endif
-
-#ifndef LLDB_DISABLE_PYTHON
- lldb::SyntheticChildrenSP
- GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
- {
- return m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
- }
-#endif
-
- bool
- AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
- bool only_enabled = true,
- const char** matching_category = NULL,
- TypeCategoryImpl::FormatCategoryItems* matching_type = NULL)
- {
- return m_categories_map.AnyMatches(type_name,
- items,
- only_enabled,
- matching_category,
- matching_type);
- }
-
- static bool
- GetFormatFromCString (const char *format_cstr,
- bool partial_match_ok,
- lldb::Format &format);
-
- static char
- GetFormatAsFormatChar (lldb::Format format);
-
- static const char *
- GetFormatAsCString (lldb::Format format);
-
- // if the user tries to add formatters for, say, "struct Foo"
- // those will not match any type because of the way we strip qualifiers from typenames
- // this method looks for the case where the user is adding a "class","struct","enum" or "union" Foo
- // and strips the unnecessary qualifier
- static ConstString
- GetValidTypeName (const ConstString& type);
-
- // when DataExtractor dumps a vectorOfT, it uses a predefined format for each item
- // this method returns it, or eFormatInvalid if vector_format is not a vectorOf
- static lldb::Format
- GetSingleItemFormat (lldb::Format vector_format);
-
- void
- Changed ()
- {
- __sync_add_and_fetch(&m_last_revision, +1);
- }
-
- uint32_t
- GetCurrentRevision ()
- {
- return m_last_revision;
- }
-
- ~FormatManager ()
- {
- }
-
-private:
- ValueNavigator m_value_nav;
- NamedSummariesMap m_named_summaries_map;
- uint32_t m_last_revision;
- CategoryMap m_categories_map;
-
- ConstString m_default_category_name;
- ConstString m_system_category_name;
- ConstString m_gnu_cpp_category_name;
- ConstString m_libcxx_category_name;
- ConstString m_objc_category_name;
- ConstString m_corefoundation_category_name;
- ConstString m_coregraphics_category_name;
- ConstString m_coreservices_category_name;
- ConstString m_vectortypes_category_name;
- ConstString m_appkit_category_name;
-
- CategoryMap&
- GetCategories ()
- {
- return m_categories_map;
- }
-
- // WARNING: these are temporary functions that setup formatters
- // while a few of these actually should be globally available and setup by LLDB itself
- // most would actually belong to the users' lldbinit file or to some other form of configurable
- // storage
- void
- LoadLibStdcppFormatters ();
-
- void
- LoadLibcxxFormatters ();
-
- void
- LoadSystemFormatters ();
-
- void
- LoadObjCFormatters ();
-};
-
-} // namespace lldb_private
-
-#endif // lldb_FormatManager_h_
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index e23fc43d037..3fc250c3811 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -808,10 +808,7 @@ public:
UpdateValueIfNeeded (bool update_format = true);
bool
- UpdateValueIfNeeded (lldb::DynamicValueType use_dynamic, bool update_format = true);
-
- bool
- UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic = lldb::eNoDynamicValues);
+ UpdateFormatsIfNeeded();
lldb::ValueObjectSP
GetSP ()
@@ -843,10 +840,7 @@ public:
lldb::ValueObjectSP
GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create);
-
- lldb::ValueObjectSP
- GetSyntheticArrayRangeChild (uint32_t from, uint32_t to, bool can_create);
-
+
lldb::ValueObjectSP
GetSyntheticExpressionPathChild(const char* expression, bool can_create);
@@ -856,6 +850,15 @@ public:
virtual lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
+ virtual lldb::DynamicValueType
+ GetDynamicValueType ()
+ {
+ if (m_parent)
+ return m_parent->GetDynamicValueType ();
+ else
+ return lldb::eNoDynamicValues;
+ }
+
virtual lldb::ValueObjectSP
GetStaticValue ();
@@ -1009,7 +1012,7 @@ public:
lldb::TypeSummaryImplSP
GetSummaryFormat()
{
- UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
+ UpdateFormatsIfNeeded();
return m_type_summary_sp;
}
@@ -1030,7 +1033,7 @@ public:
lldb::TypeFormatImplSP
GetValueFormat()
{
- UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
+ UpdateFormatsIfNeeded();
return m_type_format_sp;
}
@@ -1046,7 +1049,7 @@ public:
lldb::SyntheticChildrenSP
GetSyntheticChildren()
{
- UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
+ UpdateFormatsIfNeeded();
return m_synthetic_children_sp;
}
@@ -1218,7 +1221,6 @@ protected:
lldb::Format m_format;
uint32_t m_last_format_mgr_revision;
- lldb::DynamicValueType m_last_format_mgr_dynamic;
lldb::TypeSummaryImplSP m_type_summary_sp;
lldb::TypeFormatImplSP m_type_format_sp;
lldb::SyntheticChildrenSP m_synthetic_children_sp;
diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index f366194ba4f..a0ef374a074 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -90,6 +90,12 @@ public:
virtual bool
SetValueFromCString (const char *value_str, Error& error);
+ virtual lldb::DynamicValueType
+ GetDynamicValueType ()
+ {
+ return m_use_dynamic;
+ }
+
protected:
virtual bool
UpdateValue ();
diff --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
index c64109119d3..947f1af230a 100644
--- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -38,6 +38,9 @@ public:
virtual ConstString
GetTypeName();
+
+ virtual ConstString
+ GetQualifiedTypeName();
virtual bool
MightHaveChildren();
@@ -57,6 +60,9 @@ public:
virtual size_t
GetIndexOfChildWithName (const ConstString &name);
+ virtual lldb::ValueObjectSP
+ GetDynamicValue (lldb::DynamicValueType valueType);
+
virtual bool
IsInScope ();
diff --git a/lldb/include/lldb/Core/CXXFormatterFunctions.h b/lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h
index 12a8b4744a1..9dd819a150f 100644
--- a/lldb/include/lldb/Core/CXXFormatterFunctions.h
+++ b/lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h
@@ -14,14 +14,13 @@
#include "lldb/lldb-forward.h"
#include "lldb/Core/ConstString.h"
-#include "lldb/Core/FormatClasses.h"
+#include "lldb/DataFormatters/FormatClasses.h"
#include "clang/AST/ASTContext.h"
namespace lldb_private {
namespace formatters
{
-
bool
ExtractValueFromObjCExpression (ValueObject &valobj,
const char* target_type,
@@ -147,7 +146,7 @@ namespace lldb_private {
virtual bool
MightHaveChildren ();
- virtual uint32_t
+ virtual size_t
GetIndexOfChildWithName (const ConstString &name);
virtual
@@ -178,7 +177,7 @@ namespace lldb_private {
virtual bool
MightHaveChildren ();
- virtual uint32_t
+ virtual size_t
GetIndexOfChildWithName (const ConstString &name);
virtual
@@ -186,7 +185,7 @@ namespace lldb_private {
private:
ExecutionContextRef m_exe_ctx_ref;
uint8_t m_ptr_size;
- size_t m_items;
+ uint64_t m_items;
lldb::addr_t m_data_ptr;
ClangASTType m_id_type;
std::vector<lldb::ValueObjectSP> m_children;
@@ -209,7 +208,7 @@ namespace lldb_private {
virtual bool
MightHaveChildren ();
- virtual uint32_t
+ virtual size_t
GetIndexOfChildWithName (const ConstString &name);
virtual
@@ -254,7 +253,7 @@ namespace lldb_private {
virtual bool
MightHaveChildren ();
- virtual uint32_t
+ virtual size_t
GetIndexOfChildWithName (const ConstString &name);
virtual
@@ -310,7 +309,7 @@ namespace lldb_private {
virtual bool
MightHaveChildren ();
- virtual uint32_t
+ virtual size_t
GetIndexOfChildWithName (const ConstString &name);
virtual
@@ -340,7 +339,7 @@ namespace lldb_private {
virtual bool
MightHaveChildren ();
- virtual uint32_t
+ virtual size_t
GetIndexOfChildWithName (const ConstString &name);
virtual
diff --git a/lldb/include/lldb/Core/DataVisualization.h b/lldb/include/lldb/DataFormatters/DataVisualization.h
index 1e8a7109f3f..499e0fe14d9 100644
--- a/lldb/include/lldb/Core/DataVisualization.h
+++ b/lldb/include/lldb/DataFormatters/DataVisualization.h
@@ -16,8 +16,8 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
-#include "lldb/Core/FormatClasses.h"
-#include "lldb/Core/FormatManager.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormatManager.h"
namespace lldb_private {
@@ -57,14 +57,14 @@ public:
static void
LoopThrough (TypeFormatImpl::ValueCallback callback, void* callback_baton);
- static uint32_t
+ static size_t
GetCount ();
static lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierForFormatAtIndex (uint32_t);
+ GetTypeNameSpecifierForFormatAtIndex (size_t);
static lldb::TypeFormatImplSP
- GetFormatAtIndex (uint32_t);
+ GetFormatAtIndex (size_t);
};
static lldb::TypeSummaryImplSP
@@ -83,7 +83,7 @@ public:
GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
#ifndef LLDB_DISABLE_PYTHON
- static lldb::TypeSyntheticImplSP
+ static lldb::ScriptedSyntheticChildrenSP
GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
#endif
@@ -145,14 +145,14 @@ public:
static void
Enable (const ConstString& category,
- CategoryMap::Position = CategoryMap::Default);
+ TypeCategoryMap::Position = TypeCategoryMap::Default);
static void
Disable (const ConstString& category);
static void
Enable (const lldb::TypeCategoryImplSP& category,
- CategoryMap::Position = CategoryMap::Default);
+ TypeCategoryMap::Position = TypeCategoryMap::Default);
static void
Disable (const lldb::TypeCategoryImplSP& category);
@@ -164,7 +164,7 @@ public:
GetCount ();
static lldb::TypeCategoryImplSP
- GetCategoryAtIndex (uint32_t);
+ GetCategoryAtIndex (size_t);
};
};
diff --git a/lldb/include/lldb/DataFormatters/FormatCache.h b/lldb/include/lldb/DataFormatters/FormatCache.h
new file mode 100644
index 00000000000..2e6d5551add
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/FormatCache.h
@@ -0,0 +1,105 @@
+//===-- FormatCache.h ---------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatCache_h_
+#define lldb_FormatCache_h_
+
+// C Includes
+// C++ Includes
+#include <map>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/Core/ConstString.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+
+namespace lldb_private {
+class FormatCache
+{
+private:
+ struct Entry
+ {
+ private:
+ bool m_summary_cached : 1;
+ bool m_synthetic_cached : 1;
+
+ lldb::TypeSummaryImplSP m_summary_sp;
+ lldb::SyntheticChildrenSP m_synthetic_sp;
+ public:
+ Entry ();
+ Entry (lldb::TypeSummaryImplSP);
+ Entry (lldb::SyntheticChildrenSP);
+ Entry (lldb::TypeSummaryImplSP,lldb::SyntheticChildrenSP);
+
+ bool
+ IsSummaryCached ();
+
+ bool
+ IsSyntheticCached ();
+
+ lldb::TypeSummaryImplSP
+ GetSummary ();
+
+ lldb::SyntheticChildrenSP
+ GetSynthetic ();
+
+ void
+ SetSummary (lldb::TypeSummaryImplSP);
+
+ void
+ SetSynthetic (lldb::SyntheticChildrenSP);
+ };
+ typedef std::map<ConstString,Entry> CacheMap;
+ CacheMap m_map;
+ Mutex m_mutex;
+
+#ifdef LLDB_CONFIGURATION_DEBUG
+ uint64_t m_cache_hits;
+ uint64_t m_cache_misses;
+#endif
+
+ Entry&
+ GetEntry (const ConstString& type);
+
+public:
+ FormatCache ();
+
+ bool
+ GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp);
+
+ bool
+ GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp);
+
+ void
+ SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp);
+
+ void
+ SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp);
+
+ void
+ Clear ();
+
+#ifdef LLDB_CONFIGURATION_DEBUG
+ uint64_t
+ GetCacheHits ()
+ {
+ return m_cache_hits;
+ }
+
+ uint64_t
+ GetCacheMisses ()
+ {
+ return m_cache_misses;
+ }
+#endif
+};
+} // namespace lldb_private
+
+#endif // lldb_FormatCache_h_
diff --git a/lldb/include/lldb/DataFormatters/FormatClasses.h b/lldb/include/lldb/DataFormatters/FormatClasses.h
new file mode 100644
index 00000000000..48a8eda4ad4
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/FormatClasses.h
@@ -0,0 +1,128 @@
+//===-- FormatClasses.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatClasses_h_
+#define lldb_FormatClasses_h_
+
+// C Includes
+#include <stdint.h>
+#include <unistd.h>
+
+// C++ Includes
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/Type.h"
+
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+namespace lldb_private {
+
+class TypeNameSpecifierImpl
+{
+public:
+ TypeNameSpecifierImpl() :
+ m_is_regex(false),
+ m_type()
+ {
+ }
+
+ TypeNameSpecifierImpl (const char* name, bool is_regex) :
+ m_is_regex(is_regex),
+ m_type()
+ {
+ if (name)
+ m_type.m_type_name.assign(name);
+ }
+
+ // if constructing with a given type, is_regex cannot be true since we are
+ // giving an exact type to match
+ TypeNameSpecifierImpl (lldb::TypeSP type) :
+ m_is_regex(false),
+ m_type()
+ {
+ if (type)
+ {
+ m_type.m_type_name.assign(type->GetName().GetCString());
+ m_type.m_typeimpl_sp = lldb::TypeImplSP(new TypeImpl(type));
+ }
+ }
+
+ TypeNameSpecifierImpl (ClangASTType type) :
+ m_is_regex(false),
+ m_type()
+ {
+ if (type.IsValid())
+ {
+ m_type.m_type_name.assign(type.GetConstTypeName().GetCString());
+ m_type.m_typeimpl_sp = lldb::TypeImplSP(new TypeImpl(type));
+ }
+ }
+
+ const char*
+ GetName()
+ {
+ if (m_type.m_type_name.size())
+ return m_type.m_type_name.c_str();
+ return NULL;
+ }
+
+ lldb::TypeSP
+ GetTypeSP ()
+ {
+ if (m_type.m_typeimpl_sp && m_type.m_typeimpl_sp->IsValid())
+ return m_type.m_typeimpl_sp->GetTypeSP();
+ return lldb::TypeSP();
+ }
+
+ ClangASTType
+ GetClangASTType ()
+ {
+ if (m_type.m_typeimpl_sp && m_type.m_typeimpl_sp->IsValid())
+ return m_type.m_typeimpl_sp->GetClangASTType();
+ return ClangASTType();
+ }
+
+ bool
+ IsRegex()
+ {
+ return m_is_regex;
+ }
+
+private:
+ bool m_is_regex;
+ // this works better than TypeAndOrName because the latter only wraps a TypeSP
+ // whereas TypeImplSP can also be backed by a ClangASTType which is more commonly
+ // used in LLDB. moreover, TypeImplSP is also what is currently backing SBType
+ struct TypeOrName
+ {
+ std::string m_type_name;
+ lldb::TypeImplSP m_typeimpl_sp;
+ };
+ TypeOrName m_type;
+
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormatClasses_h_
diff --git a/lldb/include/lldb/DataFormatters/FormatManager.h b/lldb/include/lldb/DataFormatters/FormatManager.h
new file mode 100644
index 00000000000..162e25143f2
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/FormatManager.h
@@ -0,0 +1,251 @@
+//===-- FormatManager.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatManager_h_
+#define lldb_FormatManager_h_
+
+// C Includes
+// C++ Includes
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatNavigator.h"
+#include "lldb/DataFormatters/TypeCategory.h"
+#include "lldb/DataFormatters/TypeCategoryMap.h"
+
+namespace lldb_private {
+
+// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
+// class DataVisualization is the high-level front-end of this feature
+// clients should refer to that class as the entry-point into the data formatters
+// unless they have a good reason to bypass it and prefer to use this file's objects directly
+
+class FormatManager : public IFormatChangeListener
+{
+ typedef FormatNavigator<ConstString, TypeFormatImpl> ValueNavigator;
+ typedef ValueNavigator::MapType ValueMap;
+ typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
+ typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
+public:
+
+ typedef TypeCategoryMap::CallbackType CategoryCallback;
+
+ FormatManager ();
+
+ ValueNavigator&
+ GetValueNavigator ()
+ {
+ return m_value_nav;
+ }
+
+ NamedSummariesMap&
+ GetNamedSummaryNavigator ()
+ {
+ return m_named_summaries_map;
+ }
+
+ void
+ EnableCategory (const ConstString& category_name,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default)
+ {
+ m_categories_map.Enable(category_name,
+ pos);
+ }
+
+ void
+ DisableCategory (const ConstString& category_name)
+ {
+ m_categories_map.Disable(category_name);
+ }
+
+ void
+ EnableCategory (const lldb::TypeCategoryImplSP& category,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default)
+ {
+ m_categories_map.Enable(category,
+ pos);
+ }
+
+ void
+ DisableCategory (const lldb::TypeCategoryImplSP& category)
+ {
+ m_categories_map.Disable(category);
+ }
+
+ bool
+ DeleteCategory (const ConstString& category_name)
+ {
+ return m_categories_map.Delete(category_name);
+ }
+
+ void
+ ClearCategories ()
+ {
+ return m_categories_map.Clear();
+ }
+
+ uint32_t
+ GetCategoriesCount ()
+ {
+ return m_categories_map.GetCount();
+ }
+
+ lldb::TypeCategoryImplSP
+ GetCategoryAtIndex (size_t index)
+ {
+ return m_categories_map.GetAtIndex(index);
+ }
+
+ void
+ LoopThroughCategories (CategoryCallback callback, void* param)
+ {
+ m_categories_map.LoopThrough(callback, param);
+ }
+
+ lldb::TypeCategoryImplSP
+ GetCategory (const char* category_name = NULL,
+ bool can_create = true)
+ {
+ if (!category_name)
+ return GetCategory(m_default_category_name);
+ return GetCategory(ConstString(category_name));
+ }
+
+ lldb::TypeCategoryImplSP
+ GetCategory (const ConstString& category_name,
+ bool can_create = true);
+
+ lldb::TypeSummaryImplSP
+ GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeFilterImplSP
+ GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+#ifndef LLDB_DISABLE_PYTHON
+ lldb::ScriptedSyntheticChildrenSP
+ GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
+#endif
+
+#ifndef LLDB_DISABLE_PYTHON
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp);
+#endif
+
+ lldb::TypeSummaryImplSP
+ GetSummaryFormat (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic);
+
+#ifndef LLDB_DISABLE_PYTHON
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildren (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic);
+#endif
+
+ bool
+ AnyMatches (ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = NULL,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = NULL)
+ {
+ return m_categories_map.AnyMatches(type_name,
+ items,
+ only_enabled,
+ matching_category,
+ matching_type);
+ }
+
+ static bool
+ GetFormatFromCString (const char *format_cstr,
+ bool partial_match_ok,
+ lldb::Format &format);
+
+ static char
+ GetFormatAsFormatChar (lldb::Format format);
+
+ static const char *
+ GetFormatAsCString (lldb::Format format);
+
+ // if the user tries to add formatters for, say, "struct Foo"
+ // those will not match any type because of the way we strip qualifiers from typenames
+ // this method looks for the case where the user is adding a "class","struct","enum" or "union" Foo
+ // and strips the unnecessary qualifier
+ static ConstString
+ GetValidTypeName (const ConstString& type);
+
+ // when DataExtractor dumps a vectorOfT, it uses a predefined format for each item
+ // this method returns it, or eFormatInvalid if vector_format is not a vectorOf
+ static lldb::Format
+ GetSingleItemFormat (lldb::Format vector_format);
+
+ void
+ Changed ()
+ {
+ __sync_add_and_fetch(&m_last_revision, +1);
+ m_format_cache.Clear ();
+ }
+
+ uint32_t
+ GetCurrentRevision ()
+ {
+ return m_last_revision;
+ }
+
+ ~FormatManager ()
+ {
+ }
+
+private:
+ FormatCache m_format_cache;
+ ValueNavigator m_value_nav;
+ NamedSummariesMap m_named_summaries_map;
+ uint32_t m_last_revision;
+ TypeCategoryMap m_categories_map;
+
+ ConstString m_default_category_name;
+ ConstString m_system_category_name;
+ ConstString m_gnu_cpp_category_name;
+ ConstString m_libcxx_category_name;
+ ConstString m_objc_category_name;
+ ConstString m_corefoundation_category_name;
+ ConstString m_coregraphics_category_name;
+ ConstString m_coreservices_category_name;
+ ConstString m_vectortypes_category_name;
+ ConstString m_appkit_category_name;
+
+ TypeCategoryMap&
+ GetCategories ()
+ {
+ return m_categories_map;
+ }
+
+ // WARNING: these are temporary functions that setup formatters
+ // while a few of these actually should be globally available and setup by LLDB itself
+ // most would actually belong to the users' lldbinit file or to some other form of configurable
+ // storage
+ void
+ LoadLibStdcppFormatters ();
+
+ void
+ LoadLibcxxFormatters ();
+
+ void
+ LoadSystemFormatters ();
+
+ void
+ LoadObjCFormatters ();
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormatManager_h_
diff --git a/lldb/include/lldb/Core/FormatNavigator.h b/lldb/include/lldb/DataFormatters/FormatNavigator.h
index 38cfa1f6c4e..7f56417aedf 100644
--- a/lldb/include/lldb/Core/FormatNavigator.h
+++ b/lldb/include/lldb/DataFormatters/FormatNavigator.h
@@ -21,11 +21,12 @@
// Project includes
#include "lldb/lldb-public.h"
-#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
@@ -185,7 +186,7 @@ public:
}
}
- size_t
+ uint32_t
GetCount ()
{
return m_map.size();
@@ -339,7 +340,7 @@ public:
m_format_map.LoopThrough(callback,param);
}
- size_t
+ uint32_t
GetCount ()
{
return m_format_map.GetCount();
@@ -525,28 +526,28 @@ protected:
return false;
}
- // we are separately passing in valobj and type because the valobj is fixed (and is used for ObjC discovery and bitfield size)
- // but the type can change (e.g. stripping pointers, ...)
- bool Get (ValueObject& valobj,
+ bool
+ Get_Impl (ValueObject& valobj,
clang::QualType type,
MapValueType& entry,
lldb::DynamicValueType use_dynamic,
uint32_t& reason)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+
if (type.isNull())
{
if (log)
- log->Printf("[Get] type is NULL, returning");
+ log->Printf("[Get_Impl] type is NULL, returning");
return false;
}
-
+
type.removeLocalConst(); type.removeLocalVolatile(); type.removeLocalRestrict();
const clang::Type* typePtr = type.getTypePtrOrNull();
if (!typePtr)
{
if (log)
- log->Printf("[Get] type is NULL, returning");
+ log->Printf("[Get_Impl] type is NULL, returning");
return false;
}
ConstString typeName(ClangASTType::GetTypeNameForQualType(valobj.GetClangAST(), type).c_str());
@@ -558,7 +559,7 @@ protected:
}
if (log)
- log->Printf("[Get] trying to get %s for VO name %s of type %s",
+ log->Printf("[Get_Impl] trying to get %s for VO name %s of type %s",
m_name.c_str(),
valobj.GetName().AsCString(),
typeName.AsCString());
@@ -570,14 +571,14 @@ protected:
return true;
}
if (log)
- log->Printf("[Get] no direct match");
-
+ log->Printf("[Get_Impl] no direct match");
+
// strip pointers and references and see if that helps
if (typePtr->isReferenceType())
{
if (log)
- log->Printf("[Get] stripping reference");
- if (Get(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->SkipsReferences())
+ log->Printf("[Get_Impl] stripping reference");
+ if (Get_Impl(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->SkipsReferences())
{
reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
return true;
@@ -586,15 +587,15 @@ protected:
else if (typePtr->isPointerType())
{
if (log)
- log->Printf("[Get] stripping pointer");
+ log->Printf("[Get_Impl] stripping pointer");
clang::QualType pointee = typePtr->getPointeeType();
- if (Get(valobj, pointee, entry, use_dynamic, reason) && !entry->SkipsPointers())
+ if (Get_Impl(valobj, pointee, entry, use_dynamic, reason) && !entry->SkipsPointers())
{
reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
return true;
}
}
-
+
bool canBeObjCDynamic = ClangASTContext::IsPossibleDynamicType (valobj.GetClangAST(),
type.getAsOpaquePtr(),
NULL,
@@ -606,7 +607,7 @@ protected:
if (use_dynamic != lldb::eNoDynamicValues)
{
if (log)
- log->Printf("[Get] allowed to figure out dynamic ObjC type");
+ log->Printf("[Get_Impl] allowed to figure out dynamic ObjC type");
if (Get_ObjC(valobj,entry))
{
reason |= lldb_private::eFormatterChoiceCriterionDynamicObjCDiscovery;
@@ -614,28 +615,45 @@ protected:
}
}
if (log)
- log->Printf("[Get] dynamic disabled or failed - stripping ObjC pointer");
+ log->Printf("[Get_Impl] dynamic disabled or failed - stripping ObjC pointer");
clang::QualType pointee = typePtr->getPointeeType();
- if (Get(valobj, pointee, entry, use_dynamic, reason) && !entry->SkipsPointers())
+ if (Get_Impl(valobj, pointee, entry, use_dynamic, reason) && !entry->SkipsPointers())
{
reason |= lldb_private::eFormatterChoiceCriterionStrippedPointerReference;
return true;
}
}
-
+
// try to strip typedef chains
const clang::TypedefType* type_tdef = type->getAs<clang::TypedefType>();
if (type_tdef)
{
if (log)
- log->Printf("[Get] stripping typedef");
- if ((Get(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->Cascades())
+ log->Printf("[Get_Impl] stripping typedef");
+ if ((Get_Impl(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->Cascades())
{
reason |= lldb_private::eFormatterChoiceCriterionNavigatedTypedefs;
return true;
}
}
+ // out of luck here
+ return false;
+ }
+
+ // we are separately passing in valobj and type because the valobj is fixed (and is used for ObjC discovery and bitfield size)
+ // but the type can change (e.g. stripping pointers, ...)
+ bool Get (ValueObject& valobj,
+ clang::QualType type,
+ MapValueType& entry,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t& reason)
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+
+ if (Get_Impl (valobj,type,entry,use_dynamic,reason))
+ return true;
+
// if all else fails, go to static type
if (valobj.IsDynamic())
{
diff --git a/lldb/include/lldb/DataFormatters/TypeCategory.h b/lldb/include/lldb/DataFormatters/TypeCategory.h
new file mode 100644
index 00000000000..0ffd171cfa7
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/TypeCategory.h
@@ -0,0 +1,230 @@
+//===-- TypeCategory.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeCategory_h_
+#define lldb_TypeCategory_h_
+
+// C Includes
+// C++ Includes
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/DataFormatters/FormatNavigator.h"
+
+namespace lldb_private {
+ class TypeCategoryImpl
+ {
+ private:
+
+ typedef FormatNavigator<ConstString, TypeSummaryImpl> SummaryNavigator;
+ typedef FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl> RegexSummaryNavigator;
+
+ typedef FormatNavigator<ConstString, TypeFilterImpl> FilterNavigator;
+ typedef FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl> RegexFilterNavigator;
+
+#ifndef LLDB_DISABLE_PYTHON
+ typedef FormatNavigator<ConstString, ScriptedSyntheticChildren> SynthNavigator;
+ typedef FormatNavigator<lldb::RegularExpressionSP, ScriptedSyntheticChildren> RegexSynthNavigator;
+#endif // #ifndef LLDB_DISABLE_PYTHON
+
+ typedef SummaryNavigator::MapType SummaryMap;
+ typedef RegexSummaryNavigator::MapType RegexSummaryMap;
+ typedef FilterNavigator::MapType FilterMap;
+ typedef RegexFilterNavigator::MapType RegexFilterMap;
+#ifndef LLDB_DISABLE_PYTHON
+ typedef SynthNavigator::MapType SynthMap;
+ typedef RegexSynthNavigator::MapType RegexSynthMap;
+#endif // #ifndef LLDB_DISABLE_PYTHON
+
+ public:
+
+ typedef uint16_t FormatCategoryItems;
+ static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
+
+ typedef SummaryNavigator::SharedPointer SummaryNavigatorSP;
+ typedef RegexSummaryNavigator::SharedPointer RegexSummaryNavigatorSP;
+ typedef FilterNavigator::SharedPointer FilterNavigatorSP;
+ typedef RegexFilterNavigator::SharedPointer RegexFilterNavigatorSP;
+#ifndef LLDB_DISABLE_PYTHON
+ typedef SynthNavigator::SharedPointer SynthNavigatorSP;
+ typedef RegexSynthNavigator::SharedPointer RegexSynthNavigatorSP;
+#endif // #ifndef LLDB_DISABLE_PYTHON
+
+ TypeCategoryImpl (IFormatChangeListener* clist,
+ ConstString name);
+
+ SummaryNavigatorSP
+ GetSummaryNavigator ()
+ {
+ return SummaryNavigatorSP(m_summary_nav);
+ }
+
+ RegexSummaryNavigatorSP
+ GetRegexSummaryNavigator ()
+ {
+ return RegexSummaryNavigatorSP(m_regex_summary_nav);
+ }
+
+ FilterNavigatorSP
+ GetFilterNavigator ()
+ {
+ return FilterNavigatorSP(m_filter_nav);
+ }
+
+ RegexFilterNavigatorSP
+ GetRegexFilterNavigator ()
+ {
+ return RegexFilterNavigatorSP(m_regex_filter_nav);
+ }
+
+ SummaryNavigator::MapValueType
+ GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+ FilterNavigator::MapValueType
+ GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
+
+#ifndef LLDB_DISABLE_PYTHON
+ SynthNavigator::MapValueType
+ GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
+#endif
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForSummaryAtIndex (size_t index);
+
+ SummaryNavigator::MapValueType
+ GetSummaryAtIndex (size_t index);
+
+ FilterNavigator::MapValueType
+ GetFilterAtIndex (size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForFilterAtIndex (size_t index);
+
+#ifndef LLDB_DISABLE_PYTHON
+ SynthNavigatorSP
+ GetSyntheticNavigator ()
+ {
+ return SynthNavigatorSP(m_synth_nav);
+ }
+
+ RegexSynthNavigatorSP
+ GetRegexSyntheticNavigator ()
+ {
+ return RegexSynthNavigatorSP(m_regex_synth_nav);
+ }
+
+ SynthNavigator::MapValueType
+ GetSyntheticAtIndex (size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForSyntheticAtIndex (size_t index);
+
+#endif // #ifndef LLDB_DISABLE_PYTHON
+
+ bool
+ IsEnabled () const
+ {
+ return m_enabled;
+ }
+
+ uint32_t
+ GetEnabledPosition()
+ {
+ if (m_enabled == false)
+ return UINT32_MAX;
+ else
+ return m_enabled_position;
+ }
+
+ bool
+ Get (ValueObject& valobj,
+ lldb::TypeSummaryImplSP& entry,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t* reason = NULL);
+
+ bool
+ Get (ValueObject& valobj,
+ lldb::SyntheticChildrenSP& entry,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t* reason = NULL);
+
+ void
+ Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ bool
+ Delete (ConstString name,
+ FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ uint32_t
+ GetCount (FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ const char*
+ GetName ()
+ {
+ return m_name.GetCString();
+ }
+
+ bool
+ AnyMatches (ConstString type_name,
+ FormatCategoryItems items = ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = NULL,
+ FormatCategoryItems* matching_type = NULL);
+
+ typedef STD_SHARED_PTR(TypeCategoryImpl) SharedPointer;
+
+ private:
+ SummaryNavigator::SharedPointer m_summary_nav;
+ RegexSummaryNavigator::SharedPointer m_regex_summary_nav;
+ FilterNavigator::SharedPointer m_filter_nav;
+ RegexFilterNavigator::SharedPointer m_regex_filter_nav;
+#ifndef LLDB_DISABLE_PYTHON
+ SynthNavigator::SharedPointer m_synth_nav;
+ RegexSynthNavigator::SharedPointer m_regex_synth_nav;
+#endif // #ifndef LLDB_DISABLE_PYTHON
+
+ bool m_enabled;
+
+ IFormatChangeListener* m_change_listener;
+
+ Mutex m_mutex;
+
+ ConstString m_name;
+
+ uint32_t m_enabled_position;
+
+ void
+ Enable (bool value, uint32_t position);
+
+ void
+ Disable ()
+ {
+ Enable(false, UINT32_MAX);
+ }
+
+ friend class TypeCategoryMap;
+
+ friend class FormatNavigator<ConstString, TypeSummaryImpl>;
+ friend class FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl>;
+
+ friend class FormatNavigator<ConstString, TypeFilterImpl>;
+ friend class FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl>;
+
+#ifndef LLDB_DISABLE_PYTHON
+ friend class FormatNavigator<ConstString, ScriptedSyntheticChildren>;
+ friend class FormatNavigator<lldb::RegularExpressionSP, ScriptedSyntheticChildren>;
+#endif // #ifndef LLDB_DISABLE_PYTHON
+ };
+
+} // namespace lldb_private
+
+#endif // lldb_TypeCategory_h_
diff --git a/lldb/include/lldb/DataFormatters/TypeCategoryMap.h b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
new file mode 100644
index 00000000000..c2465ad13aa
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -0,0 +1,148 @@
+//===-- TypeCategoryMap.h ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeCategoryMap_h_
+#define lldb_TypeCategoryMap_h_
+
+// C Includes
+// C++ Includes
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/DataFormatters/FormatNavigator.h"
+#include "lldb/DataFormatters/TypeCategory.h"
+
+namespace lldb_private {
+ class TypeCategoryMap
+ {
+ private:
+ typedef ConstString KeyType;
+ typedef TypeCategoryImpl ValueType;
+ typedef ValueType::SharedPointer ValueSP;
+ typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
+ typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
+
+ public:
+ typedef std::map<KeyType, ValueSP> MapType;
+ typedef MapType::iterator MapIterator;
+ typedef bool(*CallbackType)(void*, const ValueSP&);
+ typedef uint32_t Position;
+
+ static const Position First = 0;
+ static const Position Default = 1;
+ static const Position Last = UINT32_MAX;
+
+ TypeCategoryMap (IFormatChangeListener* lst);
+
+ void
+ Add (KeyType name,
+ const ValueSP& entry);
+
+ bool
+ Delete (KeyType name);
+
+ bool
+ Enable (KeyType category_name,
+ Position pos = Default);
+
+ bool
+ Disable (KeyType category_name);
+
+ bool
+ Enable (ValueSP category,
+ Position pos = Default);
+
+ bool
+ Disable (ValueSP category);
+
+ void
+ Clear ();
+
+ bool
+ Get (KeyType name,
+ ValueSP& entry);
+
+ bool
+ Get (uint32_t pos,
+ ValueSP& entry);
+
+ void
+ LoopThrough (CallbackType callback, void* param);
+
+ lldb::TypeCategoryImplSP
+ GetAtIndex (uint32_t);
+
+ bool
+ AnyMatches (ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char** matching_category = NULL,
+ TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
+
+ uint32_t
+ GetCount ()
+ {
+ return m_map.size();
+ }
+
+ lldb::TypeSummaryImplSP
+ GetSummaryFormat (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic);
+
+#ifndef LLDB_DISABLE_PYTHON
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildren (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic);
+#endif
+
+ private:
+
+ class delete_matching_categories
+ {
+ lldb::TypeCategoryImplSP ptr;
+ public:
+ delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
+ {}
+
+ bool operator()(const lldb::TypeCategoryImplSP& other)
+ {
+ return ptr.get() == other.get();
+ }
+ };
+
+ Mutex m_map_mutex;
+ IFormatChangeListener* listener;
+
+ MapType m_map;
+ ActiveCategoriesList m_active_categories;
+
+ MapType& map ()
+ {
+ return m_map;
+ }
+
+ ActiveCategoriesList& active_list ()
+ {
+ return m_active_categories;
+ }
+
+ Mutex& mutex ()
+ {
+ return m_map_mutex;
+ }
+
+ friend class FormatNavigator<KeyType, ValueType>;
+ friend class FormatManager;
+ };
+} // namespace lldb_private
+
+#endif // lldb_TypeCategoryMap_h_
diff --git a/lldb/include/lldb/DataFormatters/TypeFormat.h b/lldb/include/lldb/DataFormatters/TypeFormat.h
new file mode 100644
index 00000000000..041d4abf1f7
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/TypeFormat.h
@@ -0,0 +1,220 @@
+//===-- TypeFormat.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeFormat_h_
+#define lldb_TypeFormat_h_
+
+// C Includes
+
+// C++ Includes
+#include <string>
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/ValueObject.h"
+
+namespace lldb_private {
+ class TypeFormatImpl
+ {
+ public:
+ class Flags
+ {
+ public:
+
+ Flags () :
+ m_flags (lldb::eTypeOptionCascade)
+ {}
+
+ Flags (const Flags& other) :
+ m_flags (other.m_flags)
+ {}
+
+ Flags (uint32_t value) :
+ m_flags (value)
+ {}
+
+ Flags&
+ operator = (const Flags& rhs)
+ {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags&
+ operator = (const uint32_t& rhs)
+ {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags&
+ Clear()
+ {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool
+ GetCascades () const
+ {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags&
+ SetCascades (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool
+ GetSkipPointers () const
+ {
+ return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags&
+ SetSkipPointers (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool
+ GetSkipReferences () const
+ {
+ return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags&
+ SetSkipReferences (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ uint32_t
+ GetValue ()
+ {
+ return m_flags;
+ }
+
+ void
+ SetValue (uint32_t value)
+ {
+ m_flags = value;
+ }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ TypeFormatImpl (lldb::Format f = lldb::eFormatInvalid,
+ const Flags& flags = Flags());
+
+ typedef STD_SHARED_PTR(TypeFormatImpl) SharedPointer;
+ typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
+
+ ~TypeFormatImpl ()
+ {
+ }
+
+ bool
+ Cascades () const
+ {
+ return m_flags.GetCascades();
+ }
+ bool
+ SkipsPointers () const
+ {
+ return m_flags.GetSkipPointers();
+ }
+ bool
+ SkipsReferences () const
+ {
+ return m_flags.GetSkipReferences();
+ }
+
+ void
+ SetCascades (bool value)
+ {
+ m_flags.SetCascades(value);
+ }
+
+ void
+ SetSkipsPointers (bool value)
+ {
+ m_flags.SetSkipPointers(value);
+ }
+
+ void
+ SetSkipsReferences (bool value)
+ {
+ m_flags.SetSkipReferences(value);
+ }
+
+ lldb::Format
+ GetFormat () const
+ {
+ return m_format;
+ }
+
+ void
+ SetFormat (lldb::Format fmt)
+ {
+ m_format = fmt;
+ }
+
+ uint32_t
+ GetOptions ()
+ {
+ return m_flags.GetValue();
+ }
+
+ void
+ SetOptions (uint32_t value)
+ {
+ m_flags.SetValue(value);
+ }
+
+ uint32_t&
+ GetRevision ()
+ {
+ return m_my_revision;
+ }
+
+ std::string
+ GetDescription();
+
+ protected:
+ Flags m_flags;
+ lldb::Format m_format;
+ uint32_t m_my_revision;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
+ };
+} // namespace lldb_private
+
+#endif // lldb_TypeFormat_h_
diff --git a/lldb/include/lldb/DataFormatters/TypeSummary.h b/lldb/include/lldb/DataFormatters/TypeSummary.h
new file mode 100644
index 00000000000..4779bec5edb
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/TypeSummary.h
@@ -0,0 +1,547 @@
+//===-- TypeSummary.h --------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeSummary_h_
+#define lldb_TypeSummary_h_
+
+// C Includes
+#include <stdint.h>
+#include <unistd.h>
+
+// C++ Includes
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/Symbol/Type.h"
+
+namespace lldb_private {
+
+ class TypeSummaryImpl
+ {
+ public:
+ class Flags
+ {
+ public:
+
+ Flags () :
+ m_flags (lldb::eTypeOptionCascade)
+ {}
+
+ Flags (const Flags& other) :
+ m_flags (other.m_flags)
+ {}
+
+ Flags (uint32_t value) :
+ m_flags (value)
+ {}
+
+ Flags&
+ operator = (const Flags& rhs)
+ {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags&
+ operator = (const uint32_t& rhs)
+ {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags&
+ Clear()
+ {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool
+ GetCascades () const
+ {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags&
+ SetCascades (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool
+ GetSkipPointers () const
+ {
+ return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags&
+ SetSkipPointers (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool
+ GetSkipReferences () const
+ {
+ return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags&
+ SetSkipReferences (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool
+ GetDontShowChildren () const
+ {
+ return (m_flags & lldb::eTypeOptionHideChildren) == lldb::eTypeOptionHideChildren;
+ }
+
+ Flags&
+ SetDontShowChildren (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideChildren;
+ else
+ m_flags &= ~lldb::eTypeOptionHideChildren;
+ return *this;
+ }
+
+ bool
+ GetDontShowValue () const
+ {
+ return (m_flags & lldb::eTypeOptionHideValue) == lldb::eTypeOptionHideValue;
+ }
+
+ Flags&
+ SetDontShowValue (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideValue;
+ else
+ m_flags &= ~lldb::eTypeOptionHideValue;
+ return *this;
+ }
+
+ bool
+ GetShowMembersOneLiner () const
+ {
+ return (m_flags & lldb::eTypeOptionShowOneLiner) == lldb::eTypeOptionShowOneLiner;
+ }
+
+ Flags&
+ SetShowMembersOneLiner (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionShowOneLiner;
+ else
+ m_flags &= ~lldb::eTypeOptionShowOneLiner;
+ return *this;
+ }
+
+ bool
+ GetHideItemNames () const
+ {
+ return (m_flags & lldb::eTypeOptionHideNames) == lldb::eTypeOptionHideNames;
+ }
+
+ Flags&
+ SetHideItemNames (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideNames;
+ else
+ m_flags &= ~lldb::eTypeOptionHideNames;
+ return *this;
+ }
+
+ uint32_t
+ GetValue ()
+ {
+ return m_flags;
+ }
+
+ void
+ SetValue (uint32_t value)
+ {
+ m_flags = value;
+ }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ typedef enum Type
+ {
+ eTypeUnknown,
+ eTypeString,
+ eTypeScript,
+ eTypeCallback
+ } Type;
+
+ TypeSummaryImpl (const TypeSummaryImpl::Flags& flags);
+
+ bool
+ Cascades () const
+ {
+ return m_flags.GetCascades();
+ }
+ bool
+ SkipsPointers () const
+ {
+ return m_flags.GetSkipPointers();
+ }
+ bool
+ SkipsReferences () const
+ {
+ return m_flags.GetSkipReferences();
+ }
+
+ bool
+ DoesPrintChildren () const
+ {
+ return !m_flags.GetDontShowChildren();
+ }
+
+ bool
+ DoesPrintValue () const
+ {
+ return !m_flags.GetDontShowValue();
+ }
+
+ bool
+ IsOneliner () const
+ {
+ return m_flags.GetShowMembersOneLiner();
+ }
+
+ bool
+ HideNames () const
+ {
+ return m_flags.GetHideItemNames();
+ }
+
+ void
+ SetCascades (bool value)
+ {
+ m_flags.SetCascades(value);
+ }
+
+ void
+ SetSkipsPointers (bool value)
+ {
+ m_flags.SetSkipPointers(value);
+ }
+
+ void
+ SetSkipsReferences (bool value)
+ {
+ m_flags.SetSkipReferences(value);
+ }
+
+ void
+ SetDoesPrintChildren (bool value)
+ {
+ m_flags.SetDontShowChildren(!value);
+ }
+
+ void
+ SetDoesPrintValue (bool value)
+ {
+ m_flags.SetDontShowValue(!value);
+ }
+
+ void
+ SetIsOneliner (bool value)
+ {
+ m_flags.SetShowMembersOneLiner(value);
+ }
+
+ void
+ SetHideNames (bool value)
+ {
+ m_flags.SetHideItemNames(value);
+ }
+
+ uint32_t
+ GetOptions ()
+ {
+ return m_flags.GetValue();
+ }
+
+ void
+ SetOptions (uint32_t value)
+ {
+ m_flags.SetValue(value);
+ }
+
+ virtual
+ ~TypeSummaryImpl ()
+ {
+ }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
+ // extended periods of time and we trust the ValueObject to stay around for as long as it is required
+ // for us to generate its summary
+ virtual bool
+ FormatObject (ValueObject *valobj,
+ std::string& dest) = 0;
+
+ virtual std::string
+ GetDescription () = 0;
+
+ virtual bool
+ IsScripted () = 0;
+
+ virtual Type
+ GetType () = 0;
+
+ uint32_t&
+ GetRevision ()
+ {
+ return m_my_revision;
+ }
+
+ typedef STD_SHARED_PTR(TypeSummaryImpl) SharedPointer;
+ typedef bool(*SummaryCallback)(void*, ConstString, const lldb::TypeSummaryImplSP&);
+ typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::TypeSummaryImplSP&);
+
+ protected:
+ uint32_t m_my_revision;
+ Flags m_flags;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
+ };
+
+ // simple string-based summaries, using ${var to show data
+ struct StringSummaryFormat : public TypeSummaryImpl
+ {
+ std::string m_format;
+
+ StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
+ const char* f);
+
+ const char*
+ GetSummaryString () const
+ {
+ return m_format.c_str();
+ }
+
+ void
+ SetSummaryString (const char* data)
+ {
+ if (data)
+ m_format.assign(data);
+ else
+ m_format.clear();
+ }
+
+ virtual
+ ~StringSummaryFormat()
+ {
+ }
+
+ virtual bool
+ FormatObject(ValueObject *valobj,
+ std::string& dest);
+
+ virtual std::string
+ GetDescription();
+
+ virtual bool
+ IsScripted ()
+ {
+ return false;
+ }
+
+
+ virtual Type
+ GetType ()
+ {
+ return TypeSummaryImpl::eTypeString;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
+ };
+
+ // summaries implemented via a C++ function
+ struct CXXFunctionSummaryFormat : public TypeSummaryImpl
+ {
+
+ // we should convert these to SBValue and SBStream if we ever cross
+ // the boundary towards the external world
+ typedef bool (*Callback)(ValueObject& valobj, Stream& dest);
+
+ Callback m_impl;
+ std::string m_description;
+
+ CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
+ Callback impl,
+ const char* description);
+
+ Callback
+ GetBackendFunction () const
+ {
+ return m_impl;
+ }
+
+ const char*
+ GetTextualInfo () const
+ {
+ return m_description.c_str();
+ }
+
+ void
+ SetBackendFunction (Callback cb_func)
+ {
+ m_impl = cb_func;
+ }
+
+ void
+ SetTextualInfo (const char* descr)
+ {
+ if (descr)
+ m_description.assign(descr);
+ else
+ m_description.clear();
+ }
+
+ virtual
+ ~CXXFunctionSummaryFormat ()
+ {
+ }
+
+ virtual bool
+ FormatObject (ValueObject *valobj,
+ std::string& dest);
+
+ virtual std::string
+ GetDescription ();
+
+ virtual bool
+ IsScripted ()
+ {
+ return false;
+ }
+
+ virtual Type
+ GetType ()
+ {
+ return TypeSummaryImpl::eTypeCallback;
+ }
+
+ typedef STD_SHARED_PTR(CXXFunctionSummaryFormat) SharedPointer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
+ };
+
+#ifndef LLDB_DISABLE_PYTHON
+
+ // Python-based summaries, running script code to show data
+ struct ScriptSummaryFormat : public TypeSummaryImpl
+ {
+ std::string m_function_name;
+ std::string m_python_script;
+ lldb::ScriptInterpreterObjectSP m_script_function_sp;
+
+ ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
+ const char *function_name,
+ const char* python_script = NULL);
+
+ const char*
+ GetFunctionName () const
+ {
+ return m_function_name.c_str();
+ }
+
+ const char*
+ GetPythonScript () const
+ {
+ return m_python_script.c_str();
+ }
+
+ void
+ SetFunctionName (const char* function_name)
+ {
+ if (function_name)
+ m_function_name.assign(function_name);
+ else
+ m_function_name.clear();
+ m_python_script.clear();
+ }
+
+ void
+ SetPythonScript (const char* script)
+ {
+ if (script)
+ m_python_script.assign(script);
+ else
+ m_python_script.clear();
+ }
+
+ virtual
+ ~ScriptSummaryFormat ()
+ {
+ }
+
+ virtual bool
+ FormatObject (ValueObject *valobj,
+ std::string& dest);
+
+ virtual std::string
+ GetDescription ();
+
+ virtual bool
+ IsScripted ()
+ {
+ return true;
+ }
+
+ virtual Type
+ GetType ()
+ {
+ return TypeSummaryImpl::eTypeScript;
+ }
+
+ typedef STD_SHARED_PTR(ScriptSummaryFormat) SharedPointer;
+
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
+ };
+#endif
+} // namespace lldb_private
+
+#endif // lldb_TypeSummary_h_
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
new file mode 100644
index 00000000000..43adf42e316
--- /dev/null
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -0,0 +1,585 @@
+//===-- TypeSynthetic.h -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeSynthetic_h_
+#define lldb_TypeSynthetic_h_
+
+// C Includes
+#include <stdint.h>
+#include <unistd.h>
+
+// C++ Includes
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/Symbol/Type.h"
+
+namespace lldb_private {
+ class SyntheticChildrenFrontEnd
+ {
+ protected:
+ ValueObject &m_backend;
+ public:
+
+ SyntheticChildrenFrontEnd (ValueObject &backend) :
+ m_backend(backend)
+ {}
+
+ virtual
+ ~SyntheticChildrenFrontEnd ()
+ {
+ }
+
+ virtual size_t
+ CalculateNumChildren () = 0;
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (size_t idx) = 0;
+
+ virtual size_t
+ GetIndexOfChildWithName (const ConstString &name) = 0;
+
+ // this function is assumed to always succeed and it if fails, the front-end should know to deal
+ // with it in the correct way (most probably, by refusing to return any children)
+ // the return value of Update() should actually be interpreted as "ValueObjectSyntheticFilter cache is good/bad"
+ // if =true, ValueObjectSyntheticFilter is allowed to use the children it fetched previously and cached
+ // if =false, ValueObjectSyntheticFilter must throw away its cache, and query again for children
+ virtual bool
+ Update () = 0;
+
+ // if this function returns false, then CalculateNumChildren() MUST return 0 since UI frontends
+ // might validly decide not to inquire for children given a false return value from this call
+ // if it returns true, then CalculateNumChildren() can return any number >= 0 (0 being valid)
+ // it should if at all possible be more efficient than CalculateNumChildren()
+ virtual bool
+ MightHaveChildren () = 0;
+
+ typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
+ typedef std::auto_ptr<SyntheticChildrenFrontEnd> AutoPointer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
+ };
+
+ class SyntheticChildren
+ {
+ public:
+
+ class Flags
+ {
+ public:
+
+ Flags () :
+ m_flags (lldb::eTypeOptionCascade)
+ {}
+
+ Flags (const Flags& other) :
+ m_flags (other.m_flags)
+ {}
+
+ Flags (uint32_t value) :
+ m_flags (value)
+ {}
+
+ Flags&
+ operator = (const Flags& rhs)
+ {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags&
+ operator = (const uint32_t& rhs)
+ {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags&
+ Clear()
+ {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool
+ GetCascades () const
+ {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags&
+ SetCascades (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool
+ GetSkipPointers () const
+ {
+ return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags&
+ SetSkipPointers (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool
+ GetSkipReferences () const
+ {
+ return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags&
+ SetSkipReferences (bool value = true)
+ {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ uint32_t
+ GetValue ()
+ {
+ return m_flags;
+ }
+
+ void
+ SetValue (uint32_t value)
+ {
+ m_flags = value;
+ }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ SyntheticChildren (const Flags& flags) :
+ m_flags(flags)
+ {
+ }
+
+ virtual
+ ~SyntheticChildren ()
+ {
+ }
+
+ bool
+ Cascades () const
+ {
+ return m_flags.GetCascades();
+ }
+ bool
+ SkipsPointers () const
+ {
+ return m_flags.GetSkipPointers();
+ }
+ bool
+ SkipsReferences () const
+ {
+ return m_flags.GetSkipReferences();
+ }
+
+ void
+ SetCascades (bool value)
+ {
+ m_flags.SetCascades(value);
+ }
+
+ void
+ SetSkipsPointers (bool value)
+ {
+ m_flags.SetSkipPointers(value);
+ }
+
+ void
+ SetSkipsReferences (bool value)
+ {
+ m_flags.SetSkipReferences(value);
+ }
+
+ uint32_t
+ GetOptions ()
+ {
+ return m_flags.GetValue();
+ }
+
+ void
+ SetOptions (uint32_t value)
+ {
+ m_flags.SetValue(value);
+ }
+
+ virtual bool
+ IsScripted () = 0;
+
+ virtual std::string
+ GetDescription () = 0;
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd (ValueObject &backend) = 0;
+
+ typedef STD_SHARED_PTR(SyntheticChildren) SharedPointer;
+ typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
+
+ uint32_t&
+ GetRevision ()
+ {
+ return m_my_revision;
+ }
+
+ protected:
+ uint32_t m_my_revision;
+ Flags m_flags;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
+ };
+
+ class TypeFilterImpl : public SyntheticChildren
+ {
+ std::vector<std::string> m_expression_paths;
+ public:
+ TypeFilterImpl(const SyntheticChildren::Flags& flags) :
+ SyntheticChildren(flags),
+ m_expression_paths()
+ {
+ }
+
+ void
+ AddExpressionPath (const char* path)
+ {
+ AddExpressionPath(std::string(path));
+ }
+
+ void
+ Clear()
+ {
+ m_expression_paths.clear();
+ }
+
+ int
+ GetCount() const
+ {
+ return m_expression_paths.size();
+ }
+
+ const char*
+ GetExpressionPathAtIndex(int i) const
+ {
+ return m_expression_paths[i].c_str();
+ }
+
+ bool
+ SetExpressionPathAtIndex (int i, const char* path)
+ {
+ return SetExpressionPathAtIndex(i, std::string(path));
+ }
+
+ void
+ AddExpressionPath (std::string path)
+ {
+ bool need_add_dot = true;
+ if (path[0] == '.' ||
+ (path[0] == '-' && path[1] == '>') ||
+ path[0] == '[')
+ need_add_dot = false;
+ // add a '.' symbol to help forgetful users
+ if(!need_add_dot)
+ m_expression_paths.push_back(path);
+ else
+ m_expression_paths.push_back(std::string(".") + path);
+ }
+
+ bool
+ SetExpressionPathAtIndex (int i, std::string path)
+ {
+ if (i >= GetCount())
+ return false;
+ bool need_add_dot = true;
+ if (path[0] == '.' ||
+ (path[0] == '-' && path[1] == '>') ||
+ path[0] == '[')
+ need_add_dot = false;
+ // add a '.' symbol to help forgetful users
+ if(!need_add_dot)
+ m_expression_paths[i] = path;
+ else
+ m_expression_paths[i] = std::string(".") + path;
+ return true;
+ }
+
+ bool
+ IsScripted ()
+ {
+ return false;
+ }
+
+ std::string
+ GetDescription ();
+
+ class FrontEnd : public SyntheticChildrenFrontEnd
+ {
+ private:
+ TypeFilterImpl* filter;
+ public:
+
+ FrontEnd(TypeFilterImpl* flt,
+ ValueObject &backend) :
+ SyntheticChildrenFrontEnd(backend),
+ filter(flt)
+ {}
+
+ virtual
+ ~FrontEnd ()
+ {
+ }
+
+ virtual size_t
+ CalculateNumChildren ()
+ {
+ return filter->GetCount();
+ }
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (size_t idx)
+ {
+ if (idx >= filter->GetCount())
+ return lldb::ValueObjectSP();
+ return m_backend.GetSyntheticExpressionPathChild(filter->GetExpressionPathAtIndex(idx), true);
+ }
+
+ virtual bool
+ Update() { return false; }
+
+ virtual bool
+ MightHaveChildren ()
+ {
+ return filter->GetCount() > 0;
+ }
+
+ virtual size_t
+ GetIndexOfChildWithName (const ConstString &name)
+ {
+ const char* name_cstr = name.GetCString();
+ for (int i = 0; i < filter->GetCount(); i++)
+ {
+ const char* expr_cstr = filter->GetExpressionPathAtIndex(i);
+ if (expr_cstr)
+ {
+ if (*expr_cstr == '.')
+ expr_cstr++;
+ else if (*expr_cstr == '-' && *(expr_cstr+1) == '>')
+ expr_cstr += 2;
+ }
+ if (!::strcmp(name_cstr, expr_cstr))
+ return i;
+ }
+ return UINT32_MAX;
+ }
+
+ typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ };
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend)
+ {
+ return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
+ };
+
+ class CXXSyntheticChildren : public SyntheticChildren
+ {
+ public:
+ typedef SyntheticChildrenFrontEnd* (*CreateFrontEndCallback) (CXXSyntheticChildren*, lldb::ValueObjectSP);
+ protected:
+ CreateFrontEndCallback m_create_callback;
+ std::string m_description;
+ public:
+ CXXSyntheticChildren (const SyntheticChildren::Flags& flags,
+ const char* description,
+ CreateFrontEndCallback callback) :
+ SyntheticChildren(flags),
+ m_create_callback(callback),
+ m_description(description ? description : "")
+ {
+ }
+
+ bool
+ IsScripted ()
+ {
+ return false;
+ }
+
+ std::string
+ GetDescription ();
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd (ValueObject &backend)
+ {
+ return SyntheticChildrenFrontEnd::AutoPointer(m_create_callback(this, backend.GetSP()));
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
+ };
+
+#ifndef LLDB_DISABLE_PYTHON
+
+ class ScriptedSyntheticChildren : public SyntheticChildren
+ {
+ std::string m_python_class;
+ std::string m_python_code;
+ public:
+
+ ScriptedSyntheticChildren (const SyntheticChildren::Flags& flags,
+ const char* pclass,
+ const char* pcode = NULL) :
+ SyntheticChildren(flags),
+ m_python_class(),
+ m_python_code()
+ {
+ if (pclass)
+ m_python_class = pclass;
+ if (pcode)
+ m_python_code = pcode;
+ }
+
+ const char*
+ GetPythonClassName ()
+ {
+ return m_python_class.c_str();
+ }
+
+ const char*
+ GetPythonCode ()
+ {
+ return m_python_code.c_str();
+ }
+
+ void
+ SetPythonClassName (const char* fname)
+ {
+ m_python_class.assign(fname);
+ m_python_code.clear();
+ }
+
+ void
+ SetPythonCode (const char* script)
+ {
+ m_python_code.assign(script);
+ }
+
+ std::string
+ GetDescription ();
+
+ bool
+ IsScripted ()
+ {
+ return true;
+ }
+
+ class FrontEnd : public SyntheticChildrenFrontEnd
+ {
+ private:
+ std::string m_python_class;
+ lldb::ScriptInterpreterObjectSP m_wrapper_sp;
+ ScriptInterpreter *m_interpreter;
+ public:
+
+ FrontEnd (std::string pclass,
+ ValueObject &backend);
+
+ virtual
+ ~FrontEnd ();
+
+ virtual size_t
+ CalculateNumChildren ()
+ {
+ if (!m_wrapper_sp || m_interpreter == NULL)
+ return 0;
+ return m_interpreter->CalculateNumChildren(m_wrapper_sp);
+ }
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex (size_t idx);
+
+ virtual bool
+ Update ()
+ {
+ if (!m_wrapper_sp || m_interpreter == NULL)
+ return false;
+
+ return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp);
+ }
+
+ virtual bool
+ MightHaveChildren ()
+ {
+ if (!m_wrapper_sp || m_interpreter == NULL)
+ return false;
+
+ return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp);
+ }
+
+ virtual size_t
+ GetIndexOfChildWithName (const ConstString &name)
+ {
+ if (!m_wrapper_sp || m_interpreter == NULL)
+ return UINT32_MAX;
+ return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp, name.GetCString());
+ }
+
+ typedef STD_SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ };
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend)
+ {
+ return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(m_python_class, backend));
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptedSyntheticChildren);
+ };
+#endif
+} // namespace lldb_private
+
+#endif // lldb_TypeSynthetic_h_
diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index 8d08c523194..31148327cf6 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -218,7 +218,7 @@ class SyntheticChildren;
class SyntheticChildrenFrontEnd;
class TypeFilterImpl;
#ifndef LLDB_DISABLE_PYTHON
-class TypeSyntheticImpl;
+class ScriptedSyntheticChildren;
#endif
class Target;
class TargetList;
@@ -236,6 +236,7 @@ class ThreadPlanTracer;
class ThreadSpec;
class TimeValue;
class Type;
+class TypeCategoryMap;
class TypeImpl;
class TypeAndOrName;
class TypeList;
@@ -373,7 +374,7 @@ namespace lldb {
typedef STD_SHARED_PTR(lldb_private::TypeNameSpecifierImpl) TypeNameSpecifierImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeSummaryImpl) TypeSummaryImplSP;
#ifndef LLDB_DISABLE_PYTHON
- typedef STD_SHARED_PTR(lldb_private::TypeSyntheticImpl) TypeSyntheticImplSP;
+ typedef STD_SHARED_PTR(lldb_private::ScriptedSyntheticChildren) ScriptedSyntheticChildrenSP;
#endif
typedef STD_SHARED_PTR(lldb_private::UnwindPlan) UnwindPlanSP;
typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index 8cc213b1ee8..b4e4583fc05 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -514,7 +514,6 @@
4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; };
94031A9E13CF486700DCFF3C /* InputReaderEZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94031A9D13CF486600DCFF3C /* InputReaderEZ.cpp */; };
94094C6B163B6F840083A547 /* ValueObjectCast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94094C69163B6CD90083A547 /* ValueObjectCast.cpp */; };
- 9415F61813B2C0EF00A52B36 /* FormatManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9415F61713B2C0EF00A52B36 /* FormatManager.cpp */; };
941BCC7F14E48C4000BB969C /* SBTypeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568614E355F2003A195C /* SBTypeFilter.h */; settings = {ATTRIBUTES = (Public, ); }; };
941BCC8014E48C4000BB969C /* SBTypeFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568714E355F2003A195C /* SBTypeFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };
941BCC8114E48C4000BB969C /* SBTypeSummary.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568814E355F2003A195C /* SBTypeSummary.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -530,7 +529,6 @@
9461569D14E358A6003A195C /* SBTypeSynthetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568D14E35621003A195C /* SBTypeSynthetic.cpp */; };
9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9463D4CC13B1798800C230D4 /* CommandObjectType.cpp */; };
9467E65213C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */; };
- 9470A8F01402DFFB0056FF61 /* DataVisualization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */; };
9475C18814E5E9FA001BFC6D /* SBTypeCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9475C18714E5E9FA001BFC6D /* SBTypeCategory.cpp */; };
9475C18914E5EA08001BFC6D /* SBTypeCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */; settings = {ATTRIBUTES = (Public, ); }; };
9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */; };
@@ -539,7 +537,16 @@
947A1D651616476B0017C8D1 /* CommandObjectPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */; };
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */; };
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */; };
- 94CDEB9D15F0258500DD2A7A /* CXXFormatterFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CDEB9C15F0258400DD2A7A /* CXXFormatterFunctions.cpp */; };
+ 94CB255B16B069770059775D /* CXXFormatterFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255716B069770059775D /* CXXFormatterFunctions.cpp */; };
+ 94CB255C16B069770059775D /* DataVisualization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255816B069770059775D /* DataVisualization.cpp */; };
+ 94CB255D16B069770059775D /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255916B069770059775D /* FormatClasses.cpp */; };
+ 94CB255E16B069770059775D /* FormatManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB255A16B069770059775D /* FormatManager.cpp */; };
+ 94CB256616B096F10059775D /* TypeCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB256416B096F10059775D /* TypeCategory.cpp */; };
+ 94CB256716B096F10059775D /* TypeCategoryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB256516B096F10059775D /* TypeCategoryMap.cpp */; };
+ 94CB257016B0A4270059775D /* TypeFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB256D16B0A4260059775D /* TypeFormat.cpp */; };
+ 94CB257116B0A4270059775D /* TypeSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB256E16B0A4260059775D /* TypeSummary.cpp */; };
+ 94CB257216B0A4270059775D /* TypeSynthetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB256F16B0A4270059775D /* TypeSynthetic.cpp */; };
+ 94CB257416B1D3880059775D /* FormatCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94CB257316B1D3870059775D /* FormatCache.cpp */; };
94EA1D5C15E6C9B400D4171A /* PythonDataObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94EA1D5B15E6C9B400D4171A /* PythonDataObjects.cpp */; };
94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94FA3DDF1405D50300833217 /* ValueObjectConstResultChild.cpp */; };
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -568,7 +575,6 @@
B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */; };
B21EB71515CC99F100E60059 /* cxa_demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B21EB71415CC99F100E60059 /* cxa_demangle.cpp */; settings = {COMPILER_FLAGS = "-frtti"; }; };
B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */; };
- B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; };
B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointList.cpp */; };
B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; };
B299580B14F2FA1400050A04 /* DisassemblerLLVMC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B299580A14F2FA1400050A04 /* DisassemblerLLVMC.cpp */; };
@@ -1519,8 +1525,6 @@
94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PriorityPointerPair.h; path = include/lldb/Utility/PriorityPointerPair.h; sourceTree = "<group>"; };
94094C68163B6CCC0083A547 /* ValueObjectCast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectCast.h; path = include/lldb/Core/ValueObjectCast.h; sourceTree = "<group>"; };
94094C69163B6CD90083A547 /* ValueObjectCast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectCast.cpp; path = source/Core/ValueObjectCast.cpp; sourceTree = "<group>"; };
- 9415F61613B2C0DC00A52B36 /* FormatManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = FormatManager.h; path = include/lldb/Core/FormatManager.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
- 9415F61713B2C0EF00A52B36 /* FormatManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = FormatManager.cpp; path = source/Core/FormatManager.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
9443B120140C18A90013457C /* SBData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBData.h; path = include/lldb/API/SBData.h; sourceTree = "<group>"; };
9443B121140C18C10013457C /* SBData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBData.cpp; path = source/API/SBData.cpp; sourceTree = "<group>"; };
9452573616262CD000325455 /* SBDeclaration.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBDeclaration.i; sourceTree = "<group>"; };
@@ -1546,8 +1550,6 @@
9463D4CE13B179A500C230D4 /* CommandObjectType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandObjectType.h; path = source/Commands/CommandObjectType.h; sourceTree = "<group>"; };
9467E65113C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeHierarchyNavigator.cpp; path = source/Symbol/TypeHierarchyNavigator.cpp; sourceTree = "<group>"; };
9467E65413C3D98900B3B6F3 /* TypeHierarchyNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeHierarchyNavigator.h; path = include/lldb/Symbol/TypeHierarchyNavigator.h; sourceTree = "<group>"; };
- 9470A8EE1402DF940056FF61 /* DataVisualization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = DataVisualization.h; path = include/lldb/Core/DataVisualization.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
- 9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = DataVisualization.cpp; path = source/Core/DataVisualization.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeCategory.h; path = include/lldb/API/SBTypeCategory.h; sourceTree = "<group>"; };
9475C18714E5E9FA001BFC6D /* SBTypeCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeCategory.cpp; path = source/API/SBTypeCategory.cpp; sourceTree = "<group>"; };
9475C18A14E5EA1C001BFC6D /* SBTypeCategory.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeCategory.i; sourceTree = "<group>"; };
@@ -1558,13 +1560,29 @@
947A1D631616476A0017C8D1 /* CommandObjectPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectPlugin.h; path = source/Commands/CommandObjectPlugin.h; sourceTree = "<group>"; };
949ADF001406F62E004833E1 /* ValueObjectConstResultImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectConstResultImpl.h; path = include/lldb/Core/ValueObjectConstResultImpl.h; sourceTree = "<group>"; };
949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = source/Core/ValueObjectConstResultImpl.cpp; sourceTree = "<group>"; };
- 94A8287514031D05006C37A8 /* FormatNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatNavigator.h; path = include/lldb/Core/FormatNavigator.h; sourceTree = "<group>"; };
- 94A9112B13D5DEF80046D8A6 /* FormatClasses.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatClasses.h; path = include/lldb/Core/FormatClasses.h; sourceTree = "<group>"; };
- 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatClasses.cpp; path = source/Core/FormatClasses.cpp; sourceTree = "<group>"; };
94B6E76013D8833C005F417F /* ValueObjectSyntheticFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ValueObjectSyntheticFilter.h; path = include/lldb/Core/ValueObjectSyntheticFilter.h; sourceTree = "<group>"; };
94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectSyntheticFilter.cpp; path = source/Core/ValueObjectSyntheticFilter.cpp; sourceTree = "<group>"; };
- 94CDEB9A15F0226900DD2A7A /* CXXFormatterFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CXXFormatterFunctions.h; path = include/lldb/Core/CXXFormatterFunctions.h; sourceTree = "<group>"; };
- 94CDEB9C15F0258400DD2A7A /* CXXFormatterFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CXXFormatterFunctions.cpp; path = source/Core/CXXFormatterFunctions.cpp; sourceTree = "<group>"; };
+ 94CB255716B069770059775D /* CXXFormatterFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CXXFormatterFunctions.cpp; path = source/DataFormatters/CXXFormatterFunctions.cpp; sourceTree = "<group>"; };
+ 94CB255816B069770059775D /* DataVisualization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataVisualization.cpp; path = source/DataFormatters/DataVisualization.cpp; sourceTree = "<group>"; };
+ 94CB255916B069770059775D /* FormatClasses.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatClasses.cpp; path = source/DataFormatters/FormatClasses.cpp; sourceTree = "<group>"; };
+ 94CB255A16B069770059775D /* FormatManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatManager.cpp; path = source/DataFormatters/FormatManager.cpp; sourceTree = "<group>"; };
+ 94CB255F16B069800059775D /* CXXFormatterFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CXXFormatterFunctions.h; path = include/lldb/DataFormatters/CXXFormatterFunctions.h; sourceTree = "<group>"; };
+ 94CB256016B069800059775D /* DataVisualization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DataVisualization.h; path = include/lldb/DataFormatters/DataVisualization.h; sourceTree = "<group>"; };
+ 94CB256116B069800059775D /* FormatClasses.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatClasses.h; path = include/lldb/DataFormatters/FormatClasses.h; sourceTree = "<group>"; };
+ 94CB256216B069800059775D /* FormatManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatManager.h; path = include/lldb/DataFormatters/FormatManager.h; sourceTree = "<group>"; };
+ 94CB256316B069800059775D /* FormatNavigator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatNavigator.h; path = include/lldb/DataFormatters/FormatNavigator.h; sourceTree = "<group>"; };
+ 94CB256416B096F10059775D /* TypeCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeCategory.cpp; path = source/DataFormatters/TypeCategory.cpp; sourceTree = "<group>"; };
+ 94CB256516B096F10059775D /* TypeCategoryMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeCategoryMap.cpp; path = source/DataFormatters/TypeCategoryMap.cpp; sourceTree = "<group>"; };
+ 94CB256816B096F90059775D /* TypeCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeCategory.h; path = include/lldb/DataFormatters/TypeCategory.h; sourceTree = "<group>"; };
+ 94CB256916B096FA0059775D /* TypeCategoryMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeCategoryMap.h; path = include/lldb/DataFormatters/TypeCategoryMap.h; sourceTree = "<group>"; };
+ 94CB256A16B0A4030059775D /* TypeFormat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeFormat.h; path = include/lldb/DataFormatters/TypeFormat.h; sourceTree = "<group>"; };
+ 94CB256B16B0A4030059775D /* TypeSummary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeSummary.h; path = include/lldb/DataFormatters/TypeSummary.h; sourceTree = "<group>"; };
+ 94CB256C16B0A4040059775D /* TypeSynthetic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypeSynthetic.h; path = include/lldb/DataFormatters/TypeSynthetic.h; sourceTree = "<group>"; };
+ 94CB256D16B0A4260059775D /* TypeFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeFormat.cpp; path = source/DataFormatters/TypeFormat.cpp; sourceTree = "<group>"; };
+ 94CB256E16B0A4260059775D /* TypeSummary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeSummary.cpp; path = source/DataFormatters/TypeSummary.cpp; sourceTree = "<group>"; };
+ 94CB256F16B0A4270059775D /* TypeSynthetic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeSynthetic.cpp; path = source/DataFormatters/TypeSynthetic.cpp; sourceTree = "<group>"; };
+ 94CB257316B1D3870059775D /* FormatCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatCache.cpp; path = source/DataFormatters/FormatCache.cpp; sourceTree = "<group>"; };
+ 94CB257516B1D3910059775D /* FormatCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FormatCache.h; path = include/lldb/DataFormatters/FormatCache.h; sourceTree = "<group>"; };
94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "modify-python-lldb.py"; sourceTree = "<group>"; };
94E367CE140C4EEA001C7A5A /* python-typemaps.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-typemaps.swig"; sourceTree = "<group>"; };
94EA1D5A15E6C99B00D4171A /* PythonDataObjects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PythonDataObjects.h; path = include/lldb/Interpreter/PythonDataObjects.h; sourceTree = "<group>"; };
@@ -1785,6 +1803,7 @@
26BC7CEB10F1B70800F91463 /* Breakpoint */,
26BC7D0D10F1B71D00F91463 /* Commands */,
26BC7C1010F1B34800F91463 /* Core */,
+ 94CB255616B0683B0059775D /* DataFormatters */,
26BC7DBE10F1B78200F91463 /* Expression */,
26BC7DD010F1B7C100F91463 /* Host */,
26BC7DDF10F1B7E200F91463 /* Interpreter */,
@@ -2492,8 +2511,6 @@
266603C91345B5A8004DA8B6 /* ConnectionSharedMemory.cpp */,
26BC7D7C10F1B77400F91463 /* ConstString.h */,
26BC7E9410F1B85900F91463 /* ConstString.cpp */,
- 94CDEB9A15F0226900DD2A7A /* CXXFormatterFunctions.h */,
- 94CDEB9C15F0258400DD2A7A /* CXXFormatterFunctions.cpp */,
26BC7D5910F1B77400F91463 /* DataBuffer.h */,
26BC7D5B10F1B77400F91463 /* DataBufferHeap.h */,
26BC7E7210F1B85900F91463 /* DataBufferHeap.cpp */,
@@ -2503,8 +2520,6 @@
268ED0A4140FF54200DE830F /* DataEncoder.cpp */,
26BC7D5A10F1B77400F91463 /* DataExtractor.h */,
26BC7E7110F1B85900F91463 /* DataExtractor.cpp */,
- 9470A8EE1402DF940056FF61 /* DataVisualization.h */,
- 9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */,
263664941140A4C10075843B /* Debugger.h */,
263664921140A4930075843B /* Debugger.cpp */,
26BC7D5E10F1B77400F91463 /* Disassembler.h */,
@@ -2521,11 +2536,6 @@
26BC7D6310F1B77400F91463 /* FileSpecList.h */,
26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */,
26BC7D6410F1B77400F91463 /* Flags.h */,
- 94A9112B13D5DEF80046D8A6 /* FormatClasses.h */,
- 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */,
- 9415F61613B2C0DC00A52B36 /* FormatManager.h */,
- 9415F61713B2C0EF00A52B36 /* FormatManager.cpp */,
- 94A8287514031D05006C37A8 /* FormatNavigator.h */,
26F7305F139D8FC900FD51C7 /* History.h */,
26F73061139D8FDB00FD51C7 /* History.cpp */,
9AA69DBB118A029E00D753A0 /* InputReader.h */,
@@ -3328,6 +3338,34 @@
path = source/Host/common;
sourceTree = "<group>";
};
+ 94CB255616B0683B0059775D /* DataFormatters */ = {
+ isa = PBXGroup;
+ children = (
+ 94CB255F16B069800059775D /* CXXFormatterFunctions.h */,
+ 94CB255716B069770059775D /* CXXFormatterFunctions.cpp */,
+ 94CB256016B069800059775D /* DataVisualization.h */,
+ 94CB255816B069770059775D /* DataVisualization.cpp */,
+ 94CB257516B1D3910059775D /* FormatCache.h */,
+ 94CB257316B1D3870059775D /* FormatCache.cpp */,
+ 94CB256116B069800059775D /* FormatClasses.h */,
+ 94CB255916B069770059775D /* FormatClasses.cpp */,
+ 94CB256216B069800059775D /* FormatManager.h */,
+ 94CB255A16B069770059775D /* FormatManager.cpp */,
+ 94CB256316B069800059775D /* FormatNavigator.h */,
+ 94CB256816B096F90059775D /* TypeCategory.h */,
+ 94CB256416B096F10059775D /* TypeCategory.cpp */,
+ 94CB256916B096FA0059775D /* TypeCategoryMap.h */,
+ 94CB256516B096F10059775D /* TypeCategoryMap.cpp */,
+ 94CB256A16B0A4030059775D /* TypeFormat.h */,
+ 94CB256D16B0A4260059775D /* TypeFormat.cpp */,
+ 94CB256B16B0A4030059775D /* TypeSummary.h */,
+ 94CB256E16B0A4260059775D /* TypeSummary.cpp */,
+ 94CB256C16B0A4040059775D /* TypeSynthetic.h */,
+ 94CB256F16B0A4270059775D /* TypeSynthetic.cpp */,
+ );
+ name = DataFormatters;
+ sourceTree = "<group>";
+ };
EDC6D49114E5C15C001B75F8 /* launcherXPCService */ = {
isa = PBXGroup;
children = (
@@ -4094,7 +4132,6 @@
4CCA645613B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp in Sources */,
4CCA645813B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */,
9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */,
- 9415F61813B2C0EF00A52B36 /* FormatManager.cpp in Sources */,
49D8FB3913B5598F00411094 /* ClangASTImporter.cpp in Sources */,
9467E65213C3D97600B3B6F3 /* TypeHierarchyNavigator.cpp in Sources */,
26ED3D6D13C563810017D45E /* OptionGroupVariable.cpp in Sources */,
@@ -4111,13 +4148,11 @@
265205AC13D3E3F700132FE2 /* RegisterContextKDP_x86_64.cpp in Sources */,
2628A4D513D4977900F5487A /* ThreadKDP.cpp in Sources */,
26D7E45D13D5E30A007FD12B /* SocketAddress.cpp in Sources */,
- B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */,
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */,
262D24E613FB8710002D1960 /* RegisterContextMemory.cpp in Sources */,
26F4A21C13FBA31A0064B613 /* ThreadMemory.cpp in Sources */,
266DFE9713FD656E00D0C574 /* OperatingSystem.cpp in Sources */,
26954EBE1401EE8B00294D09 /* DynamicRegisterInfo.cpp in Sources */,
- 9470A8F01402DFFB0056FF61 /* DataVisualization.cpp in Sources */,
26274FA214030EEF006BA130 /* OperatingSystemDarwinKernel.cpp in Sources */,
26274FA714030F79006BA130 /* DynamicLoaderDarwinKernel.cpp in Sources */,
94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */,
@@ -4165,10 +4200,19 @@
2697A39315E404B1003E682C /* OptionValueArch.cpp in Sources */,
94EA1D5C15E6C9B400D4171A /* PythonDataObjects.cpp in Sources */,
2698699B15E6CBD0002415FF /* OperatingSystemPython.cpp in Sources */,
- 94CDEB9D15F0258500DD2A7A /* CXXFormatterFunctions.cpp in Sources */,
947A1D641616476B0017C8D1 /* CommandObjectPlugin.cpp in Sources */,
262ED0081631FA3A00879631 /* OptionGroupString.cpp in Sources */,
94094C6B163B6F840083A547 /* ValueObjectCast.cpp in Sources */,
+ 94CB255B16B069770059775D /* CXXFormatterFunctions.cpp in Sources */,
+ 94CB255C16B069770059775D /* DataVisualization.cpp in Sources */,
+ 94CB255D16B069770059775D /* FormatClasses.cpp in Sources */,
+ 94CB255E16B069770059775D /* FormatManager.cpp in Sources */,
+ 94CB256616B096F10059775D /* TypeCategory.cpp in Sources */,
+ 94CB256716B096F10059775D /* TypeCategoryMap.cpp in Sources */,
+ 94CB257016B0A4270059775D /* TypeFormat.cpp in Sources */,
+ 94CB257116B0A4270059775D /* TypeSummary.cpp in Sources */,
+ 94CB257216B0A4270059775D /* TypeSynthetic.cpp in Sources */,
+ 94CB257416B1D3880059775D /* FormatCache.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index a7492450d8e..4cee580e31b 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -35,9 +35,9 @@
#include "lldb/API/SBTypeSynthetic.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionGroupPlatform.h"
diff --git a/lldb/source/API/SBTypeCategory.cpp b/lldb/source/API/SBTypeCategory.cpp
index f9c18854935..03b02fababa 100644
--- a/lldb/source/API/SBTypeCategory.cpp
+++ b/lldb/source/API/SBTypeCategory.cpp
@@ -18,8 +18,8 @@
#include "lldb/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
@@ -233,7 +233,7 @@ SBTypeCategory::GetSyntheticForType (SBTypeNameSpecifier spec)
if (!children_sp)
return lldb::SBTypeSynthetic();
- TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
+ ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
return lldb::SBTypeSynthetic(synth_sp);
}
@@ -285,7 +285,7 @@ SBTypeCategory::GetSyntheticAtIndex (uint32_t index)
if (!children_sp.get())
return lldb::SBTypeSynthetic();
- TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
+ ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
return lldb::SBTypeSynthetic(synth_sp);
}
diff --git a/lldb/source/API/SBTypeFilter.cpp b/lldb/source/API/SBTypeFilter.cpp
index 30be1ca535a..605e92de699 100644
--- a/lldb/source/API/SBTypeFilter.cpp
+++ b/lldb/source/API/SBTypeFilter.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeFormat.cpp b/lldb/source/API/SBTypeFormat.cpp
index b222fe9c646..34ab404a206 100644
--- a/lldb/source/API/SBTypeFormat.cpp
+++ b/lldb/source/API/SBTypeFormat.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeNameSpecifier.cpp b/lldb/source/API/SBTypeNameSpecifier.cpp
index eac906a8bdd..d417499ecbd 100644
--- a/lldb/source/API/SBTypeNameSpecifier.cpp
+++ b/lldb/source/API/SBTypeNameSpecifier.cpp
@@ -14,7 +14,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/API/SBType.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeSummary.cpp b/lldb/source/API/SBTypeSummary.cpp
index df219a696ca..aaa09c289cb 100644
--- a/lldb/source/API/SBTypeSummary.cpp
+++ b/lldb/source/API/SBTypeSummary.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeSynthetic.cpp b/lldb/source/API/SBTypeSynthetic.cpp
index 2d69f0b09eb..e8c167b762a 100644
--- a/lldb/source/API/SBTypeSynthetic.cpp
+++ b/lldb/source/API/SBTypeSynthetic.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
@@ -30,7 +30,7 @@ SBTypeSynthetic::CreateWithClassName (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSynthetic();
- return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, data, "")));
+ return SBTypeSynthetic(ScriptedSyntheticChildrenSP(new ScriptedSyntheticChildren(options, data, "")));
}
SBTypeSynthetic
@@ -38,7 +38,7 @@ SBTypeSynthetic::CreateWithScriptCode (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSynthetic();
- return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, "", data)));
+ return SBTypeSynthetic(ScriptedSyntheticChildrenSP(new ScriptedSyntheticChildren(options, "", data)));
}
SBTypeSynthetic::SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs) :
@@ -172,19 +172,19 @@ SBTypeSynthetic::operator != (lldb::SBTypeSynthetic &rhs)
return m_opaque_sp != rhs.m_opaque_sp;
}
-lldb::TypeSyntheticImplSP
+lldb::ScriptedSyntheticChildrenSP
SBTypeSynthetic::GetSP ()
{
return m_opaque_sp;
}
void
-SBTypeSynthetic::SetSP (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp)
+SBTypeSynthetic::SetSP (const lldb::ScriptedSyntheticChildrenSP &TypeSynthetic_impl_sp)
{
m_opaque_sp = TypeSynthetic_impl_sp;
}
-SBTypeSynthetic::SBTypeSynthetic (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp) :
+SBTypeSynthetic::SBTypeSynthetic (const lldb::ScriptedSyntheticChildrenSP &TypeSynthetic_impl_sp) :
m_opaque_sp(TypeSynthetic_impl_sp)
{
}
@@ -197,7 +197,7 @@ SBTypeSynthetic::CopyOnWrite_Impl()
if (m_opaque_sp.unique())
return true;
- TypeSyntheticImplSP new_sp(new TypeSyntheticImpl(m_opaque_sp->GetOptions(),
+ ScriptedSyntheticChildrenSP new_sp(new ScriptedSyntheticChildren(m_opaque_sp->GetOptions(),
m_opaque_sp->GetPythonClassName(),
m_opaque_sp->GetPythonCode()));
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index dffd34c920b..d3a34685b79 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -20,7 +20,6 @@
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Scalar.h"
@@ -30,6 +29,7 @@
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Declaration.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -740,7 +740,7 @@ SBValue::GetTypeSynthetic ()
if (children_sp && children_sp->IsScripted())
{
- TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
+ ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
synthetic.SetSP(synth_sp);
}
}
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 266753b641a..6c3b2457e0c 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -16,7 +16,6 @@
#include <string>
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
@@ -25,6 +24,7 @@
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 771be93814b..45f9e7c2535 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -17,13 +17,13 @@
// C++ Includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/InputReaderEZ.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StringList.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -1961,7 +1961,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"), CategoryMap::First);
+ DataVisualization::Categories::Enable(ConstString("default"), TypeCategoryMap::First);
uint32_t num_categories = DataVisualization::Categories::GetCount();
for (uint32_t i = 0; i < num_categories; i++)
{
@@ -1972,10 +1972,10 @@ protected:
::strcmp(category_sp->GetName(), "default") == 0 )
continue;
else
- DataVisualization::Categories::Enable(category_sp, CategoryMap::Default);
+ DataVisualization::Categories::Enable(category_sp, TypeCategoryMap::Default);
}
}
- DataVisualization::Categories::Enable(ConstString("system"), CategoryMap::Last);
+ DataVisualization::Categories::Enable(ConstString("system"), TypeCategoryMap::Last);
}
else
{
@@ -3385,10 +3385,10 @@ public:
// everything should be fine now, let's add the synth provider class
SyntheticChildrenSP synth_provider;
- synth_provider.reset(new TypeSyntheticImpl(SyntheticChildren::Flags().SetCascades(options->m_cascade).
- SetSkipPointers(options->m_skip_pointers).
- SetSkipReferences(options->m_skip_references),
- class_name_str.c_str()));
+ synth_provider.reset(new ScriptedSyntheticChildren(SyntheticChildren::Flags().SetCascades(options->m_cascade).
+ SetSkipPointers(options->m_skip_pointers).
+ SetSkipReferences(options->m_skip_references),
+ class_name_str.c_str()));
lldb::TypeCategoryImplSP category;
@@ -3504,11 +3504,11 @@ CommandObjectTypeSynthAdd::Execute_PythonClass (Args& command, CommandReturnObje
SyntheticChildrenSP entry;
- TypeSyntheticImpl* impl = new TypeSyntheticImpl(SyntheticChildren::Flags().
- SetCascades(m_options.m_cascade).
- SetSkipPointers(m_options.m_skip_pointers).
- SetSkipReferences(m_options.m_skip_references),
- m_options.m_class_name.c_str());
+ ScriptedSyntheticChildren* impl = new ScriptedSyntheticChildren(SyntheticChildren::Flags().
+ SetCascades(m_options.m_cascade).
+ SetSkipPointers(m_options.m_skip_pointers).
+ SetSkipReferences(m_options.m_skip_references),
+ m_options.m_class_name.c_str());
entry.reset(impl);
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index e7e0e203f4d..7617914c24f 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -20,8 +20,6 @@
#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/Module.h"
#include "lldb/Core/PluginManager.h"
@@ -33,6 +31,8 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/DynamicLibrary.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Interpreter/CommandInterpreter.h"
diff --git a/lldb/source/Core/Timer.cpp b/lldb/source/Core/Timer.cpp
index a5747ce17f4..b1416bdaf62 100644
--- a/lldb/source/Core/Timer.cpp
+++ b/lldb/source/Core/Timer.cpp
@@ -25,7 +25,7 @@ uint32_t Timer::g_depth = 0;
uint32_t Timer::g_display_depth = 0;
FILE * Timer::g_file = NULL;
typedef std::vector<Timer *> TimerStack;
-typedef std::map<const char *, uint64_t> CategoryMap;
+typedef std::map<const char *, uint64_t> TimerCategoryMap;
static pthread_key_t g_key;
static Mutex &
@@ -35,10 +35,10 @@ GetCategoryMutex()
return g_category_mutex;
}
-static CategoryMap &
+static TimerCategoryMap &
GetCategoryMap()
{
- static CategoryMap g_category_map;
+ static TimerCategoryMap g_category_map;
return g_category_map;
}
@@ -153,7 +153,7 @@ Timer::~Timer()
// Keep total results for each category so we can dump results.
Mutex::Locker locker (GetCategoryMutex());
- CategoryMap &category_map = GetCategoryMap();
+ TimerCategoryMap &category_map = GetCategoryMap();
category_map[m_category] += timer_nsec_uint;
}
if (g_depth > 0)
@@ -214,7 +214,7 @@ Timer::SetDisplayDepth (uint32_t depth)
* - returns whether a person is less than another person
*/
static bool
-CategoryMapIteratorSortCriterion (const CategoryMap::const_iterator& lhs, const CategoryMap::const_iterator& rhs)
+CategoryMapIteratorSortCriterion (const TimerCategoryMap::const_iterator& lhs, const TimerCategoryMap::const_iterator& rhs)
{
return lhs->second > rhs->second;
}
@@ -224,7 +224,7 @@ void
Timer::ResetCategoryTimes ()
{
Mutex::Locker locker (GetCategoryMutex());
- CategoryMap &category_map = GetCategoryMap();
+ TimerCategoryMap &category_map = GetCategoryMap();
category_map.clear();
}
@@ -232,9 +232,9 @@ void
Timer::DumpCategoryTimes (Stream *s)
{
Mutex::Locker locker (GetCategoryMutex());
- CategoryMap &category_map = GetCategoryMap();
- std::vector<CategoryMap::const_iterator> sorted_iterators;
- CategoryMap::const_iterator pos, end = category_map.end();
+ TimerCategoryMap &category_map = GetCategoryMap();
+ std::vector<TimerCategoryMap::const_iterator> sorted_iterators;
+ TimerCategoryMap::const_iterator pos, end = category_map.end();
for (pos = category_map.begin(); pos != end; ++pos)
{
sorted_iterators.push_back (pos);
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 5ea8e7d6b8d..b9a0a13b904 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -21,7 +21,6 @@
// Project includes
#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
@@ -34,6 +33,8 @@
#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/Core/ValueObjectSyntheticFilter.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+
#include "lldb/Host/Endian.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -83,7 +84,6 @@ ValueObject::ValueObject (ValueObject &parent) :
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
- m_last_format_mgr_dynamic(parent.m_last_format_mgr_dynamic),
m_type_summary_sp(),
m_type_format_sp(),
m_synthetic_children_sp(),
@@ -129,7 +129,6 @@ ValueObject::ValueObject (ExecutionContextScope *exe_scope,
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
- m_last_format_mgr_dynamic(eNoDynamicValues),
m_type_summary_sp(),
m_type_format_sp(),
m_synthetic_children_sp(),
@@ -161,17 +160,11 @@ ValueObject::~ValueObject ()
bool
ValueObject::UpdateValueIfNeeded (bool update_format)
{
- return UpdateValueIfNeeded(m_last_format_mgr_dynamic, update_format);
-}
-
-bool
-ValueObject::UpdateValueIfNeeded (DynamicValueType use_dynamic, bool update_format)
-{
bool did_change_formats = false;
if (update_format)
- did_change_formats = UpdateFormatsIfNeeded(use_dynamic);
+ did_change_formats = UpdateFormatsIfNeeded();
// If this is a constant value, then our success is predicated on whether
// we have an error or not
@@ -238,7 +231,7 @@ ValueObject::UpdateValueIfNeeded (DynamicValueType use_dynamic, bool update_form
}
bool
-ValueObject::UpdateFormatsIfNeeded(DynamicValueType use_dynamic)
+ValueObject::UpdateFormatsIfNeeded()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
@@ -250,17 +243,15 @@ ValueObject::UpdateFormatsIfNeeded(DynamicValueType use_dynamic)
bool any_change = false;
- if ( (m_last_format_mgr_revision != DataVisualization::GetCurrentRevision()) ||
- m_last_format_mgr_dynamic != use_dynamic)
+ if ( (m_last_format_mgr_revision != DataVisualization::GetCurrentRevision()))
{
SetValueFormat(DataVisualization::ValueFormats::GetFormat (*this, eNoDynamicValues));
- SetSummaryFormat(DataVisualization::GetSummaryFormat (*this, use_dynamic));
+ SetSummaryFormat(DataVisualization::GetSummaryFormat (*this, GetDynamicValueType()));
#ifndef LLDB_DISABLE_PYTHON
- SetSyntheticChildren(DataVisualization::GetSyntheticChildren (*this, use_dynamic));
+ SetSyntheticChildren(DataVisualization::GetSyntheticChildren (*this, GetDynamicValueType()));
#endif
m_last_format_mgr_revision = DataVisualization::GetCurrentRevision();
- m_last_format_mgr_dynamic = use_dynamic;
any_change = true;
}
@@ -2033,42 +2024,6 @@ ValueObject::GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_cre
}
ValueObjectSP
-ValueObject::GetSyntheticArrayRangeChild (uint32_t from, uint32_t to, bool can_create)
-{
- ValueObjectSP synthetic_child_sp;
- if (IsArrayType () || IsPointerType ())
- {
- char index_str[64];
- snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to);
- ConstString index_const_str(index_str);
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
- synthetic_child_sp = GetSyntheticChild (index_const_str);
- if (!synthetic_child_sp)
- {
- ValueObjectSynthetic *synthetic_child;
-
- // We haven't made a synthetic array member for INDEX yet, so
- // lets make one and cache it for any future reference.
- SyntheticArrayView *view = new SyntheticArrayView(SyntheticChildren::Flags());
- view->AddRange(from,to);
- SyntheticChildrenSP view_sp(view);
- synthetic_child = new ValueObjectSynthetic(*this, view_sp);
-
- // Cache the value if we got one back...
- if (synthetic_child)
- {
- AddSyntheticChild(index_const_str, synthetic_child);
- synthetic_child_sp = synthetic_child->GetSP();
- synthetic_child_sp->SetName(ConstString(index_str));
- synthetic_child_sp->m_is_bitfield_for_scalar = true;
- }
- }
- }
- return synthetic_child_sp;
-}
-
-ValueObjectSP
ValueObject::GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create)
{
@@ -2168,7 +2123,7 @@ ValueObject::CalculateSyntheticValue (bool use_synthetic)
lldb::SyntheticChildrenSP current_synth_sp(m_synthetic_children_sp);
- if (!UpdateFormatsIfNeeded(m_last_format_mgr_dynamic) && m_synthetic_value)
+ if (!UpdateFormatsIfNeeded() && m_synthetic_value)
return;
if (m_synthetic_children_sp.get() == NULL)
@@ -2243,7 +2198,7 @@ ValueObject::GetSyntheticValue (bool use_synthetic)
bool
ValueObject::HasSyntheticValue()
{
- UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
+ UpdateFormatsIfNeeded();
if (m_synthetic_children_sp.get() == NULL)
return false;
@@ -3285,7 +3240,7 @@ DumpValueObject_Impl (Stream &s,
{
if (valobj)
{
- bool update_success = valobj->UpdateValueIfNeeded (options.m_use_dynamic, true);
+ bool update_success = valobj->UpdateValueIfNeeded (true);
const char *root_valobj_name =
options.m_root_valobj_name.empty() ?
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index 1af293660fc..06a7eedc349 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -41,7 +41,6 @@ ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent, lldb::Dyn
m_dynamic_type_info(),
m_use_dynamic (use_dynamic)
{
- m_last_format_mgr_dynamic = use_dynamic;
SetName (parent.GetName());
}
diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index 8ca0ea99111..cb3fcfef1b8 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormatClasses.h"
using namespace lldb_private;
@@ -39,7 +39,7 @@ public:
return lldb::ValueObjectSP();
}
- uint32_t
+ size_t
GetIndexOfChildWithName (const ConstString &name)
{
return UINT32_MAX;
@@ -95,6 +95,12 @@ ValueObjectSynthetic::GetTypeName()
return m_parent->GetTypeName();
}
+ConstString
+ValueObjectSynthetic::GetQualifiedTypeName()
+{
+ return m_parent->GetQualifiedTypeName();
+}
+
size_t
ValueObjectSynthetic::CalculateNumChildren()
{
@@ -104,6 +110,16 @@ ValueObjectSynthetic::CalculateNumChildren()
return (m_synthetic_children_count = m_synth_filter_ap->CalculateNumChildren());
}
+lldb::ValueObjectSP
+ValueObjectSynthetic::GetDynamicValue (lldb::DynamicValueType valueType)
+{
+ if (!m_parent)
+ return lldb::ValueObjectSP();
+ if (m_parent->IsDynamic() && m_parent->GetDynamicValueType() == valueType)
+ return m_parent->GetSP();
+ return ValueObject::GetDynamicValue(valueType);
+}
+
bool
ValueObjectSynthetic::MightHaveChildren()
{
diff --git a/lldb/source/Core/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
index 81e72e5418c..a3819025128 100644
--- a/lldb/source/Core/CXXFormatterFunctions.cpp
+++ b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
@@ -9,7 +9,7 @@
#include "lldb/lldb-python.h"
-#include "lldb/Core/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/CXXFormatterFunctions.h"
// needed to get ConvertUTF16/32ToUTF8
#define CLANG_NEEDS_THESE_ONE_DAY
@@ -1192,7 +1192,7 @@ ExtractIndexFromString (const char* item_name)
return idx;
}
-uint32_t
+size_t
lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
if (!m_data_32 && !m_data_64)
@@ -1230,7 +1230,7 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::~NSArrayISyntheticFrontEnd
{
}
-uint32_t
+size_t
lldb_private::formatters::NSArrayISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* item_name = name.GetCString();
@@ -1385,7 +1385,7 @@ lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::MightHaveChildren
return true;
}
-uint32_t
+size_t
lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
return 0;
@@ -1482,7 +1482,7 @@ lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::MightHaveChi
return true;
}
-uint32_t
+size_t
lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
return 0;
@@ -1510,7 +1510,7 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::~NSDictionaryISyntheti
m_data_64 = NULL;
}
-uint32_t
+size_t
lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* item_name = name.GetCString();
@@ -1658,7 +1658,7 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheti
m_data_64 = NULL;
}
-uint32_t
+size_t
lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* item_name = name.GetCString();
diff --git a/lldb/source/Core/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp
index cef3e04aa71..c1ef359049b 100644
--- a/lldb/source/Core/DataVisualization.cpp
+++ b/lldb/source/DataFormatters/DataVisualization.cpp
@@ -9,7 +9,7 @@
#include "lldb/lldb-python.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
// C Includes
// C++ Includes
@@ -80,20 +80,20 @@ DataVisualization::ValueFormats::LoopThrough (TypeFormatImpl::ValueCallback call
GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
}
-uint32_t
+size_t
DataVisualization::ValueFormats::GetCount ()
{
return GetFormatManager().GetValueNavigator().GetCount();
}
lldb::TypeNameSpecifierImplSP
-DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex (uint32_t index)
+DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex (size_t index)
{
return GetFormatManager().GetValueNavigator().GetTypeNameSpecifierAtIndex(index);
}
lldb::TypeFormatImplSP
-DataVisualization::ValueFormats::GetFormatAtIndex (uint32_t index)
+DataVisualization::ValueFormats::GetFormatAtIndex (size_t index)
{
return GetFormatManager().GetValueNavigator().GetAtIndex(index);
}
@@ -135,7 +135,7 @@ DataVisualization::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
}
#ifndef LLDB_DISABLE_PYTHON
-lldb::TypeSyntheticImplSP
+lldb::ScriptedSyntheticChildrenSP
DataVisualization::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
{
return GetFormatManager().GetSyntheticForType(type_sp);
@@ -191,7 +191,7 @@ DataVisualization::Categories::Clear (const ConstString &category)
void
DataVisualization::Categories::Enable (const ConstString& category,
- CategoryMap::Position pos)
+ TypeCategoryMap::Position pos)
{
if (GetFormatManager().GetCategory(category)->IsEnabled())
GetFormatManager().DisableCategory(category);
@@ -207,7 +207,7 @@ DataVisualization::Categories::Disable (const ConstString& category)
void
DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
- CategoryMap::Position pos)
+ TypeCategoryMap::Position pos)
{
if (category.get())
{
@@ -237,7 +237,7 @@ DataVisualization::Categories::GetCount ()
}
lldb::TypeCategoryImplSP
-DataVisualization::Categories::GetCategoryAtIndex (uint32_t index)
+DataVisualization::Categories::GetCategoryAtIndex (size_t index)
{
return GetFormatManager().GetCategoryAtIndex(index);
}
diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp
new file mode 100644
index 00000000000..8a816e42344
--- /dev/null
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -0,0 +1,163 @@
+//===-- FormatCache.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/DataFormatters/FormatCache.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+FormatCache::Entry::Entry () :
+m_summary_cached(false),
+m_synthetic_cached(false),
+m_summary_sp(nullptr),
+m_synthetic_sp(nullptr)
+{}
+
+FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp) : FormatCache::Entry()
+{
+ SetSummary (summary_sp);
+}
+
+FormatCache::Entry::Entry (lldb::SyntheticChildrenSP synthetic_sp) : FormatCache::Entry()
+{
+ SetSynthetic (synthetic_sp);
+}
+
+FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp,lldb::SyntheticChildrenSP synthetic_sp) : FormatCache::Entry()
+{
+ SetSummary (summary_sp);
+ SetSynthetic (synthetic_sp);
+}
+
+bool
+FormatCache::Entry::IsSummaryCached ()
+{
+ return m_summary_cached;
+}
+
+bool
+FormatCache::Entry::IsSyntheticCached ()
+{
+ return m_synthetic_cached;
+}
+
+lldb::TypeSummaryImplSP
+FormatCache::Entry::GetSummary ()
+{
+ return m_summary_sp;
+}
+
+lldb::SyntheticChildrenSP
+FormatCache::Entry::GetSynthetic ()
+{
+ return m_synthetic_sp;
+}
+
+void
+FormatCache::Entry::SetSummary (lldb::TypeSummaryImplSP summary_sp)
+{
+ m_summary_cached = true;
+ m_summary_sp = summary_sp;
+}
+
+void
+FormatCache::Entry::SetSynthetic (lldb::SyntheticChildrenSP synthetic_sp)
+{
+ m_synthetic_cached = true;
+ m_synthetic_sp = synthetic_sp;
+}
+
+FormatCache::FormatCache () :
+m_map(),
+m_mutex (Mutex::eMutexTypeRecursive)
+#ifdef LLDB_CONFIGURATION_DEBUG
+,m_cache_hits(0),m_cache_misses(0)
+#endif
+{
+}
+
+FormatCache::Entry&
+FormatCache::GetEntry (const ConstString& type)
+{
+ auto i = m_map.find(type),
+ e = m_map.end();
+ if (i != e)
+ return i->second;
+ m_map[type] = FormatCache::Entry();
+ return m_map[type];
+}
+
+bool
+FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ auto entry = GetEntry(type);
+ if (entry.IsSummaryCached())
+ {
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_hits++;
+#endif
+ summary_sp = entry.GetSummary();
+ return true;
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_misses++;
+#endif
+ summary_sp.reset();
+ return false;
+}
+
+bool
+FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ auto entry = GetEntry(type);
+ if (entry.IsSyntheticCached())
+ {
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_hits++;
+#endif
+ synthetic_sp = entry.GetSynthetic();
+ return true;
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_misses++;
+#endif
+ synthetic_sp.reset();
+ return false;
+}
+
+void
+FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ GetEntry(type).SetSummary(summary_sp);
+}
+
+void
+FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ GetEntry(type).SetSynthetic(synthetic_sp);
+}
+
+void
+FormatCache::Clear ()
+{
+ Mutex::Locker lock(m_mutex);
+ m_map.clear();
+}
+
diff --git a/lldb/source/DataFormatters/FormatClasses.cpp b/lldb/source/DataFormatters/FormatClasses.cpp
new file mode 100644
index 00000000000..c67f86a7493
--- /dev/null
+++ b/lldb/source/DataFormatters/FormatClasses.cpp
@@ -0,0 +1,33 @@
+//===-- FormatClasses.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/lldb-python.h"
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Core/Timer.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 2a84b806124..7ea8fbb85b0 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -9,15 +9,18 @@
#include "lldb/lldb-python.h"
-#include "lldb/Core/FormatManager.h"
+#include "lldb/DataFormatters/FormatManager.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/CXXFormatterFunctions.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Platform.h"
using namespace lldb;
using namespace lldb_private;
@@ -151,8 +154,6 @@ FormatManager::GetFormatAsFormatChar (lldb::Format format)
}
return '\0';
}
-
-
const char *
FormatManager::GetFormatAsCString (Format format)
@@ -162,300 +163,6 @@ FormatManager::GetFormatAsCString (Format format)
return NULL;
}
-TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
- ConstString name) :
- m_summary_nav(new SummaryNavigator("summary",clist)),
- m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
- m_filter_nav(new FilterNavigator("filter",clist)),
- m_regex_filter_nav(new RegexFilterNavigator("regex-filter",clist)),
-#ifndef LLDB_DISABLE_PYTHON
- m_synth_nav(new SynthNavigator("synth",clist)),
- m_regex_synth_nav(new RegexSynthNavigator("regex-synth",clist)),
-#endif
- m_enabled(false),
- m_change_listener(clist),
- m_mutex(Mutex::eMutexTypeRecursive),
- m_name(name)
-{}
-
-bool
-TypeCategoryImpl::Get (ValueObject& valobj,
- lldb::TypeSummaryImplSP& entry,
- lldb::DynamicValueType use_dynamic,
- uint32_t* reason)
-{
- if (!IsEnabled())
- return false;
- if (GetSummaryNavigator()->Get(valobj, entry, use_dynamic, reason))
- return true;
- bool regex = GetRegexSummaryNavigator()->Get(valobj, entry, use_dynamic, reason);
- if (regex && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
- return regex;
-}
-
-bool
-TypeCategoryImpl::Get(ValueObject& valobj,
- lldb::SyntheticChildrenSP& entry_sp,
- lldb::DynamicValueType use_dynamic,
- uint32_t* reason)
-{
- if (!IsEnabled())
- return false;
- TypeFilterImpl::SharedPointer filter_sp;
- uint32_t reason_filter = 0;
- bool regex_filter = false;
- // first find both Filter and Synth, and then check which is most recent
-
- if (!GetFilterNavigator()->Get(valobj, filter_sp, use_dynamic, &reason_filter))
- regex_filter = GetRegexFilterNavigator()->Get (valobj, filter_sp, use_dynamic, &reason_filter);
-
-#ifndef LLDB_DISABLE_PYTHON
- bool regex_synth = false;
- uint32_t reason_synth = 0;
- bool pick_synth = false;
- TypeSyntheticImpl::SharedPointer synth;
- if (!GetSyntheticNavigator()->Get(valobj, synth, use_dynamic, &reason_synth))
- regex_synth = GetRegexSyntheticNavigator()->Get (valobj, synth, use_dynamic, &reason_synth);
- if (!filter_sp.get() && !synth.get())
- return false;
- else if (!filter_sp.get() && synth.get())
- pick_synth = true;
-
- else if (filter_sp.get() && !synth.get())
- pick_synth = false;
-
- else /*if (filter_sp.get() && synth.get())*/
- {
- if (filter_sp->GetRevision() > synth->GetRevision())
- pick_synth = false;
- else
- pick_synth = true;
- }
- if (pick_synth)
- {
- if (regex_synth && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
- entry_sp = synth;
- return true;
- }
- else
- {
- if (regex_filter && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
- entry_sp = filter_sp;
- return true;
- }
-
-#else
- if (filter_sp)
- {
- entry_sp = filter_sp;
- return true;
- }
-#endif
-
- return false;
-
-}
-
-void
-TypeCategoryImpl::Clear (FormatCategoryItems items)
-{
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- m_summary_nav->Clear();
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- m_regex_summary_nav->Clear();
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- m_filter_nav->Clear();
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- m_regex_filter_nav->Clear();
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- m_synth_nav->Clear();
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- m_regex_synth_nav->Clear();
-#endif
-}
-
-bool
-TypeCategoryImpl::Delete (ConstString name,
- FormatCategoryItems items)
-{
- bool success = false;
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- success = m_summary_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- success = m_regex_summary_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- success = m_filter_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- success = m_regex_filter_nav->Delete(name) || success;
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- success = m_synth_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- success = m_regex_synth_nav->Delete(name) || success;
-#endif
- return success;
-}
-
-uint32_t
-TypeCategoryImpl::GetCount (FormatCategoryItems items)
-{
- uint32_t count = 0;
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- count += m_summary_nav->GetCount();
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- count += m_regex_summary_nav->GetCount();
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- count += m_filter_nav->GetCount();
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- count += m_regex_filter_nav->GetCount();
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- count += m_synth_nav->GetCount();
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- count += m_regex_synth_nav->GetCount();
-#endif
- return count;
-}
-
-bool
-TypeCategoryImpl::AnyMatches(ConstString type_name,
- FormatCategoryItems items,
- bool only_enabled,
- const char** matching_category,
- FormatCategoryItems* matching_type)
-{
- if (!IsEnabled() && only_enabled)
- return false;
-
- lldb::TypeSummaryImplSP summary;
- TypeFilterImpl::SharedPointer filter;
-#ifndef LLDB_DISABLE_PYTHON
- TypeSyntheticImpl::SharedPointer synth;
-#endif
-
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- {
- if (m_summary_nav->Get(type_name, summary))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemSummary;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- {
- if (m_regex_summary_nav->Get(type_name, summary))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexSummary;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- {
- if (m_filter_nav->Get(type_name, filter))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemFilter;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- {
- if (m_regex_filter_nav->Get(type_name, filter))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexFilter;
- return true;
- }
- }
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- {
- if (m_synth_nav->Get(type_name, synth))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemSynth;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- {
- if (m_regex_synth_nav->Get(type_name, synth))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexSynth;
- return true;
- }
- }
-#endif
- return false;
-}
-
-bool
-CategoryMap::AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items,
- bool only_enabled,
- const char** matching_category,
- TypeCategoryImpl::FormatCategoryItems* matching_type)
-{
- Mutex::Locker locker(m_map_mutex);
-
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++)
- {
- if (pos->second->AnyMatches(type_name,
- items,
- only_enabled,
- matching_category,
- matching_type))
- return true;
- }
- return false;
-}
-
-lldb::TypeSummaryImplSP
-CategoryMap::GetSummaryFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
-{
- Mutex::Locker locker(m_map_mutex);
-
- uint32_t reason_why;
- ActiveCategoriesIterator begin, end = m_active_categories.end();
-
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- for (begin = m_active_categories.begin(); begin != end; begin++)
- {
- lldb::TypeCategoryImplSP category_sp = *begin;
- lldb::TypeSummaryImplSP current_format;
- if (log)
- log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s\n", category_sp->GetName());
- if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
- continue;
- return current_format;
- }
- if (log)
- log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP\n");
- return lldb::TypeSummaryImplSP();
-}
-
lldb::TypeSummaryImplSP
FormatManager::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
{
@@ -509,12 +216,12 @@ FormatManager::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
}
#ifndef LLDB_DISABLE_PYTHON
-lldb::TypeSyntheticImplSP
+lldb::ScriptedSyntheticChildrenSP
FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
{
if (!type_sp)
- return lldb::TypeSyntheticImplSP();
- lldb::TypeSyntheticImplSP synth_chosen_sp;
+ return lldb::ScriptedSyntheticChildrenSP();
+ lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
uint32_t num_categories = m_categories_map.GetCount();
lldb::TypeCategoryImplSP category_sp;
uint32_t prio_category = UINT32_MAX;
@@ -525,7 +232,7 @@ FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
category_sp = GetCategoryAtIndex(category_id);
if (category_sp->IsEnabled() == false)
continue;
- lldb::TypeSyntheticImplSP synth_current_sp((TypeSyntheticImpl*)category_sp->GetSyntheticForType(type_sp).get());
+ lldb::ScriptedSyntheticChildrenSP synth_current_sp((ScriptedSyntheticChildren*)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();
@@ -543,7 +250,7 @@ FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_s
if (!type_sp)
return lldb::SyntheticChildrenSP();
lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
- lldb::TypeSyntheticImplSP synth_sp = GetSyntheticForType(type_sp);
+ lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
if (filter_sp->GetRevision() > synth_sp->GetRevision())
return lldb::SyntheticChildrenSP(filter_sp.get());
else
@@ -551,88 +258,6 @@ FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_s
}
#endif
-#ifndef LLDB_DISABLE_PYTHON
-lldb::SyntheticChildrenSP
-CategoryMap::GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
-{
- Mutex::Locker locker(m_map_mutex);
-
- uint32_t reason_why;
-
- ActiveCategoriesIterator begin, end = m_active_categories.end();
-
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- for (begin = m_active_categories.begin(); begin != end; begin++)
- {
- lldb::TypeCategoryImplSP category_sp = *begin;
- lldb::SyntheticChildrenSP current_format;
- if (log)
- log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s\n", category_sp->GetName());
- if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
- continue;
- return current_format;
- }
- if (log)
- log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP\n");
- return lldb::SyntheticChildrenSP();
-}
-#endif
-
-void
-CategoryMap::LoopThrough(CallbackType callback, void* param)
-{
- if (callback)
- {
- Mutex::Locker locker(m_map_mutex);
-
- // loop through enabled categories in respective order
- {
- ActiveCategoriesIterator begin, end = m_active_categories.end();
- for (begin = m_active_categories.begin(); begin != end; begin++)
- {
- lldb::TypeCategoryImplSP category = *begin;
- ConstString type = ConstString(category->GetName());
- if (!callback(param, category))
- break;
- }
- }
-
- // loop through disabled categories in just any order
- {
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++)
- {
- if (pos->second->IsEnabled())
- continue;
- KeyType type = pos->first;
- if (!callback(param, pos->second))
- break;
- }
- }
- }
-}
-
-TypeCategoryImplSP
-CategoryMap::GetAtIndex (size_t index)
-{
- Mutex::Locker locker(m_map_mutex);
-
- if (index < m_map.size())
- {
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++)
- {
- if (index == 0)
- return pos->second;
- index--;
- }
- }
-
- return TypeCategoryImplSP();
-}
-
lldb::TypeCategoryImplSP
FormatManager::GetCategory (const ConstString& category_name,
bool can_create)
@@ -686,7 +311,103 @@ FormatManager::GetValidTypeName (const ConstString& type)
return ::GetValidTypeName_Impl(type);
}
-FormatManager::FormatManager() :
+ConstString
+GetTypeForCache (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ if (use_dynamic == lldb::eNoDynamicValues)
+ {
+ if (valobj.IsDynamic())
+ {
+ if (valobj.GetStaticValue())
+ return valobj.GetStaticValue()->GetQualifiedTypeName();
+ else
+ return ConstString();
+ }
+ else
+ return valobj.GetQualifiedTypeName();
+ }
+ if (valobj.IsDynamic())
+ return valobj.GetQualifiedTypeName();
+ if (valobj.GetDynamicValue(use_dynamic))
+ return valobj.GetDynamicValue(use_dynamic)->GetQualifiedTypeName();
+ return ConstString();
+}
+
+#define USE_CACHE 1
+lldb::TypeSummaryImplSP
+FormatManager::GetSummaryFormat (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ TypeSummaryImplSP retval;
+#if USE_CACHE
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+ ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
+ if (m_format_cache.GetSummary(valobj_type,retval))
+ return retval;
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
+ }
+#endif
+ retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
+#if USE_CACHE
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
+ m_format_cache.SetSummary(valobj_type,retval);
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+#endif
+#endif
+ return retval;
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+lldb::SyntheticChildrenSP
+FormatManager::GetSyntheticChildren (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ SyntheticChildrenSP retval;
+#if USE_CACHE
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+ ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Looking into cache for type %s\n", valobj_type.AsCString("<invalid>"));
+ if (m_format_cache.GetSynthetic(valobj_type,retval))
+ return retval;
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route\n");
+ }
+#endif
+ retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
+#if USE_CACHE
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s\n",retval.get(),valobj_type.AsCString("<invalid>"));
+ m_format_cache.SetSynthetic(valobj_type,retval);
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+#endif
+#endif
+ return retval;
+}
+#endif
+#undef USE_CACHE
+
+FormatManager::FormatManager() :
+ m_format_cache(),
m_value_nav("format",this),
m_named_summaries_map(this),
m_last_revision(0),
@@ -702,21 +423,20 @@ FormatManager::FormatManager() :
m_vectortypes_category_name(ConstString("VectorTypes")),
m_appkit_category_name(ConstString("AppKit"))
{
-
LoadSystemFormatters();
LoadLibStdcppFormatters();
LoadLibcxxFormatters();
LoadObjCFormatters();
- EnableCategory(m_objc_category_name,CategoryMap::Last);
- EnableCategory(m_corefoundation_category_name,CategoryMap::Last);
- EnableCategory(m_appkit_category_name,CategoryMap::Last);
- EnableCategory(m_coreservices_category_name,CategoryMap::Last);
- EnableCategory(m_coregraphics_category_name,CategoryMap::Last);
- EnableCategory(m_gnu_cpp_category_name,CategoryMap::Last);
- EnableCategory(m_libcxx_category_name,CategoryMap::Last);
- EnableCategory(m_vectortypes_category_name,CategoryMap::Last);
- EnableCategory(m_system_category_name,CategoryMap::Last);
+ EnableCategory(m_objc_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_corefoundation_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_appkit_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_coreservices_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_coregraphics_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_gnu_cpp_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_libcxx_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_system_category_name,TypeCategoryMap::Last);
}
static void
@@ -769,7 +489,7 @@ static void AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp,
CXXSyntheticChildren::CreateFrontEndCallback generator,
const char* description,
ConstString type_name,
- TypeSyntheticImpl::Flags flags)
+ ScriptedSyntheticChildren::Flags flags)
{
lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp);
@@ -822,13 +542,13 @@ FormatManager::LoadLibStdcppFormatters()
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
stl_summary_flags.SetDontShowChildren(false);
@@ -879,22 +599,22 @@ FormatManager::LoadLibcxxFormatters()
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::vector<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdvector_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::list<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdlist_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::map<.+> >(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdmap_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)shared_ptr<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdsharedptr_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)weak_ptr<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdsharedptr_SynthProvider")));
stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
@@ -1141,18 +861,18 @@ FormatManager::LoadObjCFormatters()
appkit_flags.SetDontShowChildren(true);
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags());
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("CFBagRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("__CFBag"), appkit_flags);
@@ -1182,15 +902,14 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
- AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSException.NSException_SummaryProvider", ConstString("NSException"), appkit_flags);
-
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSMachPort.NSMachPort_SummaryProvider", ConstString("NSMachPort"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSNotification"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSConcreteNotification"), appkit_flags);
AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags);
-
+ AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags);
+
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
@@ -1202,6 +921,7 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags);
+
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider", ConstString("NSSet"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider2", ConstString("CFSetRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider2", ConstString("CFMutableSetRef"), appkit_flags);
diff --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp
new file mode 100644
index 00000000000..ffbded40dba
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -0,0 +1,378 @@
+//===-- TypeCategory.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/DataFormatters/TypeCategory.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
+ ConstString name) :
+m_summary_nav(new SummaryNavigator("summary",clist)),
+m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
+m_filter_nav(new FilterNavigator("filter",clist)),
+m_regex_filter_nav(new RegexFilterNavigator("regex-filter",clist)),
+#ifndef LLDB_DISABLE_PYTHON
+m_synth_nav(new SynthNavigator("synth",clist)),
+m_regex_synth_nav(new RegexSynthNavigator("regex-synth",clist)),
+#endif
+m_enabled(false),
+m_change_listener(clist),
+m_mutex(Mutex::eMutexTypeRecursive),
+m_name(name)
+{}
+
+bool
+TypeCategoryImpl::Get (ValueObject& valobj,
+ lldb::TypeSummaryImplSP& entry,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t* reason)
+{
+ if (!IsEnabled())
+ return false;
+ if (GetSummaryNavigator()->Get(valobj, entry, use_dynamic, reason))
+ return true;
+ bool regex = GetRegexSummaryNavigator()->Get(valobj, entry, use_dynamic, reason);
+ if (regex && reason)
+ *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+ return regex;
+}
+
+bool
+TypeCategoryImpl::Get(ValueObject& valobj,
+ lldb::SyntheticChildrenSP& entry_sp,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t* reason)
+{
+ if (!IsEnabled())
+ return false;
+ TypeFilterImpl::SharedPointer filter_sp;
+ uint32_t reason_filter = 0;
+ bool regex_filter = false;
+ // first find both Filter and Synth, and then check which is most recent
+
+ if (!GetFilterNavigator()->Get(valobj, filter_sp, use_dynamic, &reason_filter))
+ regex_filter = GetRegexFilterNavigator()->Get (valobj, filter_sp, use_dynamic, &reason_filter);
+
+#ifndef LLDB_DISABLE_PYTHON
+ bool regex_synth = false;
+ uint32_t reason_synth = 0;
+ bool pick_synth = false;
+ ScriptedSyntheticChildren::SharedPointer synth;
+ if (!GetSyntheticNavigator()->Get(valobj, synth, use_dynamic, &reason_synth))
+ regex_synth = GetRegexSyntheticNavigator()->Get (valobj, synth, use_dynamic, &reason_synth);
+ if (!filter_sp.get() && !synth.get())
+ return false;
+ else if (!filter_sp.get() && synth.get())
+ pick_synth = true;
+
+ else if (filter_sp.get() && !synth.get())
+ pick_synth = false;
+
+ else /*if (filter_sp.get() && synth.get())*/
+ {
+ if (filter_sp->GetRevision() > synth->GetRevision())
+ pick_synth = false;
+ else
+ pick_synth = true;
+ }
+ if (pick_synth)
+ {
+ if (regex_synth && reason)
+ *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
+ entry_sp = synth;
+ return true;
+ }
+ else
+ {
+ if (regex_filter && reason)
+ *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
+ entry_sp = filter_sp;
+ return true;
+ }
+
+#else
+ if (filter_sp)
+ {
+ entry_sp = filter_sp;
+ return true;
+ }
+#endif
+
+ return false;
+
+}
+
+void
+TypeCategoryImpl::Clear (FormatCategoryItems items)
+{
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ m_summary_nav->Clear();
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ m_regex_summary_nav->Clear();
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ m_filter_nav->Clear();
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ m_regex_filter_nav->Clear();
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ m_synth_nav->Clear();
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ m_regex_synth_nav->Clear();
+#endif
+}
+
+bool
+TypeCategoryImpl::Delete (ConstString name,
+ FormatCategoryItems items)
+{
+ bool success = false;
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ success = m_summary_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ success = m_regex_summary_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ success = m_filter_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ success = m_regex_filter_nav->Delete(name) || success;
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ success = m_synth_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ success = m_regex_synth_nav->Delete(name) || success;
+#endif
+ return success;
+}
+
+uint32_t
+TypeCategoryImpl::GetCount (FormatCategoryItems items)
+{
+ uint32_t count = 0;
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ count += m_summary_nav->GetCount();
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ count += m_regex_summary_nav->GetCount();
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ count += m_filter_nav->GetCount();
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ count += m_regex_filter_nav->GetCount();
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ count += m_synth_nav->GetCount();
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ count += m_regex_synth_nav->GetCount();
+#endif
+ return count;
+}
+
+bool
+TypeCategoryImpl::AnyMatches(ConstString type_name,
+ FormatCategoryItems items,
+ bool only_enabled,
+ const char** matching_category,
+ FormatCategoryItems* matching_type)
+{
+ if (!IsEnabled() && only_enabled)
+ return false;
+
+ lldb::TypeSummaryImplSP summary;
+ TypeFilterImpl::SharedPointer filter;
+#ifndef LLDB_DISABLE_PYTHON
+ ScriptedSyntheticChildren::SharedPointer synth;
+#endif
+
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ {
+ if (m_summary_nav->Get(type_name, summary))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemSummary;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ {
+ if (m_regex_summary_nav->Get(type_name, summary))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemRegexSummary;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ {
+ if (m_filter_nav->Get(type_name, filter))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemFilter;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ {
+ if (m_regex_filter_nav->Get(type_name, filter))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemRegexFilter;
+ return true;
+ }
+ }
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ {
+ if (m_synth_nav->Get(type_name, synth))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemSynth;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ {
+ if (m_regex_synth_nav->Get(type_name, synth))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemRegexSynth;
+ return true;
+ }
+ }
+#endif
+ return false;
+}
+
+TypeCategoryImpl::SummaryNavigator::MapValueType
+TypeCategoryImpl::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;
+}
+
+TypeCategoryImpl::FilterNavigator::MapValueType
+TypeCategoryImpl::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;
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+TypeCategoryImpl::SynthNavigator::MapValueType
+TypeCategoryImpl::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;
+}
+#endif
+
+lldb::TypeNameSpecifierImplSP
+TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex (size_t index)
+{
+ if (index < m_summary_nav->GetCount())
+ return m_summary_nav->GetTypeNameSpecifierAtIndex(index);
+ else
+ return m_regex_summary_nav->GetTypeNameSpecifierAtIndex(index-m_summary_nav->GetCount());
+}
+
+TypeCategoryImpl::SummaryNavigator::MapValueType
+TypeCategoryImpl::GetSummaryAtIndex (size_t index)
+{
+ if (index < m_summary_nav->GetCount())
+ return m_summary_nav->GetAtIndex(index);
+ else
+ return m_regex_summary_nav->GetAtIndex(index-m_summary_nav->GetCount());
+}
+
+TypeCategoryImpl::FilterNavigator::MapValueType
+TypeCategoryImpl::GetFilterAtIndex (size_t index)
+{
+ if (index < m_filter_nav->GetCount())
+ return m_filter_nav->GetAtIndex(index);
+ else
+ return m_regex_filter_nav->GetAtIndex(index-m_filter_nav->GetCount());
+}
+
+lldb::TypeNameSpecifierImplSP
+TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex (size_t index)
+{
+ if (index < m_filter_nav->GetCount())
+ return m_filter_nav->GetTypeNameSpecifierAtIndex(index);
+ else
+ return m_regex_filter_nav->GetTypeNameSpecifierAtIndex(index-m_filter_nav->GetCount());
+}
+
+TypeCategoryImpl::SynthNavigator::MapValueType
+TypeCategoryImpl::GetSyntheticAtIndex (size_t index)
+{
+ if (index < m_synth_nav->GetCount())
+ return m_synth_nav->GetAtIndex(index);
+ else
+ return m_regex_synth_nav->GetAtIndex(index-m_synth_nav->GetCount());
+}
+
+lldb::TypeNameSpecifierImplSP
+TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex (size_t index)
+{
+ if (index < m_synth_nav->GetCount())
+ return m_synth_nav->GetTypeNameSpecifierAtIndex(index);
+ else
+ return m_regex_synth_nav->GetTypeNameSpecifierAtIndex(index - m_synth_nav->GetCount());
+}
+
+void
+TypeCategoryImpl::Enable (bool value, uint32_t position)
+{
+ Mutex::Locker locker(m_mutex);
+ 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
new file mode 100644
index 00000000000..6e66e6744b4
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -0,0 +1,283 @@
+//===-- TypeCategoryMap.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/DataFormatters/TypeCategoryMap.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+TypeCategoryMap::TypeCategoryMap (IFormatChangeListener* lst) :
+m_map_mutex(Mutex::eMutexTypeRecursive),
+listener(lst),
+m_map(),
+m_active_categories()
+{
+ ConstString default_cs("default");
+ lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
+ Add(default_cs,default_sp);
+ Enable(default_cs,First);
+}
+
+void
+TypeCategoryMap::Add (KeyType name, const ValueSP& entry)
+{
+ Mutex::Locker locker(m_map_mutex);
+ m_map[name] = entry;
+ if (listener)
+ listener->Changed();
+}
+
+bool
+TypeCategoryMap::Delete (KeyType name)
+{
+ Mutex::Locker locker(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ m_map.erase(name);
+ Disable(name);
+ if (listener)
+ listener->Changed();
+ return true;
+}
+
+bool
+TypeCategoryMap::Enable (KeyType category_name, Position pos)
+{
+ Mutex::Locker locker(m_map_mutex);
+ ValueSP category;
+ if (!Get(category_name,category))
+ return false;
+ return Enable(category, pos);
+}
+
+bool
+TypeCategoryMap::Disable (KeyType category_name)
+{
+ Mutex::Locker locker(m_map_mutex);
+ ValueSP category;
+ if (!Get(category_name,category))
+ return false;
+ return Disable(category);
+}
+
+bool
+TypeCategoryMap::Enable (ValueSP category, Position pos)
+{
+ Mutex::Locker locker(m_map_mutex);
+ if (category.get())
+ {
+ Position pos_w = pos;
+ if (pos == First || m_active_categories.size() == 0)
+ m_active_categories.push_front(category);
+ else if (pos == Last || pos == m_active_categories.size())
+ m_active_categories.push_back(category);
+ else if (pos < m_active_categories.size())
+ {
+ ActiveCategoriesList::iterator iter = m_active_categories.begin();
+ while (pos_w)
+ {
+ pos_w--,iter++;
+ }
+ m_active_categories.insert(iter,category);
+ }
+ else
+ return false;
+ category->Enable(true,
+ pos);
+ return true;
+ }
+ return false;
+}
+
+bool
+TypeCategoryMap::Disable (ValueSP category)
+{
+ Mutex::Locker locker(m_map_mutex);
+ if (category.get())
+ {
+ m_active_categories.remove_if(delete_matching_categories(category));
+ category->Disable();
+ return true;
+ }
+ return false;
+}
+
+void
+TypeCategoryMap::Clear ()
+{
+ Mutex::Locker locker(m_map_mutex);
+ m_map.clear();
+ m_active_categories.clear();
+ if (listener)
+ listener->Changed();
+}
+
+bool
+TypeCategoryMap::Get (KeyType name, ValueSP& entry)
+{
+ Mutex::Locker locker(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ entry = iter->second;
+ return true;
+}
+
+bool
+TypeCategoryMap::Get (uint32_t pos, ValueSP& entry)
+{
+ Mutex::Locker locker(m_map_mutex);
+ MapIterator iter = m_map.begin();
+ MapIterator end = m_map.end();
+ while (pos > 0)
+ {
+ iter++;
+ pos--;
+ if (iter == end)
+ return false;
+ }
+ entry = iter->second;
+ return false;
+}
+
+bool
+TypeCategoryMap::AnyMatches (ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items,
+ bool only_enabled,
+ const char** matching_category,
+ TypeCategoryImpl::FormatCategoryItems* matching_type)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ if (pos->second->AnyMatches(type_name,
+ items,
+ only_enabled,
+ matching_category,
+ matching_type))
+ return true;
+ }
+ return false;
+}
+
+lldb::TypeSummaryImplSP
+TypeCategoryMap::GetSummaryFormat (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ uint32_t reason_why;
+ ActiveCategoriesIterator begin, end = m_active_categories.end();
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+
+ for (begin = m_active_categories.begin(); begin != end; begin++)
+ {
+ lldb::TypeCategoryImplSP category_sp = *begin;
+ lldb::TypeSummaryImplSP current_format;
+ if (log)
+ log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s\n", category_sp->GetName());
+ if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
+ continue;
+ return current_format;
+ }
+ if (log)
+ log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP\n");
+ return lldb::TypeSummaryImplSP();
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+lldb::SyntheticChildrenSP
+TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ uint32_t reason_why;
+
+ ActiveCategoriesIterator begin, end = m_active_categories.end();
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+
+ for (begin = m_active_categories.begin(); begin != end; begin++)
+ {
+ lldb::TypeCategoryImplSP category_sp = *begin;
+ lldb::SyntheticChildrenSP current_format;
+ if (log)
+ log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s\n", category_sp->GetName());
+ if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
+ continue;
+ return current_format;
+ }
+ if (log)
+ log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP\n");
+ return lldb::SyntheticChildrenSP();
+}
+#endif
+
+void
+TypeCategoryMap::LoopThrough(CallbackType callback, void* param)
+{
+ if (callback)
+ {
+ Mutex::Locker locker(m_map_mutex);
+
+ // loop through enabled categories in respective order
+ {
+ ActiveCategoriesIterator begin, end = m_active_categories.end();
+ for (begin = m_active_categories.begin(); begin != end; begin++)
+ {
+ lldb::TypeCategoryImplSP category = *begin;
+ ConstString type = ConstString(category->GetName());
+ if (!callback(param, category))
+ break;
+ }
+ }
+
+ // loop through disabled categories in just any order
+ {
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ if (pos->second->IsEnabled())
+ continue;
+ KeyType type = pos->first;
+ if (!callback(param, pos->second))
+ break;
+ }
+ }
+ }
+}
+
+TypeCategoryImplSP
+TypeCategoryMap::GetAtIndex (uint32_t index)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ if (index < m_map.size())
+ {
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ if (index == 0)
+ return pos->second;
+ index--;
+ }
+ }
+
+ return TypeCategoryImplSP();
+}
diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
new file mode 100644
index 00000000000..1dda8bc1b02
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -0,0 +1,50 @@
+//===-- TypeFormat.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Core/Timer.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+TypeFormatImpl::TypeFormatImpl (lldb::Format f,
+ const Flags& flags) :
+m_flags(flags),
+m_format (f)
+{
+}
+
+std::string
+TypeFormatImpl::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf ("%s%s%s%s\n",
+ FormatManager::GetFormatAsCString (GetFormat()),
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "");
+ return sstr.GetString();
+}
+
diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/DataFormatters/TypeSummary.cpp
index cc25f38e561..8ead75a1953 100644
--- a/lldb/source/Core/FormatClasses.cpp
+++ b/lldb/source/DataFormatters/TypeSummary.cpp
@@ -1,4 +1,4 @@
-//===-- FormatClasses.cpp ----------------------------------------*- C++ -*-===//
+//===-- TypeSummary.cpp ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
// C Includes
// C++ Includes
@@ -20,9 +18,9 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
+#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/StackFrame.h"
@@ -31,43 +29,24 @@
using namespace lldb;
using namespace lldb_private;
-TypeFormatImpl::TypeFormatImpl (lldb::Format f,
- const Flags& flags) :
- m_flags(flags),
- m_format (f)
-{
-}
-
-std::string
-TypeFormatImpl::GetDescription()
-{
- StreamString sstr;
- sstr.Printf ("%s%s%s%s\n",
- FormatManager::GetFormatAsCString (GetFormat()),
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
- return sstr.GetString();
-}
-
-TypeSummaryImpl::TypeSummaryImpl(const TypeSummaryImpl::Flags& flags) :
- m_flags(flags)
+TypeSummaryImpl::TypeSummaryImpl (const TypeSummaryImpl::Flags& flags) :
+m_flags(flags)
{
}
-StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
- const char *format_cstr) :
- TypeSummaryImpl(flags),
- m_format()
+StringSummaryFormat::StringSummaryFormat (const TypeSummaryImpl::Flags& flags,
+ const char *format_cstr) :
+TypeSummaryImpl(flags),
+m_format()
{
- if (format_cstr)
- m_format.assign(format_cstr);
+ if (format_cstr)
+ m_format.assign(format_cstr);
}
bool
-StringSummaryFormat::FormatObject(ValueObject *valobj,
- std::string& retval)
+StringSummaryFormat::FormatObject (ValueObject *valobj,
+ std::string& retval)
{
if (!valobj)
{
@@ -144,7 +123,7 @@ StringSummaryFormat::FormatObject(ValueObject *valobj,
}
std::string
-StringSummaryFormat::GetDescription()
+StringSummaryFormat::GetDescription ()
{
StreamString sstr;
@@ -162,15 +141,15 @@ StringSummaryFormat::GetDescription()
CXXFunctionSummaryFormat::CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
Callback impl,
const char* description) :
- TypeSummaryImpl(flags),
- m_impl(impl),
- m_description(description ? description : "")
+TypeSummaryImpl(flags),
+m_impl(impl),
+m_description(description ? description : "")
{
}
-
+
bool
-CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj,
- std::string& dest)
+CXXFunctionSummaryFormat::FormatObject (ValueObject *valobj,
+ std::string& dest)
{
dest.clear();
StreamString stream;
@@ -181,7 +160,7 @@ CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj,
}
std::string
-CXXFunctionSummaryFormat::GetDescription()
+CXXFunctionSummaryFormat::GetDescription ()
{
StreamString sstr;
sstr.Printf ("`%s (%p) `%s%s%s%s%s%s%s", m_description.c_str(),m_impl,
@@ -198,51 +177,51 @@ CXXFunctionSummaryFormat::GetDescription()
#ifndef LLDB_DISABLE_PYTHON
-ScriptSummaryFormat::ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
- const char * function_name,
- const char * python_script) :
- TypeSummaryImpl(flags),
- m_function_name(),
- m_python_script(),
- m_script_function_sp()
+ScriptSummaryFormat::ScriptSummaryFormat (const TypeSummaryImpl::Flags& flags,
+ const char * function_name,
+ const char * python_script) :
+TypeSummaryImpl(flags),
+m_function_name(),
+m_python_script(),
+m_script_function_sp()
{
- if (function_name)
- m_function_name.assign(function_name);
- if (python_script)
- m_python_script.assign(python_script);
+ if (function_name)
+ m_function_name.assign(function_name);
+ if (python_script)
+ m_python_script.assign(python_script);
}
bool
-ScriptSummaryFormat::FormatObject(ValueObject *valobj,
- std::string& retval)
+ScriptSummaryFormat::FormatObject (ValueObject *valobj,
+ std::string& retval)
{
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
-
+
TargetSP target_sp(valobj->GetTargetSP());
-
+
if (!target_sp)
{
retval.assign("error: no target");
return false;
}
-
+
ScriptInterpreter *script_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
-
+
if (!script_interpreter)
{
retval.assign("error: no ScriptInterpreter");
return false;
}
-
+
return script_interpreter->GetScriptedSummary(m_function_name.c_str(),
valobj->GetSP(),
m_script_function_sp,
retval);
-
+
}
std::string
-ScriptSummaryFormat::GetDescription()
+ScriptSummaryFormat::GetDescription ()
{
StreamString sstr;
sstr.Printf ("%s%s%s%s%s%s%s\n%s", Cascades() ? "" : " (not cascading)",
@@ -258,152 +237,3 @@ ScriptSummaryFormat::GetDescription()
}
#endif // #ifndef LLDB_DISABLE_PYTHON
-
-std::string
-TypeFilterImpl::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s {\n",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
-
- for (int i = 0; i < GetCount(); i++)
- {
- sstr.Printf(" %s\n",
- GetExpressionPathAtIndex(i));
- }
-
- sstr.Printf("}");
- return sstr.GetString();
-}
-
-std::string
-CXXSyntheticChildren::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s Generator at %p - %s\n",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "",
- m_create_callback,
- m_description.c_str());
-
- return sstr.GetString();
-}
-
-std::string
-SyntheticArrayView::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s {\n",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
-
- SyntheticArrayRange* ptr = &m_head;
- while (ptr && ptr != m_tail)
- {
- if (ptr->GetLow() == ptr->GetHigh())
- sstr.Printf(" [%d]\n",
- ptr->GetLow());
- else
- sstr.Printf(" [%d-%d]\n",
- ptr->GetLow(),
- ptr->GetHigh());
- ptr = ptr->GetNext();
- }
-
- sstr.Printf("}");
- return sstr.GetString();
-}
-
-#ifndef LLDB_DISABLE_PYTHON
-
-TypeSyntheticImpl::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) :
- SyntheticChildrenFrontEnd(backend),
- m_python_class(pclass),
- m_wrapper_sp(),
- m_interpreter(NULL)
-{
- if (backend == LLDB_INVALID_UID)
- return;
-
- TargetSP target_sp = backend.GetTargetSP();
-
- if (!target_sp)
- return;
-
- m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
-
- if (m_interpreter != NULL)
- m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
-}
-
-TypeSyntheticImpl::FrontEnd::~FrontEnd()
-{
-}
-
-lldb::ValueObjectSP
-TypeSyntheticImpl::FrontEnd::GetChildAtIndex (size_t idx)
-{
- if (!m_wrapper_sp || !m_interpreter)
- return lldb::ValueObjectSP();
-
- return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
-}
-
-std::string
-TypeSyntheticImpl::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s Python class %s",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "",
- m_python_class.c_str());
-
- return sstr.GetString();
-}
-
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
-int
-SyntheticArrayView::GetRealIndexForIndex(size_t i)
-{
- if (i >= GetCount())
- return -1;
-
- SyntheticArrayRange* ptr = &m_head;
-
- int residual = i;
-
- while(ptr && ptr != m_tail)
- {
- if (residual >= ptr->GetSelfCount())
- {
- residual -= ptr->GetSelfCount();
- ptr = ptr->GetNext();
- }
-
- return ptr->GetLow() + residual;
- }
-
- return -1;
-}
-
-uint32_t
-SyntheticArrayView::FrontEnd::GetIndexOfChildWithName (const ConstString &name_cs)
-{
- const char* name_cstr = name_cs.GetCString();
- if (*name_cstr != '[')
- return UINT32_MAX;
- std::string name(name_cstr+1);
- if (name[name.size()-1] != ']')
- return UINT32_MAX;
- name = name.erase(name.size()-1,1);
- int index = Args::StringToSInt32 (name.c_str(), -1);
- if (index < 0)
- return UINT32_MAX;
- return index;
-}
diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp
new file mode 100644
index 00000000000..e2e0bffb5b0
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeSynthetic.cpp
@@ -0,0 +1,112 @@
+//===-- TypeSynthetic.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+std::string
+TypeFilterImpl::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s {\n",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "");
+
+ for (int i = 0; i < GetCount(); i++)
+ {
+ sstr.Printf(" %s\n",
+ GetExpressionPathAtIndex(i));
+ }
+
+ sstr.Printf("}");
+ return sstr.GetString();
+}
+
+std::string
+CXXSyntheticChildren::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s Generator at %p - %s\n",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "",
+ m_create_callback,
+ m_description.c_str());
+
+ return sstr.GetString();
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+
+ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) :
+SyntheticChildrenFrontEnd(backend),
+m_python_class(pclass),
+m_wrapper_sp(),
+m_interpreter(NULL)
+{
+ if (backend == LLDB_INVALID_UID)
+ return;
+
+ TargetSP target_sp = backend.GetTargetSP();
+
+ if (!target_sp)
+ return;
+
+ m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+
+ if (m_interpreter != NULL)
+ m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
+}
+
+ScriptedSyntheticChildren::FrontEnd::~FrontEnd()
+{
+}
+
+lldb::ValueObjectSP
+ScriptedSyntheticChildren::FrontEnd::GetChildAtIndex (size_t idx)
+{
+ if (!m_wrapper_sp || !m_interpreter)
+ return lldb::ValueObjectSP();
+
+ return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
+}
+
+std::string
+ScriptedSyntheticChildren::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s Python class %s",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "",
+ m_python_class.c_str());
+
+ return sstr.GetString();
+}
+
+#endif // #ifndef LLDB_DISABLE_PYTHON
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp
index 006e7c8e73f..76aa316c6ff 100644
--- a/lldb/source/Interpreter/Args.cpp
+++ b/lldb/source/Interpreter/Args.cpp
@@ -16,10 +16,10 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp
index 204270fa584..a757817e935 100644
--- a/lldb/source/Interpreter/CommandObjectScript.cpp
+++ b/lldb/source/Interpreter/CommandObjectScript.cpp
@@ -16,13 +16,14 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Interpreter/Args.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+
+#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp
index 891e19ac577..316747eff03 100644
--- a/lldb/source/Interpreter/OptionGroupVariable.cpp
+++ b/lldb/source/Interpreter/OptionGroupVariable.cpp
@@ -15,10 +15,10 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Error.h"
-#include "lldb/Target/Target.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Target/Target.h"
#include "lldb/Utility/Utils.h"
using namespace lldb;
diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp
index 49984bb28e5..92fedffe75e 100644
--- a/lldb/source/Interpreter/OptionValueArch.cpp
+++ b/lldb/source/Interpreter/OptionValueArch.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index 7806856df52..61f8aba431a 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -16,8 +16,8 @@
// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/OptionValueString.h"
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp
index 96bc0e0bccc..c1bcae2fc6c 100644
--- a/lldb/source/Interpreter/OptionValueFileSpec.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
diff --git a/lldb/source/Interpreter/OptionValueFormat.cpp b/lldb/source/Interpreter/OptionValueFormat.cpp
index cba407befc1..34d36725fbb 100644
--- a/lldb/source/Interpreter/OptionValueFormat.cpp
+++ b/lldb/source/Interpreter/OptionValueFormat.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/Stream.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index 782b74a43fe..71a6073de03 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -49,13 +49,26 @@ AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process) :
{
}
+// for V1 runtime we just try to return a class name as that is the minimum level of support
+// required for the data formatters to work
bool
AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address)
{
- return false;
+ class_type_or_name.Clear();
+ if (CouldHaveDynamicValue(in_value))
+ {
+ auto class_descriptor(GetClassDescriptor(in_value));
+ if (class_descriptor && class_descriptor->IsValid() && class_descriptor->GetClassName())
+ {
+ const addr_t object_ptr = in_value.GetPointerValue();
+ address.SetRawAddress(object_ptr);
+ class_type_or_name.SetName(class_descriptor->GetClassName());
+ }
+ }
+ return class_type_or_name.IsEmpty() == false;
}
//------------------------------------------------------------------
diff --git a/lldb/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py b/lldb/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py
index aeffd6ba2fb..2205dfd4e7e 100644
--- a/lldb/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py
+++ b/lldb/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py
@@ -69,6 +69,7 @@ class DataFormatterRdar12437442TestCase(TestBase):
self.assertTrue(id_x.GetSummary() == '@"5 objects"', "array does not get correct summary")
self.runCmd("next")
+ self.runCmd("frame select 0")
id_x = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable("x")
id_x.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
OpenPOWER on IntegriCloud