<rdar://problem/10062621>

New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
 SBTypeCategory
 SBTypeFilter
 SBTypeFormat
 SBTypeSummary
 SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.

llvm-svn: 150558
This commit is contained in:
Enrico Granata 2012-02-15 02:34:21 +00:00
parent b228a86fcf
commit 061858ce61
44 changed files with 4423 additions and 492 deletions

View File

@ -241,6 +241,36 @@ public:
void
SetCloseInputOnEOF (bool b);
SBTypeCategory
GetCategory (const char* category_name);
SBTypeCategory
CreateCategory (const char* category_name);
bool
DeleteCategory (const char* category_name);
uint32_t
GetNumCategories ();
SBTypeCategory
GetCategoryAtIndex (uint32_t);
SBTypeCategory
GetDefaultCategory();
SBTypeFormat
GetFormatForType (SBTypeNameSpecifier);
SBTypeSummary
GetSummaryForType (SBTypeNameSpecifier);
SBTypeFilter
GetFilterForType (SBTypeNameSpecifier);
SBTypeSynthetic
GetSyntheticForType (SBTypeNameSpecifier);
private:
friend class SBInputReader;

View File

@ -59,6 +59,12 @@ class SBSymbolContextList;
class SBTarget;
class SBThread;
class SBType;
class SBTypeCategory;
class SBTypeFilter;
class SBTypeFormat;
class SBTypeNameSpecifier;
class SBTypeSummary;
class SBTypeSynthetic;
class SBTypeList;
class SBValue;
class SBValueList;

View File

@ -0,0 +1,150 @@
//===-- SBTypeCategory.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_SBTypeCategory_h_
#define LLDB_SBTypeCategory_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTypeCategory
{
public:
SBTypeCategory();
SBTypeCategory (const lldb::SBTypeCategory &rhs);
~SBTypeCategory ();
bool
IsValid() const;
bool
GetEnabled ();
void
SetEnabled (bool);
const char*
GetName();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
uint32_t
GetNumFormats ();
uint32_t
GetNumSummaries ();
uint32_t
GetNumFilters ();
uint32_t
GetNumSynthetics ();
SBTypeNameSpecifier
GetTypeNameSpecifierForFilterAtIndex (uint32_t);
SBTypeNameSpecifier
GetTypeNameSpecifierForFormatAtIndex (uint32_t);
SBTypeNameSpecifier
GetTypeNameSpecifierForSummaryAtIndex (uint32_t);
SBTypeNameSpecifier
GetTypeNameSpecifierForSyntheticAtIndex (uint32_t);
SBTypeFilter
GetFilterForType (SBTypeNameSpecifier);
SBTypeFormat
GetFormatForType (SBTypeNameSpecifier);
SBTypeSummary
GetSummaryForType (SBTypeNameSpecifier);
SBTypeSynthetic
GetSyntheticForType (SBTypeNameSpecifier);
SBTypeFilter
GetFilterAtIndex (uint32_t);
SBTypeFormat
GetFormatAtIndex (uint32_t);
SBTypeSummary
GetSummaryAtIndex (uint32_t);
SBTypeSynthetic
GetSyntheticAtIndex (uint32_t);
bool
AddTypeFormat (SBTypeNameSpecifier,
SBTypeFormat);
bool
DeleteTypeFormat (SBTypeNameSpecifier);
bool
AddTypeSummary (SBTypeNameSpecifier,
SBTypeSummary);
bool
DeleteTypeSummary (SBTypeNameSpecifier);
bool
AddTypeFilter (SBTypeNameSpecifier,
SBTypeFilter);
bool
DeleteTypeFilter (SBTypeNameSpecifier);
bool
AddTypeSynthetic (SBTypeNameSpecifier,
SBTypeSynthetic);
bool
DeleteTypeSynthetic (SBTypeNameSpecifier);
lldb::SBTypeCategory &
operator = (const lldb::SBTypeCategory &rhs);
bool
operator == (lldb::SBTypeCategory &rhs);
bool
operator != (lldb::SBTypeCategory &rhs);
protected:
friend class SBDebugger;
lldb::TypeCategoryImplSP
GetSP ();
void
SetSP (const lldb::TypeCategoryImplSP &typecategory_impl_sp);
TypeCategoryImplSP m_opaque_sp;
SBTypeCategory (const lldb::TypeCategoryImplSP &);
SBTypeCategory (const char*);
bool
IsDefaultCategory();
};
} // namespace lldb
#endif // LLDB_SBTypeCategory_h_

View File

@ -0,0 +1,91 @@
//===-- SBTypeFilter.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_SBTypeFilter_h_
#define LLDB_SBTypeFilter_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTypeFilter
{
public:
SBTypeFilter();
SBTypeFilter (uint32_t options); // see lldb::eTypeOption values
SBTypeFilter (const lldb::SBTypeFilter &rhs);
~SBTypeFilter ();
bool
IsValid() const;
uint32_t
GetNumberOfExpressionPaths ();
const char*
GetExpressionPathAtIndex (uint32_t i);
bool
ReplaceExpressionPathAtIndex (uint32_t i, const char* item);
void
AppendExpressionPath (const char* item);
void
Clear();
uint32_t
GetOptions();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeFilter &
operator = (const lldb::SBTypeFilter &rhs);
bool
IsEqualTo (lldb::SBTypeFilter &rhs);
bool
operator == (lldb::SBTypeFilter &rhs);
bool
operator != (lldb::SBTypeFilter &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
lldb::TypeFilterImplSP
GetSP ();
void
SetSP (const lldb::TypeFilterImplSP &typefilter_impl_sp);
lldb::TypeFilterImplSP m_opaque_sp;
SBTypeFilter (const lldb::TypeFilterImplSP &);
bool
CopyOnWrite_Impl();
};
} // namespace lldb
#endif // LLDB_SBTypeFilter_h_

View File

@ -0,0 +1,83 @@
//===-- SBTypeFormat.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_SBTypeFormat_h_
#define LLDB_SBTypeFormat_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTypeFormat
{
public:
SBTypeFormat();
SBTypeFormat (lldb::Format format,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeFormat (const lldb::SBTypeFormat &rhs);
~SBTypeFormat ();
bool
IsValid() const;
lldb::Format
GetFormat ();
uint32_t
GetOptions();
void
SetFormat (lldb::Format);
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeFormat &
operator = (const lldb::SBTypeFormat &rhs);
bool
IsEqualTo (lldb::SBTypeFormat &rhs);
bool
operator == (lldb::SBTypeFormat &rhs);
bool
operator != (lldb::SBTypeFormat &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
lldb::TypeFormatImplSP
GetSP ();
void
SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp);
lldb::TypeFormatImplSP m_opaque_sp;
SBTypeFormat (const lldb::TypeFormatImplSP &);
bool
CopyOnWrite_Impl();
};
} // namespace lldb
#endif // LLDB_SBTypeFormat_h_

View File

@ -0,0 +1,71 @@
//===-- SBTypeNameSpecifier.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_SBTypeNameSpecifier_h_
#define LLDB_SBTypeNameSpecifier_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTypeNameSpecifier
{
public:
SBTypeNameSpecifier();
SBTypeNameSpecifier (const char* name,
bool is_regex = false);
SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs);
~SBTypeNameSpecifier ();
bool
IsValid() const;
const char*
GetName();
bool
IsRegex();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeNameSpecifier &
operator = (const lldb::SBTypeNameSpecifier &rhs);
bool
IsEqualTo (lldb::SBTypeNameSpecifier &rhs);
bool
operator == (lldb::SBTypeNameSpecifier &rhs);
bool
operator != (lldb::SBTypeNameSpecifier &rhs);
protected:
friend class SBTypeCategory;
lldb::TypeNameSpecifierImplSP
GetSP ();
void
SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
lldb::TypeNameSpecifierImplSP m_opaque_sp;
SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &);
};
} // namespace lldb
#endif // LLDB_SBTypeNameSpecifier_h_

View File

@ -0,0 +1,110 @@
//===-- SBTypeSummary.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_SBTypeSummary_h_
#define LLDB_SBTypeSummary_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTypeSummary
{
public:
SBTypeSummary();
static SBTypeSummary
CreateWithSummaryString (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary
CreateWithFunctionName (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSummary
CreateWithScriptCode (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeSummary (const lldb::SBTypeSummary &rhs);
~SBTypeSummary ();
bool
IsValid() const;
bool
IsFunctionCode();
bool
IsFunctionName();
bool
IsSummaryString();
const char*
GetData ();
void
SetSummaryString (const char* data);
void
SetFunctionName (const char* data);
void
SetFunctionCode (const char* data);
uint32_t
GetOptions ();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeSummary &
operator = (const lldb::SBTypeSummary &rhs);
bool
IsEqualTo (lldb::SBTypeSummary &rhs);
bool
operator == (lldb::SBTypeSummary &rhs);
bool
operator != (lldb::SBTypeSummary &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
lldb::TypeSummaryImplSP
GetSP ();
void
SetSP (const lldb::TypeSummaryImplSP &typefilter_impl_sp);
lldb::TypeSummaryImplSP m_opaque_sp;
SBTypeSummary (const lldb::TypeSummaryImplSP &);
bool
CopyOnWrite_Impl();
bool
ChangeSummaryType (bool want_script);
};
} // namespace lldb
#endif // LLDB_SBTypeSummary_h_

View File

@ -0,0 +1,97 @@
//===-- SBTypeSynthetic.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_SBTypeSynthetic_h_
#define LLDB_SBTypeSynthetic_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTypeSynthetic
{
public:
SBTypeSynthetic();
static SBTypeSynthetic
CreateWithClassName (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
static SBTypeSynthetic
CreateWithScriptCode (const char* data,
uint32_t options = 0); // see lldb::eTypeOption values
SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs);
~SBTypeSynthetic ();
bool
IsValid() const;
bool
IsClassCode();
bool
IsClassName();
const char*
GetData ();
void
SetClassName (const char* data);
void
SetClassCode (const char* data);
uint32_t
GetOptions ();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
lldb::SBTypeSynthetic &
operator = (const lldb::SBTypeSynthetic &rhs);
bool
IsEqualTo (lldb::SBTypeSynthetic &rhs);
bool
operator == (lldb::SBTypeSynthetic &rhs);
bool
operator != (lldb::SBTypeSynthetic &rhs);
protected:
friend class SBDebugger;
friend class SBTypeCategory;
lldb::TypeSyntheticImplSP
GetSP ();
void
SetSP (const lldb::TypeSyntheticImplSP &typefilter_impl_sp);
lldb::TypeSyntheticImplSP m_opaque_sp;
SBTypeSynthetic (const lldb::TypeSyntheticImplSP &);
bool
CopyOnWrite_Impl();
};
} // namespace lldb
#endif // LLDB_SBTypeSynthetic_h_

View File

@ -47,11 +47,14 @@ public:
class ValueFormats
{
public:
static lldb::ValueFormatSP
static lldb::TypeFormatImplSP
GetFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic);
static lldb::TypeFormatImplSP
GetFormat (const ConstString &type);
static void
Add (const ConstString &type, const lldb::ValueFormatSP &entry);
Add (const ConstString &type, const lldb::TypeFormatImplSP &entry);
static bool
Delete (const ConstString &type);
@ -60,13 +63,19 @@ public:
Clear ();
static void
LoopThrough (ValueFormat::ValueCallback callback, void* callback_baton);
LoopThrough (TypeFormatImpl::ValueCallback callback, void* callback_baton);
static uint32_t
GetCount ();
static lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierForFormatAtIndex (uint32_t);
static lldb::TypeFormatImplSP
GetFormatAtIndex (uint32_t);
};
static lldb::SummaryFormatSP
static lldb::TypeSummaryImplSP
GetSummaryFormat(ValueObject& valobj,
lldb::DynamicValueType use_dynamic);
@ -76,19 +85,19 @@ public:
static bool
AnyMatches(ConstString type_name,
FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
bool only_enabled = true,
const char** matching_category = NULL,
FormatCategory::FormatCategoryItems* matching_type = NULL);
TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
class NamedSummaryFormats
{
public:
static bool
GetSummaryFormat (const ConstString &type, lldb::SummaryFormatSP &entry);
GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry);
static void
Add (const ConstString &type, const lldb::SummaryFormatSP &entry);
Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry);
static bool
Delete (const ConstString &type);
@ -97,7 +106,7 @@ public:
Clear ();
static void
LoopThrough (SummaryFormat::SummaryCallback callback, void* callback_baton);
LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton);
static uint32_t
GetCount ();
@ -108,8 +117,10 @@ public:
public:
static bool
GetCategory (const ConstString &category, lldb::FormatCategorySP &entry);
GetCategory (const ConstString &category,
lldb::TypeCategoryImplSP &entry,
bool allow_create = true);
static void
Add (const ConstString &category);
@ -120,19 +131,30 @@ public:
Clear ();
static void
Clear (ConstString &category);
Clear (const ConstString &category);
static void
Enable (ConstString& category);
Enable (const ConstString& category,
CategoryMap::Position = CategoryMap::Default);
static void
Disable (ConstString& category);
Disable (const ConstString& category);
static void
Enable (const lldb::TypeCategoryImplSP& category,
CategoryMap::Position = CategoryMap::Default);
static void
Disable (const lldb::TypeCategoryImplSP& category);
static void
LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
static uint32_t
GetCount ();
static lldb::TypeCategoryImplSP
GetCategoryAtIndex (uint32_t);
};
};

View File

@ -450,6 +450,12 @@ public:
static lldb::DebuggerSP
FindDebuggerWithInstanceName (const ConstString &instance_name);
static uint32_t
GetNumDebuggers();
static lldb::DebuggerSP
GetDebuggerAtIndex (uint32_t);
static bool
FormatPrompt (const char *format,

File diff suppressed because it is too large Load Diff

View File

@ -34,19 +34,19 @@ namespace lldb_private {
class CategoryMap;
class FormatCategory
class TypeCategoryImpl
{
private:
typedef FormatNavigator<ConstString, SummaryFormat> SummaryNavigator;
typedef FormatNavigator<lldb::RegularExpressionSP, SummaryFormat> RegexSummaryNavigator;
typedef FormatNavigator<ConstString, TypeSummaryImpl> SummaryNavigator;
typedef FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl> RegexSummaryNavigator;
typedef FormatNavigator<ConstString, SyntheticFilter> FilterNavigator;
typedef FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter> RegexFilterNavigator;
typedef FormatNavigator<ConstString, TypeFilterImpl> FilterNavigator;
typedef FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl> RegexFilterNavigator;
#ifndef LLDB_DISABLE_PYTHON
typedef FormatNavigator<ConstString, SyntheticScriptProvider> SynthNavigator;
typedef FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider> RegexSynthNavigator;
typedef FormatNavigator<ConstString, TypeSyntheticImpl> SynthNavigator;
typedef FormatNavigator<lldb::RegularExpressionSP, TypeSyntheticImpl> RegexSynthNavigator;
#endif // #ifndef LLDB_DISABLE_PYTHON
typedef SummaryNavigator::MapType SummaryMap;
@ -61,7 +61,7 @@ private:
public:
typedef uint16_t FormatCategoryItems;
static const uint16_t ALL_ITEM_TYPES = 0xFFFF;
static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
typedef SummaryNavigator::SharedPointer SummaryNavigatorSP;
typedef RegexSummaryNavigator::SharedPointer RegexSummaryNavigatorSP;
@ -72,8 +72,8 @@ public:
typedef RegexSynthNavigator::SharedPointer RegexSynthNavigatorSP;
#endif // #ifndef LLDB_DISABLE_PYTHON
FormatCategory (IFormatChangeListener* clist,
std::string name);
TypeCategoryImpl (IFormatChangeListener* clist,
ConstString name);
SummaryNavigatorSP
GetSummaryNavigator ()
@ -98,6 +98,42 @@ public:
{
return RegexFilterNavigatorSP(m_regex_filter_nav);
}
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierForSummaryAtIndex (uint32_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 (uint32_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 (uint32_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 (uint32_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
@ -111,6 +147,25 @@ public:
{
return RegexSynthNavigatorSP(m_regex_synth_nav);
}
SynthNavigator::MapValueType
GetSyntheticAtIndex (uint32_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 (uint32_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
@ -118,10 +173,19 @@ public:
{
return m_enabled;
}
uint32_t
GetEnabledPosition()
{
if (m_enabled == false)
return UINT32_MAX;
else
return m_enabled_position;
}
bool
Get (ValueObject& valobj,
lldb::SummaryFormatSP& entry,
lldb::TypeSummaryImplSP& entry,
lldb::DynamicValueType use_dynamic,
uint32_t* reason = NULL);
@ -141,10 +205,10 @@ public:
uint32_t
GetCount (FormatCategoryItems items = ALL_ITEM_TYPES);
std::string
const char*
GetName ()
{
return m_name;
return m_name.GetCString();
}
bool
@ -154,7 +218,7 @@ public:
const char** matching_category = NULL,
FormatCategoryItems* matching_type = NULL);
typedef SHARED_PTR(FormatCategory) SharedPointer;
typedef SHARED_PTR(TypeCategoryImpl) SharedPointer;
private:
SummaryNavigator::SharedPointer m_summary_nav;
@ -172,13 +236,17 @@ private:
Mutex m_mutex;
std::string m_name;
ConstString m_name;
uint32_t m_enabled_position;
void
Enable (bool value = true)
Enable (bool value,
uint32_t position)
{
Mutex::Locker(m_mutex);
m_enabled = value;
m_enabled = value;
m_enabled_position = position;
if (m_change_listener)
m_change_listener->Changed();
}
@ -186,20 +254,20 @@ private:
void
Disable ()
{
Enable(false);
Enable(false, UINT32_MAX);
}
friend class CategoryMap;
friend class FormatNavigator<ConstString, SummaryFormat>;
friend class FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>;
friend class FormatNavigator<ConstString, TypeSummaryImpl>;
friend class FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl>;
friend class FormatNavigator<ConstString, SyntheticFilter>;
friend class FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>;
friend class FormatNavigator<ConstString, TypeFilterImpl>;
friend class FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl>;
#ifndef LLDB_DISABLE_PYTHON
friend class FormatNavigator<ConstString, SyntheticScriptProvider>;
friend class FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>;
friend class FormatNavigator<ConstString, TypeSyntheticImpl>;
friend class FormatNavigator<lldb::RegularExpressionSP, TypeSyntheticImpl>;
#endif // #ifndef LLDB_DISABLE_PYTHON
@ -209,15 +277,20 @@ class CategoryMap
{
private:
typedef ConstString KeyType;
typedef FormatCategory ValueType;
typedef TypeCategoryImpl ValueType;
typedef ValueType::SharedPointer ValueSP;
typedef std::list<lldb::FormatCategorySP> ActiveCategoriesList;
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),
@ -225,6 +298,10 @@ public:
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
@ -251,26 +328,68 @@ public:
return true;
}
void
Enable (KeyType category_name)
bool
Enable (KeyType category_name,
Position pos = Default)
{
Mutex::Locker(m_map_mutex);
ValueSP category;
if (!Get(category_name,category))
return;
category->Enable();
m_active_categories.push_front(category);
return false;
return Enable(category, pos);
}
void
bool
Disable (KeyType category_name)
{
Mutex::Locker(m_map_mutex);
ValueSP category;
if (!Get(category_name,category))
return;
category->Disable();
m_active_categories.remove_if(delete_matching_categories(category));
return false;
return Disable(category);
}
bool
Enable (ValueSP category,
Position pos = Default)
{
Mutex::Locker(m_map_mutex);
if (category.get())
{
Position pos_w = pos;
if (pos == First)
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(m_map_mutex);
if (category.get())
{
m_active_categories.remove_if(delete_matching_categories(category));
category->Disable();
return true;
}
return false;
}
void
@ -295,15 +414,36 @@ public:
return true;
}
bool
Get (uint32_t pos,
ValueSP& entry)
{
Mutex::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 (uint32_t);
bool
AnyMatches (ConstString type_name,
FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
bool only_enabled = true,
const char** matching_category = NULL,
FormatCategory::FormatCategoryItems* matching_type = NULL);
TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
uint32_t
GetCount ()
@ -311,7 +451,7 @@ public:
return m_map.size();
}
lldb::SummaryFormatSP
lldb::TypeSummaryImplSP
GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic);
@ -323,12 +463,12 @@ private:
class delete_matching_categories
{
lldb::FormatCategorySP ptr;
lldb::TypeCategoryImplSP ptr;
public:
delete_matching_categories(lldb::FormatCategorySP p) : ptr(p)
delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
{}
bool operator()(const lldb::FormatCategorySP& other)
bool operator()(const lldb::TypeCategoryImplSP& other)
{
return ptr.get() == other.get();
}
@ -361,9 +501,9 @@ private:
class FormatManager : public IFormatChangeListener
{
typedef FormatNavigator<ConstString, ValueFormat> ValueNavigator;
typedef FormatNavigator<ConstString, TypeFormatImpl> ValueNavigator;
typedef ValueNavigator::MapType ValueMap;
typedef FormatMap<ConstString, SummaryFormat> NamedSummariesMap;
typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
typedef CategoryMap::MapType::iterator CategoryMapIterator;
public:
@ -384,9 +524,11 @@ public:
}
void
EnableCategory (const ConstString& category_name)
EnableCategory (const ConstString& category_name,
CategoryMap::Position pos = CategoryMap::Default)
{
m_categories_map.Enable(category_name);
m_categories_map.Enable(category_name,
pos);
}
void
@ -395,6 +537,20 @@ public:
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)
{
@ -413,13 +569,19 @@ public:
return m_categories_map.GetCount();
}
lldb::TypeCategoryImplSP
GetCategoryAtIndex (uint32_t index)
{
return m_categories_map.GetAtIndex(index);
}
void
LoopThroughCategories (CategoryCallback callback, void* param)
{
m_categories_map.LoopThrough(callback, param);
}
lldb::FormatCategorySP
lldb::TypeCategoryImplSP
GetCategory (const char* category_name = NULL,
bool can_create = true)
{
@ -428,11 +590,11 @@ public:
return GetCategory(ConstString(category_name));
}
lldb::FormatCategorySP
lldb::TypeCategoryImplSP
GetCategory (const ConstString& category_name,
bool can_create = true);
lldb::SummaryFormatSP
lldb::TypeSummaryImplSP
GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
@ -448,10 +610,10 @@ public:
bool
AnyMatches (ConstString type_name,
FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
bool only_enabled = true,
const char** matching_category = NULL,
FormatCategory::FormatCategoryItems* matching_type = NULL)
TypeCategoryImpl::FormatCategoryItems* matching_type = NULL)
{
return m_categories_map.AnyMatches(type_name,
items,

View File

@ -128,9 +128,9 @@ public:
const ValueSP& entry)
{
if (listener)
entry->m_my_revision = listener->GetCurrentRevision();
entry->GetRevision() = listener->GetCurrentRevision();
else
entry->m_my_revision = 0;
entry->GetRevision() = 0;
Mutex::Locker(m_map_mutex);
m_map[name] = entry;
@ -194,6 +194,38 @@ public:
return m_map.size();
}
ValueSP
GetValueAtIndex (uint32_t index)
{
Mutex::Locker(m_map_mutex);
MapIterator iter = m_map.begin();
MapIterator end = m_map.end();
while (index > 0)
{
iter++;
index--;
if (end == iter)
return ValueSP();
}
return iter->second;
}
KeyType
GetKeyAtIndex (uint32_t index)
{
Mutex::Locker(m_map_mutex);
MapIterator iter = m_map.begin();
MapIterator end = m_map.end();
while (index > 0)
{
iter++;
index--;
if (end == iter)
return KeyType();
}
return iter->first;
}
protected:
MapType m_map;
Mutex m_map_mutex;
@ -234,7 +266,7 @@ public:
typedef typename std::tr1::shared_ptr<FormatNavigator<KeyType, ValueType> > SharedPointer;
friend class FormatCategory;
friend class TypeCategoryImpl;
FormatNavigator(std::string name,
IFormatChangeListener* lst) :
@ -274,6 +306,30 @@ public:
return ret;
}
bool
Get (ConstString type, MapValueType& entry)
{
return Get_Impl(type, entry, Types<KeyType,ValueType>());
}
bool
GetExact (ConstString type, MapValueType& entry)
{
return GetExact_Impl(type, entry, Types<KeyType,ValueType>());
}
MapValueType
GetAtIndex (uint32_t index)
{
return m_format_map.GetValueAtIndex(index);
}
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierAtIndex (uint32_t index)
{
return GetTypeNameSpecifierAtIndex_Impl(index, Types<KeyType,ValueType>());
}
void
Clear ()
{
@ -350,12 +406,42 @@ protected:
return m_format_map.Get(type, entry);
}
template<typename K, typename V>
bool
GetExact_Impl (ConstString type, MapValueType& entry, Types<K,V> dummy)
{
return Get_Impl(type,entry,dummy);
}
template<typename K, typename V>
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierAtIndex_Impl (uint32_t index, Types<K,V> dummy)
{
ConstString key = m_format_map.GetKeyAtIndex(index);
if (key)
return lldb::TypeNameSpecifierImplSP(new TypeNameSpecifierImpl(key.AsCString(),
false));
else
return lldb::TypeNameSpecifierImplSP();
}
template<typename V>
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierAtIndex_Impl (uint32_t index, Types<lldb::RegularExpressionSP,V> dummy)
{
lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
if (regex.get() == NULL)
return lldb::TypeNameSpecifierImplSP();
return lldb::TypeNameSpecifierImplSP(new TypeNameSpecifierImpl(regex->GetText(),
true));
}
template<typename V>
bool
Get_Impl (ConstString key, MapValueType& value, Types<lldb::RegularExpressionSP,V>)
{
Mutex& x_mutex = m_format_map.mutex();
lldb_private::Mutex::Locker locker(x_mutex);
Mutex& x_mutex = m_format_map.mutex();
lldb_private::Mutex::Locker locker(x_mutex);
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
@ -368,11 +454,24 @@ protected:
}
return false;
}
template<typename V>
bool
Get (ConstString type, MapValueType& entry)
GetExact_Impl (ConstString key, MapValueType& value, Types<lldb::RegularExpressionSP,V>)
{
return Get_Impl(type, entry, Types<KeyType,ValueType>());
Mutex& x_mutex = m_format_map.mutex();
lldb_private::Mutex::Locker locker(x_mutex);
MapIterator pos, end = m_format_map.map().end();
for (pos = m_format_map.map().begin(); pos != end; pos++)
{
lldb::RegularExpressionSP regex = pos->first;
if (strcmp(regex->GetText(),key.AsCString()) == 0)
{
value = pos->second;
return true;
}
}
return false;
}
#define LLDB_MAX_REASONABLE_OBJC_CLASS_DEPTH 100

View File

@ -963,7 +963,7 @@ public:
}
void
SetCustomSummaryFormat(lldb::SummaryFormatSP format)
SetCustomSummaryFormat(lldb::TypeSummaryImplSP format)
{
m_forced_summary_format = format;
m_user_id_of_forced_summary = m_update_point.GetModID();
@ -971,7 +971,7 @@ public:
m_is_getting_summary = false;
}
lldb::SummaryFormatSP
lldb::TypeSummaryImplSP
GetCustomSummaryFormat()
{
return m_forced_summary_format;
@ -990,7 +990,7 @@ public:
return (m_forced_summary_format.get());
}
lldb::SummaryFormatSP
lldb::TypeSummaryImplSP
GetSummaryFormat()
{
UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
@ -1000,7 +1000,7 @@ public:
}
void
SetSummaryFormat(lldb::SummaryFormatSP format)
SetSummaryFormat(lldb::TypeSummaryImplSP format)
{
m_last_summary_format = format;
m_summary_str.clear();
@ -1008,13 +1008,13 @@ public:
}
void
SetValueFormat(lldb::ValueFormatSP format)
SetValueFormat(lldb::TypeFormatImplSP format)
{
m_last_value_format = format;
m_value_str.clear();
}
lldb::ValueFormatSP
lldb::TypeFormatImplSP
GetValueFormat()
{
UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
@ -1110,9 +1110,9 @@ protected:
lldb::Format m_format;
uint32_t m_last_format_mgr_revision;
lldb::DynamicValueType m_last_format_mgr_dynamic;
lldb::SummaryFormatSP m_last_summary_format;
lldb::SummaryFormatSP m_forced_summary_format;
lldb::ValueFormatSP m_last_value_format;
lldb::TypeSummaryImplSP m_last_summary_format;
lldb::TypeSummaryImplSP m_forced_summary_format;
lldb::TypeFormatImplSP m_last_value_format;
lldb::SyntheticChildrenSP m_last_synthetic_filter;
ProcessModID m_user_id_of_forced_summary;
AddressType m_address_type_of_ptr_or_ref_children;

View File

@ -109,7 +109,13 @@ public:
}
virtual bool
GenerateTypeScriptFunction (StringList &input, StringList &output)
GenerateTypeScriptFunction (const char* oneliner, StringList &output, void* name_token = NULL)
{
return false;
}
virtual bool
GenerateTypeScriptFunction (StringList &input, StringList &output, void* name_token = NULL)
{
return false;
}
@ -121,7 +127,13 @@ public:
}
virtual bool
GenerateTypeSynthClass (StringList &input, StringList &output)
GenerateTypeSynthClass (StringList &input, StringList &output, void* name_token = NULL)
{
return false;
}
virtual bool
GenerateTypeSynthClass (const char* oneliner, StringList &output, void* name_token = NULL)
{
return false;
}
@ -133,13 +145,6 @@ public:
return NULL;
}
// use this if the function code is just a one-liner script
virtual bool
GenerateTypeScriptFunction (const char* oneliner, StringList &output)
{
return false;
}
virtual bool
GenerateFunction(std::string& signature, StringList &input, StringList &output)
{

View File

@ -56,14 +56,17 @@ public:
ExportFunctionDefinitionToInterpreter (StringList &function_def);
bool
GenerateTypeScriptFunction (StringList &input, StringList &output);
GenerateTypeScriptFunction (StringList &input, StringList &output, void* name_token = NULL);
bool
GenerateTypeSynthClass (StringList &input, StringList &output);
GenerateTypeSynthClass (StringList &input, StringList &output, void* name_token = NULL);
bool
GenerateTypeSynthClass (const char* oneliner, StringList &output, void* name_token = NULL);
// use this if the function code is just a one-liner script
bool
GenerateTypeScriptFunction (const char* oneliner, StringList &output);
GenerateTypeScriptFunction (const char* oneliner, StringList &output, void* name_token = NULL);
virtual bool
GenerateScriptAliasFunction (StringList &input, StringList &output);

View File

@ -600,6 +600,22 @@ namespace lldb {
} TemplateArgumentKind;
//----------------------------------------------------------------------
// Options that can be set for a formatter to alter its behavior
// Not all of these are applicable to all formatter types
//----------------------------------------------------------------------
typedef enum TypeOptions
{
eTypeOptionNone = (0u),
eTypeOptionCascade = (1u << 0),
eTypeOptionSkipPointers = (1u << 1),
eTypeOptionSkipReferences = (1u << 2),
eTypeOptionHideChildren = (1u << 3),
eTypeOptionHideValue = (1u << 4),
eTypeOptionShowOneLiner = (1u << 5),
eTypeOptionHideNames = (1u << 6)
} TypeOptions;
} // namespace lldb

View File

@ -86,7 +86,7 @@ class ExecutionContextScope;
class FileSpec;
class FileSpecList;
class Flags;
class FormatCategory;
class TypeCategoryImpl;
class FormatManager;
class FuncUnwinders;
class Function;
@ -154,8 +154,8 @@ template <unsigned N> class StreamBuffer;
class StreamFile;
class StreamString;
class StringList;
struct StringSummaryFormat;
struct SummaryFormat;
class StringSummaryFormat;
class TypeSummaryImpl;
class Symbol;
class SymbolContext;
class SymbolContextList;
@ -167,8 +167,9 @@ class SymbolVendor;
class Symtab;
class SyntheticChildren;
class SyntheticChildrenFrontEnd;
class TypeFilterImpl;
#ifndef LLDB_DISABLE_PYTHON
class SyntheticScriptProvider;
class TypeSyntheticImpl;
#endif
class Target;
class TargetList;
@ -190,7 +191,8 @@ class TypeImpl;
class TypeAndOrName;
class TypeList;
class TypeListImpl;
class TypeMemberImpl;
class TypeMemberImpl;
class TypeNameSpecifierImpl;
class UUID;
class Unwind;
class UnwindAssembly;
@ -199,7 +201,7 @@ class UnwindTable;
class UserSettingsController;
class VMRange;
class Value;
struct ValueFormat;
struct TypeFormatImpl;
class ValueList;
class ValueObject;
class ValueObjectChild;
@ -243,7 +245,7 @@ namespace lldb {
typedef std::tr1::shared_ptr<lldb_private::Disassembler> DisassemblerSP;
typedef std::tr1::shared_ptr<lldb_private::DynamicLoader> DynamicLoaderSP;
typedef std::tr1::shared_ptr<lldb_private::Event> EventSP;
typedef std::tr1::shared_ptr<lldb_private::FormatCategory> FormatCategorySP;
typedef std::tr1::shared_ptr<lldb_private::TypeCategoryImpl> TypeCategoryImplSP;
typedef std::tr1::shared_ptr<lldb_private::Function> FunctionSP;
typedef std::tr1::shared_ptr<lldb_private::InlineFunctionInfo> InlineFunctionInfoSP;
typedef std::tr1::shared_ptr<lldb_private::InputReader> InputReaderSP;
@ -267,7 +269,7 @@ namespace lldb {
typedef std::tr1::shared_ptr<lldb_private::Section> SectionSP;
typedef std::tr1::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
#ifndef LLDB_DISABLE_PYTHON
typedef std::tr1::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptFormatSP;
typedef std::tr1::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptSummaryFormatSP;
#endif // #ifndef LLDB_DISABLE_PYTHON
typedef std::tr1::shared_ptr<lldb_private::StackFrame> StackFrameSP;
typedef std::tr1::weak_ptr<lldb_private::StackFrame> StackFrameWP;
@ -275,14 +277,17 @@ namespace lldb {
typedef std::tr1::shared_ptr<lldb_private::StopInfo> StopInfoSP;
typedef std::tr1::shared_ptr<lldb_private::StoppointLocation> StoppointLocationSP;
typedef std::tr1::shared_ptr<lldb_private::Stream> StreamSP;
typedef std::tr1::shared_ptr<lldb_private::StringSummaryFormat> StringSummaryFormatSP;
typedef std::tr1::shared_ptr<lldb_private::SummaryFormat> SummaryFormatSP;
typedef std::tr1::shared_ptr<lldb_private::StringSummaryFormat> StringTypeSummaryImplSP;
typedef std::tr1::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
typedef std::tr1::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;
typedef std::tr1::shared_ptr<lldb_private::SymbolFile> SymbolFileSP;
typedef std::tr1::shared_ptr<lldb_private::SymbolFileType> SymbolFileTypeSP;
typedef std::tr1::weak_ptr<lldb_private::SymbolFileType> SymbolFileTypeWP;
typedef std::tr1::shared_ptr<lldb_private::SymbolContextSpecifier> SymbolContextSpecifierSP;
typedef std::tr1::shared_ptr<lldb_private::SyntheticChildren> SyntheticChildrenSP;
typedef std::tr1::shared_ptr<lldb_private::SyntheticChildrenFrontEnd> SyntheticChildrenFrontEndSP;
typedef std::tr1::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;
typedef std::tr1::shared_ptr<lldb_private::TypeSyntheticImpl> TypeSyntheticImplSP;
typedef std::tr1::shared_ptr<lldb_private::Target> TargetSP;
typedef std::tr1::weak_ptr<lldb_private::Target> TargetWP;
typedef std::tr1::shared_ptr<lldb_private::Thread> ThreadSP;
@ -298,7 +303,7 @@ namespace lldb {
typedef std::tr1::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
typedef std::tr1::shared_ptr<lldb_private::Value> ValueSP;
typedef std::tr1::shared_ptr<lldb_private::ValueFormat> ValueFormatSP;
typedef std::tr1::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
typedef std::tr1::shared_ptr<lldb_private::ValueList> ValueListSP;
typedef std::tr1::shared_ptr<lldb_private::Variable> VariableSP;
typedef std::tr1::shared_ptr<lldb_private::VariableList> VariableListSP;

View File

@ -408,12 +408,24 @@
4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp */; };
94031A9E13CF486700DCFF3C /* InputReaderEZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94031A9D13CF486600DCFF3C /* InputReaderEZ.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, ); }; };
941BCC8214E48C4000BB969C /* SBTypeSynthetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568914E355F2003A195C /* SBTypeSynthetic.h */; settings = {ATTRIBUTES = (Public, ); }; };
9443B122140C18C40013457C /* SBData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9443B121140C18C10013457C /* SBData.cpp */; };
9443B123140C26AB0013457C /* SBData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9443B120140C18A90013457C /* SBData.h */; settings = {ATTRIBUTES = (Public, ); }; };
94611EB213CCA4A4003A22AF /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94611EB113CCA4A4003A22AF /* RefCounter.cpp */; };
9461569A14E358A6003A195C /* SBTypeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568A14E35621003A195C /* SBTypeFilter.cpp */; };
9461569B14E358A6003A195C /* SBTypeFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568B14E35621003A195C /* SBTypeFormat.cpp */; };
9461569C14E358A6003A195C /* SBTypeSummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9461568C14E35621003A195C /* SBTypeSummary.cpp */; };
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 */; };
9475C18F14E5F858001BFC6D /* SBTypeNameSpecifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */; settings = {ATTRIBUTES = (Public, ); }; };
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */; };
94B6E76213D88365005F417F /* ValueObjectSyntheticFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94B6E76113D88362005F417F /* ValueObjectSyntheticFilter.cpp */; };
94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94FA3DDF1405D50300833217 /* ValueObjectConstResultChild.cpp */; };
@ -1259,12 +1271,30 @@
9443B121140C18C10013457C /* SBData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBData.cpp; path = source/API/SBData.cpp; sourceTree = "<group>"; };
94611EAF13CCA363003A22AF /* RefCounter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RefCounter.h; path = include/lldb/Utility/RefCounter.h; sourceTree = "<group>"; };
94611EB113CCA4A4003A22AF /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RefCounter.cpp; path = source/Utility/RefCounter.cpp; sourceTree = "<group>"; };
9461568614E355F2003A195C /* SBTypeFilter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeFilter.h; path = include/lldb/API/SBTypeFilter.h; sourceTree = "<group>"; };
9461568714E355F2003A195C /* SBTypeFormat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeFormat.h; path = include/lldb/API/SBTypeFormat.h; sourceTree = "<group>"; };
9461568814E355F2003A195C /* SBTypeSummary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeSummary.h; path = include/lldb/API/SBTypeSummary.h; sourceTree = "<group>"; };
9461568914E355F2003A195C /* SBTypeSynthetic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeSynthetic.h; path = include/lldb/API/SBTypeSynthetic.h; sourceTree = "<group>"; };
9461568A14E35621003A195C /* SBTypeFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeFilter.cpp; path = source/API/SBTypeFilter.cpp; sourceTree = "<group>"; };
9461568B14E35621003A195C /* SBTypeFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeFormat.cpp; path = source/API/SBTypeFormat.cpp; sourceTree = "<group>"; };
9461568C14E35621003A195C /* SBTypeSummary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeSummary.cpp; path = source/API/SBTypeSummary.cpp; sourceTree = "<group>"; };
9461568D14E35621003A195C /* SBTypeSynthetic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeSynthetic.cpp; path = source/API/SBTypeSynthetic.cpp; sourceTree = "<group>"; };
9461569214E3567F003A195C /* SBTypeFilter.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeFilter.i; sourceTree = "<group>"; };
9461569314E3567F003A195C /* SBTypeFormat.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeFormat.i; sourceTree = "<group>"; };
9461569414E3567F003A195C /* SBTypeSummary.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeSummary.i; sourceTree = "<group>"; };
9461569514E3567F003A195C /* SBTypeSynthetic.i */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeSynthetic.i; sourceTree = "<group>"; };
9463D4CC13B1798800C230D4 /* CommandObjectType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = CommandObjectType.cpp; path = source/Commands/CommandObjectType.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
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; name = DataVisualization.h; path = include/lldb/Core/DataVisualization.h; sourceTree = "<group>"; };
9470A8EF1402DFFB0056FF61 /* DataVisualization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataVisualization.cpp; path = source/Core/DataVisualization.cpp; 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>"; };
9475C18B14E5F818001BFC6D /* SBTypeNameSpecifier.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBTypeNameSpecifier.i; sourceTree = "<group>"; };
9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBTypeNameSpecifier.h; path = include/lldb/API/SBTypeNameSpecifier.h; sourceTree = "<group>"; };
9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBTypeNameSpecifier.cpp; path = source/API/SBTypeNameSpecifier.cpp; 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>"; };
@ -1715,6 +1745,12 @@
2611FF0F142D83060017FEA3 /* SBTarget.i */,
2611FF10142D83060017FEA3 /* SBThread.i */,
2611FF11142D83060017FEA3 /* SBType.i */,
9475C18A14E5EA1C001BFC6D /* SBTypeCategory.i */,
9461569214E3567F003A195C /* SBTypeFilter.i */,
9461569314E3567F003A195C /* SBTypeFormat.i */,
9475C18B14E5F818001BFC6D /* SBTypeNameSpecifier.i */,
9461569414E3567F003A195C /* SBTypeSummary.i */,
9461569514E3567F003A195C /* SBTypeSynthetic.i */,
2611FF12142D83060017FEA3 /* SBValue.i */,
2611FF13142D83060017FEA3 /* SBValueList.i */,
B2A5872514313B480092BFBA /* SBWatchpoint.i */,
@ -1822,6 +1858,18 @@
9A9831091125FC5800A56CB0 /* SBThread.cpp */,
2617447911685869005ADD65 /* SBType.h */,
261744771168585B005ADD65 /* SBType.cpp */,
9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */,
9475C18714E5E9FA001BFC6D /* SBTypeCategory.cpp */,
9461568614E355F2003A195C /* SBTypeFilter.h */,
9461568A14E35621003A195C /* SBTypeFilter.cpp */,
9461568714E355F2003A195C /* SBTypeFormat.h */,
9461568B14E35621003A195C /* SBTypeFormat.cpp */,
9475C18C14E5F826001BFC6D /* SBTypeNameSpecifier.h */,
9475C18D14E5F834001BFC6D /* SBTypeNameSpecifier.cpp */,
9461568814E355F2003A195C /* SBTypeSummary.h */,
9461568C14E35621003A195C /* SBTypeSummary.cpp */,
9461568914E355F2003A195C /* SBTypeSynthetic.h */,
9461568D14E35621003A195C /* SBTypeSynthetic.cpp */,
9A19A6A51163BB7E00E0D453 /* SBValue.h */,
9A19A6AD1163BB9800E0D453 /* SBValue.cpp */,
9A357582116CFDEE00E8ED2F /* SBValueList.h */,
@ -2876,6 +2924,12 @@
2668022C115FD13D008E1FE4 /* SBTarget.h in Headers */,
2668022E115FD13D008E1FE4 /* SBThread.h in Headers */,
2617447A11685869005ADD65 /* SBType.h in Headers */,
9475C18914E5EA08001BFC6D /* SBTypeCategory.h in Headers */,
941BCC7F14E48C4000BB969C /* SBTypeFilter.h in Headers */,
941BCC8014E48C4000BB969C /* SBTypeFormat.h in Headers */,
9475C18F14E5F858001BFC6D /* SBTypeNameSpecifier.h in Headers */,
941BCC8114E48C4000BB969C /* SBTypeSummary.h in Headers */,
941BCC8214E48C4000BB969C /* SBTypeSynthetic.h in Headers */,
9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */,
9A357583116CFDEE00E8ED2F /* SBValueList.h in Headers */,
26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */,
@ -3177,6 +3231,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9461569A14E358A6003A195C /* SBTypeFilter.cpp in Sources */,
9461569B14E358A6003A195C /* SBTypeFormat.cpp in Sources */,
9461569C14E358A6003A195C /* SBTypeSummary.cpp in Sources */,
9461569D14E358A6003A195C /* SBTypeSynthetic.cpp in Sources */,
26680324116005D9008E1FE4 /* SBThread.cpp in Sources */,
26680326116005DB008E1FE4 /* SBTarget.cpp in Sources */,
26680327116005DC008E1FE4 /* SBSourceManager.cpp in Sources */,
@ -3217,6 +3275,8 @@
26B82840142D020F002DBC64 /* SBSection.cpp in Sources */,
B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */,
2660AAB914622483003A9694 /* LLDBWrapPython.cpp in Sources */,
9475C18814E5E9FA001BFC6D /* SBTypeCategory.cpp in Sources */,
9475C18E14E5F834001BFC6D /* SBTypeNameSpecifier.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -73,6 +73,12 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\
" ${SRC_ROOT}/include/lldb/API/SBTarget.h"\
" ${SRC_ROOT}/include/lldb/API/SBThread.h"\
" ${SRC_ROOT}/include/lldb/API/SBType.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeCategory.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeFilter.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeFormat.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeNameSpecifier.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeSummary.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeSynthetic.h"\
" ${SRC_ROOT}/include/lldb/API/SBValue.h"\
" ${SRC_ROOT}/include/lldb/API/SBValueList.h"\
" ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\
@ -109,6 +115,12 @@ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTarget.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBThread.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBType.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeCategory.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeFilter.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeFormat.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeNameSpecifier.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeSummary.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeSynthetic.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBValue.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i"

View File

@ -321,6 +321,37 @@ public:
void
SetCloseInputOnEOF (bool b);
lldb::SBTypeCategory
GetCategory (const char* category_name);
lldb::SBTypeCategory
CreateCategory (const char* category_name);
bool
DeleteCategory (const char* category_name);
uint32_t
GetNumCategories ();
lldb::SBTypeCategory
GetCategoryAtIndex (uint32_t);
lldb::SBTypeCategory
GetDefaultCategory();
lldb::SBTypeFormat
GetFormatForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeSummary
GetSummaryForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeFilter
GetFilterForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeSynthetic
GetSyntheticForType (lldb::SBTypeNameSpecifier);
}; // class SBDebugger
} // namespace lldb

View File

@ -0,0 +1,140 @@
//===-- SWIG Interface for SBTypeCategory---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a category that can contain formatters for types.
") SBTypeCategory;
class SBTypeCategory
{
public:
SBTypeCategory();
SBTypeCategory (const lldb::SBTypeCategory &rhs);
~SBTypeCategory ();
bool
IsValid() const;
bool
GetEnabled ();
void
SetEnabled (bool);
const char*
GetName();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
uint32_t
GetNumFormats ();
uint32_t
GetNumSummaries ();
uint32_t
GetNumFilters ();
uint32_t
GetNumSynthetics ();
lldb::SBTypeNameSpecifier
GetTypeNameSpecifierForFilterAtIndex (uint32_t);
lldb::SBTypeNameSpecifier
GetTypeNameSpecifierForFormatAtIndex (uint32_t);
lldb::SBTypeNameSpecifier
GetTypeNameSpecifierForSummaryAtIndex (uint32_t);
lldb::SBTypeNameSpecifier
GetTypeNameSpecifierForSyntheticAtIndex (uint32_t);
lldb::SBTypeFilter
GetFilterForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeFormat
GetFormatForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeSummary
GetSummaryForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeSynthetic
GetSyntheticForType (lldb::SBTypeNameSpecifier);
lldb::SBTypeFilter
GetFilterAtIndex (uint32_t);
lldb::SBTypeFormat
GetFormatAtIndex (uint32_t);
lldb::SBTypeSummary
GetSummaryAtIndex (uint32_t);
lldb::SBTypeSynthetic
GetSyntheticAtIndex (uint32_t);
bool
AddTypeFormat (lldb::SBTypeNameSpecifier,
lldb::SBTypeFormat);
bool
DeleteTypeFormat (lldb::SBTypeNameSpecifier);
bool
AddTypeSummary (lldb::SBTypeNameSpecifier,
lldb::SBTypeSummary);
bool
DeleteTypeSummary (lldb::SBTypeNameSpecifier);
bool
AddTypeFilter (lldb::SBTypeNameSpecifier,
lldb::SBTypeFilter);
bool
DeleteTypeFilter (lldb::SBTypeNameSpecifier);
bool
AddTypeSynthetic (lldb::SBTypeNameSpecifier,
lldb::SBTypeSynthetic);
bool
DeleteTypeSynthetic (lldb::SBTypeNameSpecifier);
%pythoncode %{
__swig_getmethods__["num_formats"] = GetNumFormats
if _newclass: x = property(GetNumFormats, None)
__swig_getmethods__["num_summaries"] = GetNumSummaries
if _newclass: x = property(GetNumSummaries, None)
__swig_getmethods__["num_filters"] = GetNumFilters
if _newclass: x = property(GetNumFilters, None)
__swig_getmethods__["num_synthetics"] = GetNumSynthetics
if _newclass: x = property(GetNumSynthetics, None)
__swig_getmethods__["name"] = GetName
if _newclass: x = property(GetName, None)
__swig_getmethods__["enabled"] = GetEnabled
__swig_setmethods__["enabled"] = SetEnabled
if _newclass: x = property(GetEnabled, SetEnabled)
%}
};
} // namespace lldb

View File

@ -0,0 +1,69 @@
//===-- SWIG Interface for SBTypeFilter----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a filter that can be associated to one or more types.
") SBTypeFilter;
class SBTypeFilter
{
public:
SBTypeFilter();
SBTypeFilter (uint32_t options);
SBTypeFilter (const lldb::SBTypeFilter &rhs);
~SBTypeFilter ();
bool
IsValid() const;
bool
IsEqualTo (lldb::SBTypeFilter &rhs);
uint32_t
GetNumberOfExpressionPaths ();
const char*
GetExpressionPathAtIndex (uint32_t i);
bool
ReplaceExpressionPathAtIndex (uint32_t i, const char* item);
void
AppendExpressionPath (const char* item);
void
Clear();
uint32_t
GetOptions();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
%pythoncode %{
__swig_getmethods__["options"] = GetOptions
__swig_setmethods__["options"] = SetOptions
if _newclass: x = property(GetOptions, SetOptions)
__swig_getmethods__["count"] = GetNumberOfExpressionPaths
if _newclass: x = property(GetNumberOfExpressionPaths, None)
%}
};
} // namespace lldb

View File

@ -0,0 +1,64 @@
//===-- SWIG Interface for SBTypeFormat----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a format that can be associated to one or more types.
") SBTypeFormat;
class SBTypeFormat
{
public:
SBTypeFormat();
SBTypeFormat (lldb::Format format, uint32_t options = 0);
SBTypeFormat (const lldb::SBTypeFormat &rhs);
~SBTypeFormat ();
bool
IsValid() const;
bool
IsEqualTo (lldb::SBTypeFormat &rhs);
lldb::Format
GetFormat ();
uint32_t
GetOptions();
void
SetFormat (lldb::Format);
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
%pythoncode %{
__swig_getmethods__["format"] = GetFormat
__swig_setmethods__["format"] = SetFormat
if _newclass: x = property(GetFormat, SetFormat)
__swig_getmethods__["options"] = GetOptions
__swig_setmethods__["options"] = SetOptions
if _newclass: x = property(GetOptions, SetOptions)
%}
};
} // namespace lldb

View File

@ -0,0 +1,57 @@
//===-- SWIG Interface for SBTypeNameSpecifier---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a general way to provide a type name to LLDB APIs.
") SBTypeNameSpecifier;
class SBTypeNameSpecifier
{
public:
SBTypeNameSpecifier();
SBTypeNameSpecifier (const char* name,
bool is_regex = false);
SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs);
~SBTypeNameSpecifier ();
bool
IsValid() const;
bool
IsEqualTo (lldb::SBTypeNameSpecifier &rhs);
const char*
GetName();
bool
IsRegex();
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
%pythoncode %{
__swig_getmethods__["name"] = GetName
if _newclass: x = property(GetName, None)
__swig_getmethods__["is_regex"] = IsRegex
if _newclass: x = property(IsRegex, None)
%}
};
} // namespace lldb

View File

@ -0,0 +1,93 @@
//===-- SWIG Interface for SBTypeSummary---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a summary that can be associated to one or more types.
") SBTypeSummary;
class SBTypeSummary
{
public:
SBTypeSummary();
static SBTypeSummary
CreateWithSummaryString (const char* data, uint32_t options = 0);
static SBTypeSummary
CreateWithFunctionName (const char* data, uint32_t options = 0);
static SBTypeSummary
CreateWithScriptCode (const char* data, uint32_t options = 0);
SBTypeSummary (const lldb::SBTypeSummary &rhs);
~SBTypeSummary ();
bool
IsValid() const;
bool
IsEqualTo (lldb::SBTypeSummary &rhs);
bool
IsFunctionCode();
bool
IsFunctionName();
bool
IsSummaryString();
const char*
GetData ();
void
SetSummaryString (const char* data);
void
SetFunctionName (const char* data);
void
SetFunctionCode (const char* data);
uint32_t
GetOptions ();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
%pythoncode %{
__swig_getmethods__["options"] = GetOptions
__swig_setmethods__["options"] = SetOptions
if _newclass: x = property(GetOptions, SetOptions)
__swig_getmethods__["is_summary_string"] = IsSummaryString
if _newclass: x = property(IsSummaryString, None)
__swig_getmethods__["is_function_name"] = IsFunctionName
if _newclass: x = property(IsFunctionName, None)
__swig_getmethods__["is_function_code"] = IsFunctionCode
if _newclass: x = property(IsFunctionCode, None)
__swig_getmethods__["summary_data"] = GetData
if _newclass: x = property(GetData, None)
%}
};
} // namespace lldb

View File

@ -0,0 +1,74 @@
//===-- SWIG Interface for SBTypeSynthetic-------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a summary that can be associated to one or more types.
") SBTypeSynthetic;
class SBTypeSynthetic
{
public:
SBTypeSynthetic();
static lldb::SBTypeSynthetic
CreateWithClassName (const char* data, uint32_t options = 0);
static lldb::SBTypeSynthetic
CreateWithScriptCode (const char* data, uint32_t options = 0);
SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs);
~SBTypeSynthetic ();
bool
IsValid() const;
bool
IsEqualTo (lldb::SBTypeSynthetic &rhs);
bool
IsClassCode();
const char*
GetData ();
void
SetClassName (const char* data);
void
SetClassCode (const char* data);
uint32_t
GetOptions ();
void
SetOptions (uint32_t);
bool
GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level);
%pythoncode %{
__swig_getmethods__["options"] = GetOptions
__swig_setmethods__["options"] = SetOptions
if _newclass: x = property(GetOptions, SetOptions)
__swig_getmethods__["contains_code"] = IsClassCode
if _newclass: x = property(IsClassCode, None)
__swig_getmethods__["synthetic_data"] = GetData
if _newclass: x = property(GetData, None)
%}
};
} // namespace lldb

View File

@ -322,6 +322,48 @@
return PyString_FromString("");
}
}
%extend lldb::SBTypeCategory {
PyObject *lldb::SBTypeCategory::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBTypeFilter {
PyObject *lldb::SBTypeFilter::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBTypeFormat {
PyObject *lldb::SBTypeFormat::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBTypeMember {
PyObject *lldb::SBTypeMember::__str__ (){
lldb::SBStream description;
@ -336,6 +378,48 @@
return PyString_FromString("");
}
}
%extend lldb::SBTypeNameSpecifier {
PyObject *lldb::SBTypeNameSpecifier::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBTypeSummary {
PyObject *lldb::SBTypeSummary::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBTypeSynthetic {
PyObject *lldb::SBTypeSynthetic::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
size_t desc_len = description.GetSize();
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
else
return PyString_FromString("");
}
}
%extend lldb::SBThread {
PyObject *lldb::SBThread::__str__ (){
lldb::SBStream description;

View File

@ -82,6 +82,12 @@ import os
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
#include "lldb/API/SBType.h"
#include "lldb/API/SBTypeCategory.h"
#include "lldb/API/SBTypeFilter.h"
#include "lldb/API/SBTypeFormat.h"
#include "lldb/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBTypeSummary.h"
#include "lldb/API/SBTypeSynthetic.h"
#include "lldb/API/SBValue.h"
#include "lldb/API/SBValueList.h"
#include "lldb/API/SBWatchpoint.h"
@ -134,6 +140,12 @@ import os
%include "./Python/interface/SBTarget.i"
%include "./Python/interface/SBThread.i"
%include "./Python/interface/SBType.i"
%include "./Python/interface/SBTypeCategory.i"
%include "./Python/interface/SBTypeFilter.i"
%include "./Python/interface/SBTypeFormat.i"
%include "./Python/interface/SBTypeNameSpecifier.i"
%include "./Python/interface/SBTypeSummary.i"
%include "./Python/interface/SBTypeSynthetic.i"
%include "./Python/interface/SBValue.i"
%include "./Python/interface/SBValueList.i"
%include "./Python/interface/SBWatchpoint.i"

View File

@ -25,6 +25,15 @@
#include "lldb/API/SBStringList.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
#include "lldb/API/SBTypeCategory.h"
#include "lldb/API/SBTypeFormat.h"
#include "lldb/API/SBTypeFilter.h"
#include "lldb/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBTypeSummary.h"
#include "lldb/API/SBTypeSynthetic.h"
#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
#include "lldb/Interpreter/Args.h"
@ -1054,3 +1063,140 @@ SBDebugger::SetCloseInputOnEOF (bool b)
if (m_opaque_sp)
m_opaque_sp->SetCloseInputOnEOF (b);
}
SBTypeCategory
SBDebugger::GetCategory (const char* category_name)
{
if (!category_name || *category_name == 0)
return SBTypeCategory();
TypeCategoryImplSP category_sp;
if (DataVisualization::Categories::GetCategory(ConstString(category_name), category_sp, false))
return SBTypeCategory(category_sp);
else
return SBTypeCategory();
}
SBTypeCategory
SBDebugger::CreateCategory (const char* category_name)
{
if (!category_name || *category_name == 0)
return SBTypeCategory();
TypeCategoryImplSP category_sp;
if (DataVisualization::Categories::GetCategory(ConstString(category_name), category_sp, true))
return SBTypeCategory(category_sp);
else
return SBTypeCategory();
}
bool
SBDebugger::DeleteCategory (const char* category_name)
{
if (!category_name || *category_name == 0)
return false;
return DataVisualization::Categories::Delete(ConstString(category_name));
}
uint32_t
SBDebugger::GetNumCategories()
{
return DataVisualization::Categories::GetCount();
}
SBTypeCategory
SBDebugger::GetCategoryAtIndex (uint32_t index)
{
return SBTypeCategory(DataVisualization::Categories::GetCategoryAtIndex(index));
}
SBTypeCategory
SBDebugger::GetDefaultCategory()
{
return GetCategory("default");
}
SBTypeFormat
SBDebugger::GetFormatForType (SBTypeNameSpecifier type_name)
{
SBTypeCategory default_category_sb = GetDefaultCategory();
if (default_category_sb.GetEnabled())
return default_category_sb.GetFormatForType(type_name);
return SBTypeFormat();
}
SBTypeSummary
SBDebugger::GetSummaryForType (SBTypeNameSpecifier type_name)
{
SBTypeSummary summary_chosen;
uint32_t num_categories = GetNumCategories();
SBTypeCategory category_sb;
uint32_t prio_category = UINT32_MAX;
for (uint32_t category_id = 0;
category_id < num_categories;
category_id++)
{
category_sb = GetCategoryAtIndex(category_id);
if (category_sb.GetEnabled() == false)
continue;
SBTypeSummary summary_current = category_sb.GetSummaryForType(type_name);
if (summary_current.IsValid() && (summary_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
{
prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
summary_chosen = summary_current;
}
}
return summary_chosen;
}
SBTypeFilter
SBDebugger::GetFilterForType (SBTypeNameSpecifier type_name)
{
SBTypeFilter filter_chosen;
uint32_t num_categories = GetNumCategories();
SBTypeCategory category_sb;
uint32_t prio_category = UINT32_MAX;
for (uint32_t category_id = 0;
category_id < num_categories;
category_id++)
{
category_sb = GetCategoryAtIndex(category_id);
if (category_sb.GetEnabled() == false)
continue;
SBTypeFilter filter_current = category_sb.GetFilterForType(type_name);
if (filter_current.IsValid() && (filter_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
{
prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
filter_chosen = filter_current;
}
}
return filter_chosen;
}
SBTypeSynthetic
SBDebugger::GetSyntheticForType (SBTypeNameSpecifier type_name)
{
SBTypeSynthetic synth_chosen;
uint32_t num_categories = GetNumCategories();
SBTypeCategory category_sb;
uint32_t prio_category = UINT32_MAX;
for (uint32_t category_id = 0;
category_id < num_categories;
category_id++)
{
category_sb = GetCategoryAtIndex(category_id);
if (category_sb.GetEnabled() == false)
continue;
SBTypeSynthetic synth_current = category_sb.GetSyntheticForType(type_name);
if (synth_current.IsValid() && (synth_chosen.IsValid() == false || (prio_category > category_sb.m_opaque_sp->GetEnabledPosition())))
{
prio_category = category_sb.m_opaque_sp->GetEnabledPosition();
synth_chosen = synth_current;
}
}
return synth_chosen;
}

View File

@ -0,0 +1,556 @@
//===-- SBTypeCategory.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/API/SBTypeCategory.h"
#include "lldb/API/SBTypeFilter.h"
#include "lldb/API/SBTypeFormat.h"
#include "lldb/API/SBTypeSummary.h"
#include "lldb/API/SBTypeSynthetic.h"
#include "lldb/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
using namespace lldb;
using namespace lldb_private;
typedef std::pair<lldb::TypeCategoryImplSP,user_id_t> ImplType;
SBTypeCategory::SBTypeCategory() :
m_opaque_sp()
{
}
SBTypeCategory::SBTypeCategory (const char* name) :
m_opaque_sp()
{
DataVisualization::Categories::GetCategory(ConstString(name), m_opaque_sp);
}
SBTypeCategory::SBTypeCategory (const lldb::SBTypeCategory &rhs) :
m_opaque_sp(rhs.m_opaque_sp)
{
}
SBTypeCategory::~SBTypeCategory ()
{
}
bool
SBTypeCategory::IsValid() const
{
return (m_opaque_sp.get() != NULL);
}
bool
SBTypeCategory::GetEnabled ()
{
if (!IsValid())
return false;
return m_opaque_sp->IsEnabled();
}
void
SBTypeCategory::SetEnabled (bool enabled)
{
if (!IsValid())
return;
if (enabled)
DataVisualization::Categories::Enable(m_opaque_sp);
else
DataVisualization::Categories::Disable(m_opaque_sp);
}
const char*
SBTypeCategory::GetName()
{
if (!IsValid())
return false;
return m_opaque_sp->GetName();
}
uint32_t
SBTypeCategory::GetNumFormats ()
{
if (!IsDefaultCategory())
return 0;
return DataVisualization::ValueFormats::GetCount();
}
uint32_t
SBTypeCategory::GetNumSummaries ()
{
if (!IsValid())
return 0;
return m_opaque_sp->GetSummaryNavigator()->GetCount() + m_opaque_sp->GetRegexSummaryNavigator()->GetCount();
}
uint32_t
SBTypeCategory::GetNumFilters ()
{
if (!IsValid())
return 0;
return m_opaque_sp->GetFilterNavigator()->GetCount() + m_opaque_sp->GetRegexFilterNavigator()->GetCount();
}
uint32_t
SBTypeCategory::GetNumSynthetics ()
{
if (!IsValid())
return 0;
return m_opaque_sp->GetSyntheticNavigator()->GetCount() + m_opaque_sp->GetRegexSyntheticNavigator()->GetCount();
}
lldb::SBTypeNameSpecifier
SBTypeCategory::GetTypeNameSpecifierForFilterAtIndex (uint32_t index)
{
if (!IsValid())
return SBTypeNameSpecifier();
return SBTypeNameSpecifier(m_opaque_sp->GetTypeNameSpecifierForFilterAtIndex(index));
}
lldb::SBTypeNameSpecifier
SBTypeCategory::GetTypeNameSpecifierForFormatAtIndex (uint32_t index)
{
if (!IsDefaultCategory())
return SBTypeNameSpecifier();
return SBTypeNameSpecifier(DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex(index));
}
lldb::SBTypeNameSpecifier
SBTypeCategory::GetTypeNameSpecifierForSummaryAtIndex (uint32_t index)
{
if (!IsValid())
return SBTypeNameSpecifier();
return SBTypeNameSpecifier(m_opaque_sp->GetTypeNameSpecifierForSummaryAtIndex(index));
}
lldb::SBTypeNameSpecifier
SBTypeCategory::GetTypeNameSpecifierForSyntheticAtIndex (uint32_t index)
{
if (!IsValid())
return SBTypeNameSpecifier();
return SBTypeNameSpecifier(m_opaque_sp->GetTypeNameSpecifierForSyntheticAtIndex(index));
}
SBTypeFilter
SBTypeCategory::GetFilterForType (SBTypeNameSpecifier spec)
{
if (!IsValid())
return SBTypeFilter();
if (!spec.IsValid())
return SBTypeFilter();
lldb::SyntheticChildrenSP children_sp;
if (spec.IsRegex())
m_opaque_sp->GetRegexFilterNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
else
m_opaque_sp->GetFilterNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
if (!children_sp)
return lldb::SBTypeFilter();
TypeFilterImplSP filter_sp = std::tr1::static_pointer_cast<TypeFilterImpl>(children_sp);
return lldb::SBTypeFilter(filter_sp);
}
SBTypeFormat
SBTypeCategory::GetFormatForType (SBTypeNameSpecifier spec)
{
if (!IsDefaultCategory())
return SBTypeFormat();
if (!spec.IsValid())
return SBTypeFormat();
if (spec.IsRegex())
return SBTypeFormat();
return SBTypeFormat(DataVisualization::ValueFormats::GetFormat(ConstString(spec.GetName())));
}
SBTypeSummary
SBTypeCategory::GetSummaryForType (SBTypeNameSpecifier spec)
{
if (!IsValid())
return SBTypeSummary();
if (!spec.IsValid())
return SBTypeSummary();
lldb::TypeSummaryImplSP summary_sp;
if (spec.IsRegex())
m_opaque_sp->GetRegexSummaryNavigator()->GetExact(ConstString(spec.GetName()), summary_sp);
else
m_opaque_sp->GetSummaryNavigator()->GetExact(ConstString(spec.GetName()), summary_sp);
if (!summary_sp)
return lldb::SBTypeSummary();
return lldb::SBTypeSummary(summary_sp);
}
SBTypeSynthetic
SBTypeCategory::GetSyntheticForType (SBTypeNameSpecifier spec)
{
if (!IsValid())
return SBTypeSynthetic();
if (!spec.IsValid())
return SBTypeSynthetic();
lldb::SyntheticChildrenSP children_sp;
if (spec.IsRegex())
m_opaque_sp->GetRegexSyntheticNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
else
m_opaque_sp->GetSyntheticNavigator()->GetExact(ConstString(spec.GetName()), children_sp);
if (!children_sp)
return lldb::SBTypeSynthetic();
TypeSyntheticImplSP synth_sp = std::tr1::static_pointer_cast<TypeSyntheticImpl>(children_sp);
return lldb::SBTypeSynthetic(synth_sp);
}
SBTypeFilter
SBTypeCategory::GetFilterAtIndex (uint32_t index)
{
if (!IsValid())
return SBTypeFilter();
lldb::SyntheticChildrenSP children_sp = m_opaque_sp->GetSyntheticAtIndex((index));
if (!children_sp.get())
return lldb::SBTypeFilter();
TypeFilterImplSP filter_sp = std::tr1::static_pointer_cast<TypeFilterImpl>(children_sp);
return lldb::SBTypeFilter(filter_sp);
}
SBTypeFormat
SBTypeCategory::GetFormatAtIndex (uint32_t index)
{
if (!IsDefaultCategory())
return SBTypeFormat();
return SBTypeFormat(DataVisualization::ValueFormats::GetFormatAtIndex((index)));
}
SBTypeSummary
SBTypeCategory::GetSummaryAtIndex (uint32_t index)
{
if (!IsValid())
return SBTypeSummary();
return SBTypeSummary(m_opaque_sp->GetSummaryAtIndex((index)));
}
SBTypeSynthetic
SBTypeCategory::GetSyntheticAtIndex (uint32_t index)
{
if (!IsValid())
return SBTypeSynthetic();
lldb::SyntheticChildrenSP children_sp = m_opaque_sp->GetSyntheticAtIndex((index));
if (!children_sp.get())
return lldb::SBTypeSynthetic();
TypeSyntheticImplSP synth_sp = std::tr1::static_pointer_cast<TypeSyntheticImpl>(children_sp);
return lldb::SBTypeSynthetic(synth_sp);
}
bool
SBTypeCategory::AddTypeFormat (SBTypeNameSpecifier type_name,
SBTypeFormat format)
{
if (!IsDefaultCategory())
return false;
if (!type_name.IsValid())
return false;
if (!format.IsValid())
return false;
if (type_name.IsRegex())
return false;
DataVisualization::ValueFormats::Add(ConstString(type_name.GetName()), format.GetSP());
return true;
}
bool
SBTypeCategory::DeleteTypeFormat (SBTypeNameSpecifier type_name)
{
if (!IsDefaultCategory())
return false;
if (!type_name.IsValid())
return false;
if (type_name.IsRegex())
return false;
return DataVisualization::ValueFormats::Delete(ConstString(type_name.GetName()));
}
bool
SBTypeCategory::AddTypeSummary (SBTypeNameSpecifier type_name,
SBTypeSummary summary)
{
if (!IsValid())
return false;
if (!type_name.IsValid())
return false;
if (!summary.IsValid())
return false;
// FIXME: we need to iterate over all the Debugger objects and have each of them contain a copy of the function
// since we currently have formatters live in a global space, while Python code lives in a specific Debugger-related environment
// this should eventually be fixed by deciding a final location in the LLDB object space for formatters
if (summary.IsFunctionCode())
{
void *name_token = (void*)ConstString(type_name.GetName()).GetCString();
const char* script = summary.GetData();
StringList input; input.SplitIntoLines(script, strlen(script));
uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers();
bool need_set = true;
for (uint32_t j = 0;
j < num_debuggers;
j++)
{
DebuggerSP debugger_sp = lldb_private::Debugger::GetDebuggerAtIndex(j);
if (debugger_sp)
{
ScriptInterpreter* interpreter_ptr = debugger_sp->GetCommandInterpreter().GetScriptInterpreter();
if (interpreter_ptr)
{
StringList output;
if (interpreter_ptr->GenerateTypeScriptFunction(input, output, name_token) && output.GetSize() > 0)
{
if (need_set)
{
need_set = false;
summary.SetFunctionName(output.GetStringAtIndex(0));
}
}
}
}
}
}
if (type_name.IsRegex())
m_opaque_sp->GetRegexSummaryNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), summary.GetSP());
else
m_opaque_sp->GetSummaryNavigator()->Add(ConstString(type_name.GetName()), summary.GetSP());
return true;
}
bool
SBTypeCategory::DeleteTypeSummary (SBTypeNameSpecifier type_name)
{
if (!IsValid())
return false;
if (!type_name.IsValid())
return false;
if (type_name.IsRegex())
return m_opaque_sp->GetRegexSummaryNavigator()->Delete(ConstString(type_name.GetName()));
else
return m_opaque_sp->GetSummaryNavigator()->Delete(ConstString(type_name.GetName()));
}
bool
SBTypeCategory::AddTypeFilter (SBTypeNameSpecifier type_name,
SBTypeFilter filter)
{
if (!IsValid())
return false;
if (!type_name.IsValid())
return false;
if (!filter.IsValid())
return false;
if (type_name.IsRegex())
m_opaque_sp->GetRegexFilterNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), filter.GetSP());
else
m_opaque_sp->GetFilterNavigator()->Add(ConstString(type_name.GetName()), filter.GetSP());
return true;
}
bool
SBTypeCategory::DeleteTypeFilter (SBTypeNameSpecifier type_name)
{
if (!IsValid())
return false;
if (!type_name.IsValid())
return false;
if (type_name.IsRegex())
return m_opaque_sp->GetRegexFilterNavigator()->Delete(ConstString(type_name.GetName()));
else
return m_opaque_sp->GetFilterNavigator()->Delete(ConstString(type_name.GetName()));
}
bool
SBTypeCategory::AddTypeSynthetic (SBTypeNameSpecifier type_name,
SBTypeSynthetic synth)
{
if (!IsValid())
return false;
if (!type_name.IsValid())
return false;
if (!synth.IsValid())
return false;
// FIXME: we need to iterate over all the Debugger objects and have each of them contain a copy of the function
// since we currently have formatters live in a global space, while Python code lives in a specific Debugger-related environment
// this should eventually be fixed by deciding a final location in the LLDB object space for formatters
if (synth.IsClassCode())
{
void *name_token = (void*)ConstString(type_name.GetName()).GetCString();
const char* script = synth.GetData();
StringList input; input.SplitIntoLines(script, strlen(script));
uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers();
bool need_set = true;
for (uint32_t j = 0;
j < num_debuggers;
j++)
{
DebuggerSP debugger_sp = lldb_private::Debugger::GetDebuggerAtIndex(j);
if (debugger_sp)
{
ScriptInterpreter* interpreter_ptr = debugger_sp->GetCommandInterpreter().GetScriptInterpreter();
if (interpreter_ptr)
{
StringList output;
if (interpreter_ptr->GenerateTypeSynthClass(input, output, name_token) && output.GetSize() > 0)
{
if (need_set)
{
need_set = false;
synth.SetClassName(output.GetStringAtIndex(0));
}
}
}
}
}
}
if (type_name.IsRegex())
m_opaque_sp->GetRegexSyntheticNavigator()->Add(lldb::RegularExpressionSP(new RegularExpression(type_name.GetName())), synth.GetSP());
else
m_opaque_sp->GetSyntheticNavigator()->Add(ConstString(type_name.GetName()), synth.GetSP());
return true;
}
bool
SBTypeCategory::DeleteTypeSynthetic (SBTypeNameSpecifier type_name)
{
if (!IsValid())
return false;
if (!type_name.IsValid())
return false;
if (type_name.IsRegex())
return m_opaque_sp->GetRegexSyntheticNavigator()->Delete(ConstString(type_name.GetName()));
else
return m_opaque_sp->GetSyntheticNavigator()->Delete(ConstString(type_name.GetName()));
}
bool
SBTypeCategory::GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level)
{
if (!IsValid())
return false;
description.Printf("Category name: %s\n",GetName());
return true;
}
lldb::SBTypeCategory &
SBTypeCategory::operator = (const lldb::SBTypeCategory &rhs)
{
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
bool
SBTypeCategory::operator == (lldb::SBTypeCategory &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool
SBTypeCategory::operator != (lldb::SBTypeCategory &rhs)
{
if (IsValid() == false)
return rhs.IsValid();
return m_opaque_sp.get() != rhs.m_opaque_sp.get();
}
lldb::TypeCategoryImplSP
SBTypeCategory::GetSP ()
{
if (!IsValid())
return lldb::TypeCategoryImplSP();
return m_opaque_sp;
}
void
SBTypeCategory::SetSP (const lldb::TypeCategoryImplSP &typecategory_impl_sp)
{
m_opaque_sp = typecategory_impl_sp;
}
SBTypeCategory::SBTypeCategory (const lldb::TypeCategoryImplSP &typecategory_impl_sp) :
m_opaque_sp(typecategory_impl_sp)
{
}
bool
SBTypeCategory::IsDefaultCategory()
{
if (!IsValid())
return false;
return (strcmp(m_opaque_sp->GetName(),"default") == 0);
}

View File

@ -0,0 +1,197 @@
//===-- SBTypeFilter.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/API/SBTypeFilter.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
SBTypeFilter::SBTypeFilter() :
m_opaque_sp()
{
}
SBTypeFilter::SBTypeFilter (uint32_t options)
: m_opaque_sp(TypeFilterImplSP(new TypeFilterImpl(options)))
{
}
SBTypeFilter::SBTypeFilter (const lldb::SBTypeFilter &rhs) :
m_opaque_sp(rhs.m_opaque_sp)
{
}
SBTypeFilter::~SBTypeFilter ()
{
}
bool
SBTypeFilter::IsValid() const
{
return m_opaque_sp.get() != NULL;
}
uint32_t
SBTypeFilter::GetOptions()
{
if (IsValid())
return m_opaque_sp->GetOptions();
return 0;
}
void
SBTypeFilter::SetOptions (uint32_t value)
{
if (CopyOnWrite_Impl())
m_opaque_sp->SetOptions(value);
}
bool
SBTypeFilter::GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level)
{
if (!IsValid())
return false;
else {
description.Printf("%s\n",
m_opaque_sp->GetDescription().c_str());
return true;
}
}
void
SBTypeFilter::Clear()
{
if (CopyOnWrite_Impl())
m_opaque_sp->Clear();
}
uint32_t
SBTypeFilter::GetNumberOfExpressionPaths()
{
if (IsValid())
return m_opaque_sp->GetCount();
return 0;
}
const char*
SBTypeFilter::GetExpressionPathAtIndex (uint32_t i)
{
if (IsValid())
{
const char* item = m_opaque_sp->GetExpressionPathAtIndex(i);
if (item && *item == '.')
item++;
return item;
}
return NULL;
}
bool
SBTypeFilter::ReplaceExpressionPathAtIndex (uint32_t i, const char* item)
{
if (CopyOnWrite_Impl())
return m_opaque_sp->SetExpressionPathAtIndex(i, item);
else
return false;
}
void
SBTypeFilter::AppendExpressionPath (const char* item)
{
if (CopyOnWrite_Impl())
m_opaque_sp->AddExpressionPath(item);
}
lldb::SBTypeFilter &
SBTypeFilter::operator = (const lldb::SBTypeFilter &rhs)
{
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
bool
SBTypeFilter::operator == (lldb::SBTypeFilter &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp == rhs.m_opaque_sp;
}
bool
SBTypeFilter::IsEqualTo (lldb::SBTypeFilter &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
if (GetNumberOfExpressionPaths() != rhs.GetNumberOfExpressionPaths())
return false;
for (uint32_t j = 0;
j < GetNumberOfExpressionPaths();
j++)
if ( strcmp(GetExpressionPathAtIndex(j),rhs.GetExpressionPathAtIndex(j)) != 0)
return false;
return GetOptions() == rhs.GetOptions();
}
bool
SBTypeFilter::operator != (lldb::SBTypeFilter &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
lldb::TypeFilterImplSP
SBTypeFilter::GetSP ()
{
return m_opaque_sp;
}
void
SBTypeFilter::SetSP (const lldb::TypeFilterImplSP &typefilter_impl_sp)
{
m_opaque_sp = typefilter_impl_sp;
}
SBTypeFilter::SBTypeFilter (const lldb::TypeFilterImplSP &typefilter_impl_sp) :
m_opaque_sp(typefilter_impl_sp)
{
}
bool
SBTypeFilter::CopyOnWrite_Impl()
{
if (!IsValid())
return false;
if (m_opaque_sp.unique())
return true;
TypeFilterImplSP new_sp(new TypeFilterImpl(GetOptions()));
for (uint32_t j = 0;
j < GetNumberOfExpressionPaths();
j++)
new_sp->AddExpressionPath(GetExpressionPathAtIndex(j));
SetSP(new_sp);
return true;
}

View File

@ -0,0 +1,153 @@
//===-- SBTypeFormat.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/API/SBTypeFormat.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
SBTypeFormat::SBTypeFormat() :
m_opaque_sp()
{
}
SBTypeFormat::SBTypeFormat (lldb::Format format,
uint32_t options)
: m_opaque_sp(TypeFormatImplSP(new TypeFormatImpl(format,options)))
{
}
SBTypeFormat::SBTypeFormat (const lldb::SBTypeFormat &rhs) :
m_opaque_sp(rhs.m_opaque_sp)
{
}
SBTypeFormat::~SBTypeFormat ()
{
}
bool
SBTypeFormat::IsValid() const
{
return m_opaque_sp.get() != NULL;
}
lldb::Format
SBTypeFormat::GetFormat ()
{
if (IsValid())
return m_opaque_sp->GetFormat();
return lldb::eFormatInvalid;
}
uint32_t
SBTypeFormat::GetOptions()
{
if (IsValid())
return m_opaque_sp->GetOptions();
return 0;
}
void
SBTypeFormat::SetFormat (lldb::Format fmt)
{
if (CopyOnWrite_Impl())
m_opaque_sp->SetFormat(fmt);
}
void
SBTypeFormat::SetOptions (uint32_t value)
{
if (CopyOnWrite_Impl())
m_opaque_sp->SetOptions(value);
}
bool
SBTypeFormat::GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level)
{
if (!IsValid())
return false;
else {
description.Printf("%s\n",
m_opaque_sp->GetDescription().c_str());
return true;
}
}
lldb::SBTypeFormat &
SBTypeFormat::operator = (const lldb::SBTypeFormat &rhs)
{
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
bool
SBTypeFormat::operator == (lldb::SBTypeFormat &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp == rhs.m_opaque_sp;
}
bool
SBTypeFormat::IsEqualTo (lldb::SBTypeFormat &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
if (GetFormat() == rhs.GetFormat())
return GetOptions() == rhs.GetOptions();
else
return false;
}
bool
SBTypeFormat::operator != (lldb::SBTypeFormat &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
lldb::TypeFormatImplSP
SBTypeFormat::GetSP ()
{
return m_opaque_sp;
}
void
SBTypeFormat::SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp)
{
m_opaque_sp = typeformat_impl_sp;
}
SBTypeFormat::SBTypeFormat (const lldb::TypeFormatImplSP &typeformat_impl_sp) :
m_opaque_sp(typeformat_impl_sp)
{
}
bool
SBTypeFormat::CopyOnWrite_Impl()
{
if (!IsValid())
return false;
if (m_opaque_sp.unique())
return true;
SetSP(TypeFormatImplSP(new TypeFormatImpl(GetFormat(),GetOptions())));
return true;
}

View File

@ -0,0 +1,127 @@
//===-- SBTypeNameSpecifier.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/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
SBTypeNameSpecifier::SBTypeNameSpecifier() :
m_opaque_sp()
{
}
SBTypeNameSpecifier::SBTypeNameSpecifier (const char* name,
bool is_regex) :
m_opaque_sp(new TypeNameSpecifierImpl(name, is_regex))
{
if (name == NULL || (*name) == 0)
m_opaque_sp.reset();
}
SBTypeNameSpecifier::SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs) :
m_opaque_sp(rhs.m_opaque_sp)
{}
SBTypeNameSpecifier::~SBTypeNameSpecifier ()
{
}
bool
SBTypeNameSpecifier::IsValid() const
{
return m_opaque_sp.get() != NULL;
}
const char*
SBTypeNameSpecifier::GetName ()
{
if (!IsValid())
return NULL;
return m_opaque_sp->GetName();
}
bool
SBTypeNameSpecifier::IsRegex ()
{
if (!IsValid())
return false;
return m_opaque_sp->IsRegex();
}
bool
SBTypeNameSpecifier::GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level)
{
if (!IsValid())
return false;
description.Printf("SBTypeNameSpecifier(%s,%s)", GetName(), IsRegex() ? "regex" : "plain");
return true;
}
lldb::SBTypeNameSpecifier &
SBTypeNameSpecifier::operator = (const lldb::SBTypeNameSpecifier &rhs)
{
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
bool
SBTypeNameSpecifier::operator == (lldb::SBTypeNameSpecifier &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp == rhs.m_opaque_sp;
}
bool
SBTypeNameSpecifier::IsEqualTo (lldb::SBTypeNameSpecifier &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
if (IsRegex() != rhs.IsRegex())
return false;
return (strcmp(GetName(), rhs.GetName()) == 0);
}
bool
SBTypeNameSpecifier::operator != (lldb::SBTypeNameSpecifier &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
lldb::TypeNameSpecifierImplSP
SBTypeNameSpecifier::GetSP ()
{
return m_opaque_sp;
}
void
SBTypeNameSpecifier::SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp)
{
m_opaque_sp = type_namespec_sp;
}
SBTypeNameSpecifier::SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &type_namespec_sp) :
m_opaque_sp(type_namespec_sp)
{
}

View File

@ -0,0 +1,298 @@
//===-- SBTypeSummary.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/API/SBTypeSummary.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
SBTypeSummary::SBTypeSummary() :
m_opaque_sp()
{
}
SBTypeSummary
SBTypeSummary::CreateWithSummaryString (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSummary();
return SBTypeSummary(TypeSummaryImplSP(new StringSummaryFormat(options, data)));
}
SBTypeSummary
SBTypeSummary::CreateWithFunctionName (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSummary();
return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, data)));
}
SBTypeSummary
SBTypeSummary::CreateWithScriptCode (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSummary();
return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data)));
}
SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
m_opaque_sp(rhs.m_opaque_sp)
{
}
SBTypeSummary::~SBTypeSummary ()
{
}
bool
SBTypeSummary::IsValid() const
{
return m_opaque_sp.get() != NULL;
}
bool
SBTypeSummary::IsFunctionCode()
{
if (!IsValid())
return false;
if (m_opaque_sp->IsScripted())
{
ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
const char* ftext = script_summary_ptr->GetPythonScript();
return (ftext && *ftext != 0);
}
return false;
}
bool
SBTypeSummary::IsFunctionName()
{
if (!IsValid())
return false;
if (m_opaque_sp->IsScripted())
{
ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
const char* ftext = script_summary_ptr->GetPythonScript();
return (!ftext || *ftext == 0);
}
return false;
}
bool
SBTypeSummary::IsSummaryString()
{
if (!IsValid())
return false;
return !m_opaque_sp->IsScripted();
}
const char*
SBTypeSummary::GetData ()
{
if (!IsValid())
return NULL;
if (m_opaque_sp->IsScripted())
{
ScriptSummaryFormat* script_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
const char* fname = script_summary_ptr->GetFunctionName();
const char* ftext = script_summary_ptr->GetPythonScript();
if (ftext && *ftext)
return ftext;
return fname;
}
else
{
StringSummaryFormat* string_summary_ptr = (StringSummaryFormat*)m_opaque_sp.get();
return string_summary_ptr->GetSummaryString();
}
}
uint32_t
SBTypeSummary::GetOptions ()
{
if (!IsValid())
return lldb::eTypeOptionNone;
return m_opaque_sp->GetOptions();
}
void
SBTypeSummary::SetOptions (uint32_t value)
{
if (!CopyOnWrite_Impl())
return;
m_opaque_sp->SetOptions(value);
}
void
SBTypeSummary::SetSummaryString (const char* data)
{
if (!IsValid())
return;
if (m_opaque_sp->IsScripted())
ChangeSummaryType(false);
((StringSummaryFormat*)m_opaque_sp.get())->SetSummaryString(data);
}
void
SBTypeSummary::SetFunctionName (const char* data)
{
if (!IsValid())
return;
if (!m_opaque_sp->IsScripted())
ChangeSummaryType(true);
((ScriptSummaryFormat*)m_opaque_sp.get())->SetFunctionName(data);
}
void
SBTypeSummary::SetFunctionCode (const char* data)
{
if (!IsValid())
return;
if (!m_opaque_sp->IsScripted())
ChangeSummaryType(true);
((ScriptSummaryFormat*)m_opaque_sp.get())->SetPythonScript(data);
}
bool
SBTypeSummary::GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level)
{
if (!CopyOnWrite_Impl())
return false;
else {
description.Printf("%s\n",
m_opaque_sp->GetDescription().c_str());
return true;
}
}
lldb::SBTypeSummary &
SBTypeSummary::operator = (const lldb::SBTypeSummary &rhs)
{
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
bool
SBTypeSummary::operator == (lldb::SBTypeSummary &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp == rhs.m_opaque_sp;
}
bool
SBTypeSummary::IsEqualTo (lldb::SBTypeSummary &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
if (m_opaque_sp->IsScripted() != rhs.m_opaque_sp->IsScripted())
return false;
if (IsFunctionCode() != rhs.IsFunctionCode())
return false;
if (IsSummaryString() != rhs.IsSummaryString())
return false;
if (IsFunctionName() != rhs.IsFunctionName())
return false;
if ( strcmp(GetData(), rhs.GetData()) )
return false;
return GetOptions() == rhs.GetOptions();
}
bool
SBTypeSummary::operator != (lldb::SBTypeSummary &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
lldb::TypeSummaryImplSP
SBTypeSummary::GetSP ()
{
return m_opaque_sp;
}
void
SBTypeSummary::SetSP (const lldb::TypeSummaryImplSP &typesummary_impl_sp)
{
m_opaque_sp = typesummary_impl_sp;
}
SBTypeSummary::SBTypeSummary (const lldb::TypeSummaryImplSP &typesummary_impl_sp) :
m_opaque_sp(typesummary_impl_sp)
{
}
bool
SBTypeSummary::CopyOnWrite_Impl()
{
if (!IsValid())
return false;
if (m_opaque_sp.unique())
return true;
TypeSummaryImplSP new_sp;
if (m_opaque_sp->IsScripted())
{
ScriptSummaryFormat* current_summary_ptr = (ScriptSummaryFormat*)m_opaque_sp.get();
new_sp = TypeSummaryImplSP(new ScriptSummaryFormat(GetOptions(),
current_summary_ptr->GetFunctionName(),
current_summary_ptr->GetPythonScript()));
}
else {
StringSummaryFormat* current_summary_ptr = (StringSummaryFormat*)m_opaque_sp.get();
new_sp = TypeSummaryImplSP(new StringSummaryFormat(GetOptions(),
current_summary_ptr->GetSummaryString()));
}
SetSP(new_sp);
return true;
}
bool
SBTypeSummary::ChangeSummaryType (bool want_script)
{
if (!IsValid())
return false;
if (want_script == m_opaque_sp->IsScripted())
return CopyOnWrite_Impl();
TypeSummaryImplSP new_sp;
if (want_script)
new_sp = TypeSummaryImplSP(new ScriptSummaryFormat(GetOptions(), "", ""));
else
new_sp = TypeSummaryImplSP(new StringSummaryFormat(GetOptions(), ""));
SetSP(new_sp);
return true;
}

View File

@ -0,0 +1,203 @@
//===-- SBTypeSynthetic.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/API/SBTypeSynthetic.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
SBTypeSynthetic::SBTypeSynthetic() :
m_opaque_sp()
{
}
SBTypeSynthetic
SBTypeSynthetic::CreateWithClassName (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSynthetic();
return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, data, "")));
}
SBTypeSynthetic
SBTypeSynthetic::CreateWithScriptCode (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSynthetic();
return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, "", data)));
}
SBTypeSynthetic::SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs) :
m_opaque_sp(rhs.m_opaque_sp)
{
}
SBTypeSynthetic::~SBTypeSynthetic ()
{
}
bool
SBTypeSynthetic::IsValid() const
{
return m_opaque_sp.get() != NULL;
}
bool
SBTypeSynthetic::IsClassCode()
{
if (!IsValid())
return false;
const char* code = m_opaque_sp->GetPythonCode();
return (code && *code);
}
bool
SBTypeSynthetic::IsClassName()
{
if (!IsValid())
return false;
return !IsClassCode();
}
const char*
SBTypeSynthetic::GetData ()
{
if (!IsValid())
return NULL;
if (IsClassCode())
return m_opaque_sp->GetPythonCode();
else
return m_opaque_sp->GetPythonClassName();
}
void
SBTypeSynthetic::SetClassName (const char* data)
{
if (IsValid() && data && *data)
m_opaque_sp->SetPythonClassName(data);
}
void
SBTypeSynthetic::SetClassCode (const char* data)
{
if (IsValid() && data && *data)
m_opaque_sp->SetPythonCode(data);
}
uint32_t
SBTypeSynthetic::GetOptions ()
{
if (!IsValid())
return lldb::eTypeOptionNone;
return m_opaque_sp->GetOptions();
}
void
SBTypeSynthetic::SetOptions (uint32_t value)
{
if (!CopyOnWrite_Impl())
return;
m_opaque_sp->SetOptions(value);
}
bool
SBTypeSynthetic::GetDescription (lldb::SBStream &description,
lldb::DescriptionLevel description_level)
{
if (!CopyOnWrite_Impl())
return false;
else {
description.Printf("%s\n",
m_opaque_sp->GetDescription().c_str());
return true;
}
}
lldb::SBTypeSynthetic &
SBTypeSynthetic::operator = (const lldb::SBTypeSynthetic &rhs)
{
if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
return *this;
}
bool
SBTypeSynthetic::operator == (lldb::SBTypeSynthetic &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp == rhs.m_opaque_sp;
}
bool
SBTypeSynthetic::IsEqualTo (lldb::SBTypeSynthetic &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
if (m_opaque_sp->IsScripted() != rhs.m_opaque_sp->IsScripted())
return false;
if (IsClassCode() != rhs.IsClassCode())
return false;
if ( strcmp(GetData(), rhs.GetData()) )
return false;
return GetOptions() == rhs.GetOptions();
}
bool
SBTypeSynthetic::operator != (lldb::SBTypeSynthetic &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
lldb::TypeSyntheticImplSP
SBTypeSynthetic::GetSP ()
{
return m_opaque_sp;
}
void
SBTypeSynthetic::SetSP (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp)
{
m_opaque_sp = TypeSynthetic_impl_sp;
}
SBTypeSynthetic::SBTypeSynthetic (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp) :
m_opaque_sp(TypeSynthetic_impl_sp)
{
}
bool
SBTypeSynthetic::CopyOnWrite_Impl()
{
if (!IsValid())
return false;
if (m_opaque_sp.unique())
return true;
TypeSyntheticImplSP new_sp(new TypeSyntheticImpl(m_opaque_sp->GetOptions(),
m_opaque_sp->GetPythonClassName(),
m_opaque_sp->GetPythonCode()));
SetSP(new_sp);
return true;
}

View File

@ -399,7 +399,7 @@ public:
const char *name_cstr = NULL;
size_t idx;
SummaryFormatSP summary_format_sp;
TypeSummaryImplSP summary_format_sp;
if (!m_option_variable.summary.empty())
DataVisualization::NamedSummaryFormats::GetSummaryFormat(ConstString(m_option_variable.summary.c_str()), summary_format_sp);

View File

@ -37,7 +37,7 @@ class ScriptAddOptions
public:
SummaryFormat::Flags m_flags;
TypeSummaryImpl::Flags m_flags;
StringList m_target_types;
StringList m_user_source;
@ -48,7 +48,7 @@ public:
std::string m_category;
ScriptAddOptions(const SummaryFormat::Flags& flags,
ScriptAddOptions(const TypeSummaryImpl::Flags& flags,
bool regx,
const ConstString& name,
std::string catg) :
@ -133,7 +133,7 @@ private:
// Instance variables to hold the values for command options.
SummaryFormat::Flags m_flags;
TypeSummaryImpl::Flags m_flags;
bool m_regex;
std::string m_format_string;
ConstString m_name;
@ -181,7 +181,7 @@ public:
static bool
AddSummary(const ConstString& type_name,
lldb::SummaryFormatSP entry,
lldb::TypeSummaryImplSP entry,
SummaryFormatType type,
std::string category,
Error* error = NULL);
@ -496,12 +496,12 @@ public:
return false;
}
ValueFormatSP entry;
TypeFormatImplSP entry;
entry.reset(new ValueFormat(format,
m_command_options.m_cascade,
m_command_options.m_skip_pointers,
m_command_options.m_skip_references));
entry.reset(new TypeFormatImpl(format,
TypeFormatImpl::Flags().SetCascades(m_command_options.m_cascade).
SetSkipPointers(m_command_options.m_skip_pointers).
SetSkipReferences(m_command_options.m_skip_references)));
// now I have a valid format, let's add it to every type
@ -641,7 +641,7 @@ public:
// CommandObjectTypeFormatList
//-------------------------------------------------------------------------
bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const lldb::ValueFormatSP& entry);
bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const lldb::TypeFormatImplSP& entry);
class CommandObjectTypeFormatList;
@ -702,22 +702,19 @@ private:
bool
LoopCallback (ConstString type,
const lldb::ValueFormatSP& entry,
const lldb::TypeFormatImplSP& entry,
RegularExpression* regex,
CommandReturnObject *result)
{
if (regex == NULL || regex->Execute(type.AsCString()))
{
result->GetOutputStream().Printf ("%s: %s%s%s%s\n", type.AsCString(),
FormatManager::GetFormatAsCString (entry->m_format),
entry->m_cascades ? "" : " (not cascading)",
entry->m_skip_pointers ? " (skip pointers)" : "",
entry->m_skip_references ? " (skip references)" : "");
result->GetOutputStream().Printf ("%s: %s\n", type.AsCString(),
entry->GetDescription().c_str());
}
return true;
}
friend bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const lldb::ValueFormatSP& entry);
friend bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const lldb::TypeFormatImplSP& entry);
};
@ -725,7 +722,7 @@ bool
CommandObjectTypeFormatList_LoopCallback (
void* pt2self,
ConstString type,
const lldb::ValueFormatSP& entry)
const lldb::TypeFormatImplSP& entry)
{
CommandObjectTypeFormatList_LoopCallbackParam* param = (CommandObjectTypeFormatList_LoopCallbackParam*)pt2self;
return param->self->LoopCallback(type, entry, param->regex, param->result);
@ -850,10 +847,10 @@ public:
}
// now I have a valid function name, let's add this as script for every type in the list
SummaryFormatSP script_format;
TypeSummaryImplSP script_format;
script_format.reset(new ScriptSummaryFormat(options->m_flags,
std::string(funct_name),
options->m_user_source.CopyList(" ")));
funct_name,
options->m_user_source.CopyList(" ").c_str()));
Error error;
@ -1035,7 +1032,7 @@ CommandObjectTypeSummaryAdd::Execute_ScriptSummary (Args& command, CommandReturn
return false;
}
SummaryFormatSP script_format;
TypeSummaryImplSP script_format;
if (!m_options.m_python_function.empty()) // we have a Python function ready to use
{
@ -1054,9 +1051,11 @@ CommandObjectTypeSummaryAdd::Execute_ScriptSummary (Args& command, CommandReturn
return false;
}
std::string code = (" " + m_options.m_python_function + "(valobj,dict)");
script_format.reset(new ScriptSummaryFormat(m_options.m_flags,
std::string(funct_name),
" " + m_options.m_python_function + "(valobj,dict)"));
funct_name,
code.c_str()));
}
else if (!m_options.m_python_script.empty()) // we have a quick 1-line script, just use it
{
@ -1091,9 +1090,11 @@ CommandObjectTypeSummaryAdd::Execute_ScriptSummary (Args& command, CommandReturn
return false;
}
std::string code = " " + m_options.m_python_script;
script_format.reset(new ScriptSummaryFormat(m_options.m_flags,
std::string(funct_name),
" " + m_options.m_python_script));
funct_name,
code.c_str()));
}
else // use an InputReader to grab Python code from the user
{
@ -1189,7 +1190,7 @@ CommandObjectTypeSummaryAdd::Execute_StringSummary (Args& command, CommandReturn
Error error;
lldb::SummaryFormatSP entry(new StringSummaryFormat(m_options.m_flags,
lldb::TypeSummaryImplSP entry(new StringSummaryFormat(m_options.m_flags,
format_cstr));
if (error.Fail())
@ -1343,12 +1344,12 @@ CommandObjectTypeSummaryAdd::Execute (Args& command, CommandReturnObject &result
bool
CommandObjectTypeSummaryAdd::AddSummary(const ConstString& type_name,
SummaryFormatSP entry,
TypeSummaryImplSP entry,
SummaryFormatType type,
std::string category_name,
Error* error)
{
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(category_name.c_str()), category);
if (type == eRegexSummary)
@ -1475,11 +1476,11 @@ private:
static bool
PerCategoryCallback(void* param,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& category_sp)
{
ConstString *name = (ConstString*)param;
cate->Delete(*name, eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
return true;
ConstString *name = (ConstString*)param;
category_sp->Delete(*name, eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
return true;
}
public:
@ -1534,7 +1535,7 @@ public:
return result.Succeeded();
}
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()), category);
bool delete_category = category->Delete(typeCS,
@ -1631,7 +1632,7 @@ private:
static bool
PerCategoryCallback(void* param,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
cate->GetSummaryNavigator()->Clear();
cate->GetRegexSummaryNavigator()->Clear();
@ -1661,7 +1662,7 @@ public:
else
{
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
if (command.GetArgumentCount() > 0)
{
const char* cat_name = command.GetArgumentAtIndex(0);
@ -1840,14 +1841,14 @@ private:
static bool
PerCategoryCallback(void* param_vp,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
CommandObjectTypeSummaryList_LoopCallbackParam* param =
(CommandObjectTypeSummaryList_LoopCallbackParam*)param_vp;
CommandReturnObject* result = param->result;
const char* cate_name = cate->GetName().c_str();
const char* cate_name = cate->GetName();
// if the category is disabled or empty and there is no regex, just skip it
if ((cate->IsEnabled() == false || cate->GetCount(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary) == 0) && param->cate_regex == NULL)
@ -1874,7 +1875,7 @@ private:
bool
LoopCallback (const char* type,
const lldb::SummaryFormatSP& entry,
const lldb::TypeSummaryImplSP& entry,
RegularExpression* regex,
CommandReturnObject *result)
{
@ -1883,15 +1884,15 @@ private:
return true;
}
friend bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, ConstString type, const lldb::SummaryFormatSP& entry);
friend bool CommandObjectTypeRXSummaryList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const lldb::SummaryFormatSP& entry);
friend bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, ConstString type, const lldb::TypeSummaryImplSP& entry);
friend bool CommandObjectTypeRXSummaryList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const lldb::TypeSummaryImplSP& entry);
};
bool
CommandObjectTypeSummaryList_LoopCallback (
void* pt2self,
ConstString type,
const lldb::SummaryFormatSP& entry)
const lldb::TypeSummaryImplSP& entry)
{
CommandObjectTypeSummaryList_LoopCallbackParam* param = (CommandObjectTypeSummaryList_LoopCallbackParam*)pt2self;
return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
@ -1901,7 +1902,7 @@ bool
CommandObjectTypeRXSummaryList_LoopCallback (
void* pt2self,
lldb::RegularExpressionSP regex,
const lldb::SummaryFormatSP& entry)
const lldb::TypeSummaryImplSP& entry)
{
CommandObjectTypeSummaryList_LoopCallbackParam* param = (CommandObjectTypeSummaryList_LoopCallbackParam*)pt2self;
return param->self->LoopCallback(regex->GetText(), entry, param->regex, param->result);
@ -1967,7 +1968,7 @@ public:
return false;
}
DataVisualization::Categories::Enable(typeCS);
lldb::FormatCategorySP cate;
lldb::TypeCategoryImplSP cate;
if (DataVisualization::Categories::GetCategory(typeCS, cate) && cate.get())
{
if (cate->GetCount() == 0)
@ -2141,14 +2142,14 @@ private:
static bool
PerCategoryCallback(void* param_vp,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
CommandObjectTypeCategoryList_CallbackParam* param =
(CommandObjectTypeCategoryList_CallbackParam*)param_vp;
CommandReturnObject* result = param->result;
RegularExpression* regex = param->regex;
const char* cate_name = cate->GetName().c_str();
const char* cate_name = cate->GetName();
if (regex == NULL || regex->Execute(cate_name))
result->GetOutputStream().Printf("Category %s is%s enabled\n",
@ -2346,10 +2347,10 @@ private:
static bool
PerCategoryCallback(void* param_vp,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
const char* cate_name = cate->GetName().c_str();
const char* cate_name = cate->GetName();
CommandObjectTypeFilterList_LoopCallbackParam* param =
(CommandObjectTypeFilterList_LoopCallbackParam*)param_vp;
@ -2558,14 +2559,14 @@ private:
static bool
PerCategoryCallback(void* param_vp,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
CommandObjectTypeSynthList_LoopCallbackParam* param =
(CommandObjectTypeSynthList_LoopCallbackParam*)param_vp;
CommandReturnObject* result = param->result;
const char* cate_name = cate->GetName().c_str();
const char* cate_name = cate->GetName();
// if the category is disabled or empty and there is no regex, just skip it
if ((cate->IsEnabled() == false || cate->GetCount(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth) == 0) && param->cate_regex == NULL)
@ -2707,7 +2708,7 @@ private:
static bool
PerCategoryCallback(void* param,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
ConstString *name = (ConstString*)param;
return cate->Delete(*name, eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
@ -2765,7 +2766,7 @@ public:
return result.Succeeded();
}
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()), category);
bool delete_category = category->GetFilterNavigator()->Delete(typeCS);
@ -2871,7 +2872,7 @@ private:
static bool
PerCategoryCallback(void* param,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
ConstString* name = (ConstString*)param;
return cate->Delete(*name, eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
@ -2929,7 +2930,7 @@ public:
return result.Succeeded();
}
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()), category);
bool delete_category = category->GetSyntheticNavigator()->Delete(typeCS);
@ -3031,7 +3032,7 @@ private:
static bool
PerCategoryCallback(void* param,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
cate->Clear(eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter);
return true;
@ -3060,7 +3061,7 @@ public:
else
{
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
if (command.GetArgumentCount() > 0)
{
const char* cat_name = command.GetArgumentAtIndex(0);
@ -3158,7 +3159,7 @@ private:
static bool
PerCategoryCallback(void* param,
const lldb::FormatCategorySP& cate)
const lldb::TypeCategoryImplSP& cate)
{
cate->Clear(eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth);
return true;
@ -3187,7 +3188,7 @@ public:
else
{
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
if (command.GetArgumentCount() > 0)
{
const char* cat_name = command.GetArgumentAtIndex(0);
@ -3338,13 +3339,13 @@ public:
// everything should be fine now, let's add the synth provider class
SyntheticChildrenSP synth_provider;
synth_provider.reset(new SyntheticScriptProvider(options->m_cascade,
options->m_skip_pointers,
options->m_skip_references,
std::string(class_name)));
synth_provider.reset(new TypeSyntheticImpl(SyntheticChildren::Flags().SetCascades(options->m_cascade).
SetSkipPointers(options->m_skip_pointers).
SetSkipReferences(options->m_skip_references),
class_name));
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(options->m_category.c_str()), category);
Error error;
@ -3457,16 +3458,17 @@ CommandObjectTypeSynthAdd::Execute_PythonClass (Args& command, CommandReturnObje
SyntheticChildrenSP entry;
SyntheticScriptProvider* impl = new SyntheticScriptProvider(m_options.m_cascade,
m_options.m_skip_pointers,
m_options.m_skip_references,
m_options.m_class_name);
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());
entry.reset(impl);
// now I have a valid provider, let's add it to every type
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()), category);
Error error;
@ -3525,7 +3527,7 @@ CommandObjectTypeSynthAdd::AddSynth(const ConstString& type_name,
std::string category_name,
Error* error)
{
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(category_name.c_str()), category);
if (category->AnyMatches(type_name,
@ -3704,7 +3706,7 @@ private:
std::string category_name,
Error* error)
{
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(category_name.c_str()), category);
if (category->AnyMatches(type_name,
@ -3811,9 +3813,9 @@ public:
SyntheticChildrenSP entry;
SyntheticFilter* impl = new SyntheticFilter(m_options.m_cascade,
m_options.m_skip_pointers,
m_options.m_skip_references);
TypeFilterImpl* impl = new TypeFilterImpl(SyntheticChildren::Flags().SetCascades(m_options.m_cascade).
SetSkipPointers(m_options.m_skip_pointers).
SetSkipReferences(m_options.m_skip_references));
entry.reset(impl);
@ -3826,7 +3828,7 @@ public:
// now I have a valid provider, let's add it to every type
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
DataVisualization::Categories::GetCategory(ConstString(m_options.m_category.c_str()), category);
Error error;

View File

@ -38,16 +38,24 @@ DataVisualization::GetCurrentRevision ()
return GetFormatManager().GetCurrentRevision();
}
lldb::ValueFormatSP
lldb::TypeFormatImplSP
DataVisualization::ValueFormats::GetFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
{
lldb::ValueFormatSP entry;
lldb::TypeFormatImplSP entry;
GetFormatManager().GetValueNavigator().Get(valobj, entry, use_dynamic);
return entry;
}
lldb::TypeFormatImplSP
DataVisualization::ValueFormats::GetFormat (const ConstString &type)
{
lldb::TypeFormatImplSP entry;
GetFormatManager().GetValueNavigator().Get(type, entry);
return entry;
}
void
DataVisualization::ValueFormats::Add (const ConstString &type, const lldb::ValueFormatSP &entry)
DataVisualization::ValueFormats::Add (const ConstString &type, const lldb::TypeFormatImplSP &entry)
{
GetFormatManager().GetValueNavigator().Add(FormatManager::GetValidTypeName(type),entry);
}
@ -65,7 +73,7 @@ DataVisualization::ValueFormats::Clear ()
}
void
DataVisualization::ValueFormats::LoopThrough (ValueFormat::ValueCallback callback, void* callback_baton)
DataVisualization::ValueFormats::LoopThrough (TypeFormatImpl::ValueCallback callback, void* callback_baton)
{
GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
}
@ -76,7 +84,19 @@ DataVisualization::ValueFormats::GetCount ()
return GetFormatManager().GetValueNavigator().GetCount();
}
lldb::SummaryFormatSP
lldb::TypeNameSpecifierImplSP
DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex (uint32_t index)
{
return GetFormatManager().GetValueNavigator().GetTypeNameSpecifierAtIndex(index);
}
lldb::TypeFormatImplSP
DataVisualization::ValueFormats::GetFormatAtIndex (uint32_t index)
{
return GetFormatManager().GetValueNavigator().GetAtIndex(index);
}
lldb::TypeSummaryImplSP
DataVisualization::GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
@ -92,10 +112,10 @@ DataVisualization::GetSyntheticChildren (ValueObject& valobj,
bool
DataVisualization::AnyMatches (ConstString type_name,
FormatCategory::FormatCategoryItems items,
TypeCategoryImpl::FormatCategoryItems items,
bool only_enabled,
const char** matching_category,
FormatCategory::FormatCategoryItems* matching_type)
TypeCategoryImpl::FormatCategoryItems* matching_type)
{
return GetFormatManager().AnyMatches(type_name,
items,
@ -105,10 +125,11 @@ DataVisualization::AnyMatches (ConstString type_name,
}
bool
DataVisualization::Categories::GetCategory (const ConstString &category, lldb::FormatCategorySP &entry)
DataVisualization::Categories::GetCategory (const ConstString &category, lldb::TypeCategoryImplSP &entry,
bool allow_create)
{
entry = GetFormatManager().GetCategory(category);
return true;
entry = GetFormatManager().GetCategory(category, allow_create);
return (entry.get() != NULL);
}
void
@ -131,27 +152,43 @@ DataVisualization::Categories::Clear ()
}
void
DataVisualization::Categories::Clear (ConstString &category)
DataVisualization::Categories::Clear (const ConstString &category)
{
GetFormatManager().GetCategory(category)->Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
}
void
DataVisualization::Categories::Enable (ConstString& category)
DataVisualization::Categories::Enable (const ConstString& category,
CategoryMap::Position pos)
{
if (GetFormatManager().GetCategory(category)->IsEnabled() == false)
GetFormatManager().EnableCategory(category);
else
{
if (GetFormatManager().GetCategory(category)->IsEnabled())
GetFormatManager().DisableCategory(category);
GetFormatManager().EnableCategory(category);
GetFormatManager().EnableCategory(category, pos);
}
void
DataVisualization::Categories::Disable (const ConstString& category)
{
if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
GetFormatManager().DisableCategory(category);
}
void
DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
CategoryMap::Position pos)
{
if (category.get())
{
if (category->IsEnabled())
GetFormatManager().DisableCategory(category);
GetFormatManager().EnableCategory(category, pos);
}
}
void
DataVisualization::Categories::Disable (ConstString& category)
DataVisualization::Categories::Disable (const lldb::TypeCategoryImplSP& category)
{
if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
if (category.get() && category->IsEnabled() == true)
GetFormatManager().DisableCategory(category);
}
@ -167,14 +204,20 @@ DataVisualization::Categories::GetCount ()
return GetFormatManager().GetCategoriesCount();
}
lldb::TypeCategoryImplSP
DataVisualization::Categories::GetCategoryAtIndex (uint32_t index)
{
return GetFormatManager().GetCategoryAtIndex(index);
}
bool
DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::SummaryFormatSP &entry)
DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry)
{
return GetFormatManager().GetNamedSummaryNavigator().Get(type,entry);
}
void
DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::SummaryFormatSP &entry)
DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry)
{
GetFormatManager().GetNamedSummaryNavigator().Add(FormatManager::GetValidTypeName(type),entry);
}
@ -192,7 +235,7 @@ DataVisualization::NamedSummaryFormats::Clear ()
}
void
DataVisualization::NamedSummaryFormats::LoopThrough (SummaryFormat::SummaryCallback callback, void* callback_baton)
DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
{
GetFormatManager().GetNamedSummaryNavigator().LoopThrough(callback, callback_baton);
}

View File

@ -729,6 +729,27 @@ Debugger::GetAsyncErrorStream ()
CommandInterpreter::eBroadcastBitAsynchronousErrorData));
}
uint32_t
Debugger::GetNumDebuggers()
{
Mutex::Locker locker (GetDebuggerListMutex ());
return GetDebuggerList().size();
}
lldb::DebuggerSP
Debugger::GetDebuggerAtIndex (uint32_t index)
{
DebuggerSP debugger_sp;
Mutex::Locker locker (GetDebuggerListMutex ());
DebuggerList &debugger_list = GetDebuggerList();
if (index < debugger_list.size())
debugger_sp = debugger_list[index];
return debugger_sp;
}
DebuggerSP
Debugger::FindDebuggerWithID (lldb::user_id_t id)
{

View File

@ -44,29 +44,39 @@ struct PyObject;
using namespace lldb;
using namespace lldb_private;
ValueFormat::ValueFormat (lldb::Format f,
bool casc,
bool skipptr,
bool skipref) :
m_cascades(casc),
m_skip_pointers(skipptr),
m_skip_references(skipref),
TypeFormatImpl::TypeFormatImpl (lldb::Format f,
const Flags& flags) :
m_flags(flags),
m_format (f)
{
}
SummaryFormat::SummaryFormat(const SummaryFormat::Flags& flags) :
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)
{
}
StringSummaryFormat::StringSummaryFormat(const SummaryFormat::Flags& flags,
std::string f) :
SummaryFormat(flags),
m_format(f)
{
}
StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char *format_cstr) :
TypeSummaryImpl(flags),
m_format()
{
if (format_cstr)
m_format.assign(format_cstr);
}
std::string
StringSummaryFormat::FormatObject(lldb::ValueObjectSP object)
@ -141,15 +151,19 @@ StringSummaryFormat::GetDescription()
#ifndef LLDB_DISABLE_PYTHON
ScriptSummaryFormat::ScriptSummaryFormat(const SummaryFormat::Flags& flags,
std::string fname,
std::string pscri) :
SummaryFormat(flags),
m_function_name(fname),
m_python_script(pscri)
{
}
ScriptSummaryFormat::ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char * function_name,
const char * python_script) :
TypeSummaryImpl(flags),
m_function_name(),
m_python_script()
{
if (function_name)
m_function_name.assign(function_name);
if (python_script)
m_python_script.assign(python_script);
}
std::string
ScriptSummaryFormat::FormatObject(lldb::ValueObjectSP object)
@ -177,18 +191,18 @@ ScriptSummaryFormat::GetDescription()
#endif // #ifndef LLDB_DISABLE_PYTHON
std::string
SyntheticFilter::GetDescription()
TypeFilterImpl::GetDescription()
{
StreamString sstr;
sstr.Printf("%s%s%s {\n",
m_cascades ? "" : " (not cascading)",
m_skip_pointers ? " (skip pointers)" : "",
m_skip_references ? " (skip references)" : "");
Cascades() ? "" : " (not cascading)",
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "");
for (int i = 0; i < GetCount(); i++)
{
sstr.Printf(" %s\n",
GetExpressionPathAtIndex(i).c_str());
GetExpressionPathAtIndex(i));
}
sstr.Printf("}");
@ -200,9 +214,10 @@ SyntheticArrayView::GetDescription()
{
StreamString sstr;
sstr.Printf("%s%s%s {\n",
m_cascades ? "" : " (not cascading)",
m_skip_pointers ? " (skip pointers)" : "",
m_skip_references ? " (skip references)" : "");
Cascades() ? "" : " (not cascading)",
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "");
SyntheticArrayRange* ptr = &m_head;
while (ptr && ptr != m_tail)
{
@ -222,7 +237,7 @@ SyntheticArrayView::GetDescription()
#ifndef LLDB_DISABLE_PYTHON
SyntheticScriptProvider::FrontEnd::FrontEnd(std::string pclass,
TypeSyntheticImpl::FrontEnd::FrontEnd(std::string pclass,
lldb::ValueObjectSP be) :
SyntheticChildrenFrontEnd(be),
m_python_class(pclass)
@ -242,13 +257,13 @@ SyntheticScriptProvider::FrontEnd::FrontEnd(std::string pclass,
m_wrapper = m_interpreter->CreateSyntheticScriptedProvider(m_python_class, m_backend);
}
SyntheticScriptProvider::FrontEnd::~FrontEnd()
TypeSyntheticImpl::FrontEnd::~FrontEnd()
{
Py_XDECREF((PyObject*)m_wrapper);
}
lldb::ValueObjectSP
SyntheticScriptProvider::FrontEnd::GetChildAtIndex (uint32_t idx, bool can_create)
TypeSyntheticImpl::FrontEnd::GetChildAtIndex (uint32_t idx, bool can_create)
{
if (m_wrapper == NULL || m_interpreter == NULL)
return lldb::ValueObjectSP();
@ -257,13 +272,13 @@ SyntheticScriptProvider::FrontEnd::GetChildAtIndex (uint32_t idx, bool can_creat
}
std::string
SyntheticScriptProvider::GetDescription()
TypeSyntheticImpl::GetDescription()
{
StreamString sstr;
sstr.Printf("%s%s%s Python class %s",
m_cascades ? "" : " (not cascading)",
m_skip_pointers ? " (skip pointers)" : "",
m_skip_references ? " (skip references)" : "",
Cascades() ? "" : " (not cascading)",
SkipsPointers() ? " (skip pointers)" : "",
SkipsReferences() ? " (skip references)" : "",
m_python_class.c_str());
return sstr.GetString();

View File

@ -157,8 +157,8 @@ FormatManager::GetFormatAsCString (Format format)
return NULL;
}
FormatCategory::FormatCategory(IFormatChangeListener* clist,
std::string name) :
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)),
@ -174,8 +174,8 @@ FormatCategory::FormatCategory(IFormatChangeListener* clist,
{}
bool
FormatCategory::Get (ValueObject& valobj,
lldb::SummaryFormatSP& entry,
TypeCategoryImpl::Get (ValueObject& valobj,
lldb::TypeSummaryImplSP& entry,
lldb::DynamicValueType use_dynamic,
uint32_t* reason)
{
@ -190,14 +190,14 @@ FormatCategory::Get (ValueObject& valobj,
}
bool
FormatCategory::Get(ValueObject& valobj,
TypeCategoryImpl::Get(ValueObject& valobj,
lldb::SyntheticChildrenSP& entry_sp,
lldb::DynamicValueType use_dynamic,
uint32_t* reason)
{
if (!IsEnabled())
return false;
SyntheticFilter::SharedPointer filter_sp;
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
@ -209,7 +209,7 @@ FormatCategory::Get(ValueObject& valobj,
bool regex_synth = false;
uint32_t reason_synth = 0;
bool pick_synth = false;
SyntheticScriptProvider::SharedPointer synth;
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())
@ -222,7 +222,7 @@ FormatCategory::Get(ValueObject& valobj,
else /*if (filter_sp.get() && synth.get())*/
{
if (filter_sp->m_my_revision > synth->m_my_revision)
if (filter_sp->GetRevision() > synth->GetRevision())
pick_synth = false;
else
pick_synth = true;
@ -255,7 +255,7 @@ FormatCategory::Get(ValueObject& valobj,
}
void
FormatCategory::Clear (FormatCategoryItems items)
TypeCategoryImpl::Clear (FormatCategoryItems items)
{
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
m_summary_nav->Clear();
@ -274,7 +274,7 @@ FormatCategory::Clear (FormatCategoryItems items)
}
bool
FormatCategory::Delete (ConstString name,
TypeCategoryImpl::Delete (ConstString name,
FormatCategoryItems items)
{
bool success = false;
@ -296,7 +296,7 @@ FormatCategory::Delete (ConstString name,
}
uint32_t
FormatCategory::GetCount (FormatCategoryItems items)
TypeCategoryImpl::GetCount (FormatCategoryItems items)
{
uint32_t count = 0;
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
@ -317,7 +317,7 @@ FormatCategory::GetCount (FormatCategoryItems items)
}
bool
FormatCategory::AnyMatches(ConstString type_name,
TypeCategoryImpl::AnyMatches(ConstString type_name,
FormatCategoryItems items,
bool only_enabled,
const char** matching_category,
@ -326,10 +326,10 @@ FormatCategory::AnyMatches(ConstString type_name,
if (!IsEnabled() && only_enabled)
return false;
lldb::SummaryFormatSP summary;
SyntheticFilter::SharedPointer filter;
lldb::TypeSummaryImplSP summary;
TypeFilterImpl::SharedPointer filter;
#ifndef LLDB_DISABLE_PYTHON
SyntheticScriptProvider::SharedPointer synth;
TypeSyntheticImpl::SharedPointer synth;
#endif
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
@ -337,7 +337,7 @@ FormatCategory::AnyMatches(ConstString type_name,
if (m_summary_nav->Get(type_name, summary))
{
if (matching_category)
*matching_category = m_name.c_str();
*matching_category = m_name.GetCString();
if (matching_type)
*matching_type = eFormatCategoryItemSummary;
return true;
@ -348,7 +348,7 @@ FormatCategory::AnyMatches(ConstString type_name,
if (m_regex_summary_nav->Get(type_name, summary))
{
if (matching_category)
*matching_category = m_name.c_str();
*matching_category = m_name.GetCString();
if (matching_type)
*matching_type = eFormatCategoryItemRegexSummary;
return true;
@ -359,7 +359,7 @@ FormatCategory::AnyMatches(ConstString type_name,
if (m_filter_nav->Get(type_name, filter))
{
if (matching_category)
*matching_category = m_name.c_str();
*matching_category = m_name.GetCString();
if (matching_type)
*matching_type = eFormatCategoryItemFilter;
return true;
@ -370,7 +370,7 @@ FormatCategory::AnyMatches(ConstString type_name,
if (m_regex_filter_nav->Get(type_name, filter))
{
if (matching_category)
*matching_category = m_name.c_str();
*matching_category = m_name.GetCString();
if (matching_type)
*matching_type = eFormatCategoryItemRegexFilter;
return true;
@ -382,7 +382,7 @@ FormatCategory::AnyMatches(ConstString type_name,
if (m_synth_nav->Get(type_name, synth))
{
if (matching_category)
*matching_category = m_name.c_str();
*matching_category = m_name.GetCString();
if (matching_type)
*matching_type = eFormatCategoryItemSynth;
return true;
@ -393,7 +393,7 @@ FormatCategory::AnyMatches(ConstString type_name,
if (m_regex_synth_nav->Get(type_name, synth))
{
if (matching_category)
*matching_category = m_name.c_str();
*matching_category = m_name.GetCString();
if (matching_type)
*matching_type = eFormatCategoryItemRegexSynth;
return true;
@ -405,10 +405,10 @@ FormatCategory::AnyMatches(ConstString type_name,
bool
CategoryMap::AnyMatches (ConstString type_name,
FormatCategory::FormatCategoryItems items,
bool only_enabled,
const char** matching_category,
FormatCategory::FormatCategoryItems* matching_type)
TypeCategoryImpl::FormatCategoryItems items,
bool only_enabled,
const char** matching_category,
TypeCategoryImpl::FormatCategoryItems* matching_type)
{
Mutex::Locker(m_map_mutex);
@ -425,7 +425,7 @@ CategoryMap::AnyMatches (ConstString type_name,
return false;
}
lldb::SummaryFormatSP
lldb::TypeSummaryImplSP
CategoryMap::GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic)
{
@ -436,13 +436,13 @@ CategoryMap::GetSummaryFormat (ValueObject& valobj,
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::FormatCategorySP category = *begin;
lldb::SummaryFormatSP current_format;
lldb::TypeCategoryImplSP category = *begin;
lldb::TypeSummaryImplSP current_format;
if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
continue;
return current_format;
}
return lldb::SummaryFormatSP();
return lldb::TypeSummaryImplSP();
}
lldb::SyntheticChildrenSP
@ -457,7 +457,7 @@ CategoryMap::GetSyntheticChildren (ValueObject& valobj,
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::FormatCategorySP category = *begin;
lldb::TypeCategoryImplSP category = *begin;
lldb::SyntheticChildrenSP current_format;
if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
continue;
@ -478,8 +478,8 @@ CategoryMap::LoopThrough(CallbackType callback, void* param)
ActiveCategoriesIterator begin, end = m_active_categories.end();
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::FormatCategorySP category = *begin;
ConstString type = ConstString(category->GetName().c_str());
lldb::TypeCategoryImplSP category = *begin;
ConstString type = ConstString(category->GetName());
if (!callback(param, category))
break;
}
@ -500,20 +500,39 @@ CategoryMap::LoopThrough(CallbackType callback, void* param)
}
}
lldb::FormatCategorySP
TypeCategoryImplSP
CategoryMap::GetAtIndex (uint32_t index)
{
Mutex::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)
{
if (!category_name)
return GetCategory(m_default_category_name);
lldb::FormatCategorySP category;
lldb::TypeCategoryImplSP category;
if (m_categories_map.Get(category_name, category))
return category;
if (!can_create)
return lldb::FormatCategorySP();
return lldb::TypeCategoryImplSP();
m_categories_map.Add(category_name,lldb::FormatCategorySP(new FormatCategory(this, category_name.AsCString())));
m_categories_map.Add(category_name,lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name)));
return GetCategory(category_name);
}
@ -566,35 +585,33 @@ FormatManager::FormatManager() :
// add some default stuff
// most formats, summaries, ... actually belong to the users' lldbinit file rather than here
lldb::SummaryFormatSP string_format(new StringSummaryFormat(SummaryFormat::Flags().SetCascades(false)
.SetSkipPointers(true)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(false)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"${var%s}"));
lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
.SetSkipPointers(true)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(false)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"${var%s}"));
lldb::SummaryFormatSP string_array_format(new StringSummaryFormat(SummaryFormat::Flags().SetCascades(false)
.SetSkipPointers(true)
.SetSkipReferences(false)
.SetDontShowChildren(false)
.SetDontShowValue(true)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"${var%s}"));
lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
.SetSkipPointers(true)
.SetSkipReferences(false)
.SetDontShowChildren(false)
.SetDontShowValue(true)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"${var%s}"));
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
FormatCategory::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
sys_category_sp->GetSummaryNavigator()->Add(ConstString("const char *"), string_format);
sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
GetCategory(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
// WARNING: temporary code!!
// The platform should be responsible for initializing its own formatters
// (e.g. to handle versioning, different runtime libraries, ...)
@ -602,16 +619,16 @@ FormatManager::FormatManager() :
// the GNU libstdc++ are defined regardless, and enabled by default
// This is going to be moved to some platform-dependent location
// (in the meanwhile, these formatters should work for Mac OS X & Linux)
lldb::SummaryFormatSP std_string_summary_sp(new StringSummaryFormat(SummaryFormat::Flags().SetCascades(true)
.SetSkipPointers(false)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(true)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"${var._M_dataplus._M_p}"));
lldb::TypeSummaryImplSP std_string_summary_sp(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(true)
.SetSkipPointers(false)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(true)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"${var._M_dataplus._M_p}"));
FormatCategory::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
TypeCategoryImpl::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::string"),
std_string_summary_sp);
@ -624,40 +641,34 @@ FormatManager::FormatManager() :
#ifndef LLDB_DISABLE_PYTHON
SyntheticChildren::Flags stl_synth_flags;
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::)?vector<.+>$")),
SyntheticChildrenSP(new SyntheticScriptProvider(true,
false,
false,
"gnu_libstdcpp.StdVectorSynthProvider")));
SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
"gnu_libstdcpp.StdVectorSynthProvider")));
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::)?map<.+> >$")),
SyntheticChildrenSP(new SyntheticScriptProvider(true,
false,
false,
"gnu_libstdcpp.StdMapSynthProvider")));
SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
"gnu_libstdcpp.StdMapSynthProvider")));
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::)?list<.+>$")),
SyntheticChildrenSP(new SyntheticScriptProvider(true,
false,
false,
"gnu_libstdcpp.StdListSynthProvider")));
SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
"gnu_libstdcpp.StdListSynthProvider")));
lldb::SummaryFormatSP ObjC_BOOL_summary(new ScriptSummaryFormat(SummaryFormat::Flags().SetCascades(false)
.SetSkipPointers(false)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(true)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"objc.BOOL_SummaryProvider",
""));
FormatCategory::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
lldb::TypeSummaryImplSP ObjC_BOOL_summary(new ScriptSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
.SetSkipPointers(false)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(true)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false),
"objc.BOOL_SummaryProvider",
""));
TypeCategoryImpl::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"),
ObjC_BOOL_summary);
#endif
// DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
EnableCategory(m_system_category_name);
EnableCategory(m_objc_category_name);
EnableCategory(m_gnu_cpp_category_name);
EnableCategory(m_default_category_name);
EnableCategory(m_objc_category_name,CategoryMap::Last);
EnableCategory(m_gnu_cpp_category_name,CategoryMap::Last);
EnableCategory(m_system_category_name,CategoryMap::Last);
}

View File

@ -575,7 +575,7 @@ ValueObject::GetSummaryAsCString ()
{
if (m_summary_str.empty())
{
SummaryFormat *summary_format = GetSummaryFormat().get();
TypeSummaryImpl *summary_format = GetSummaryFormat().get();
if (summary_format)
{
@ -1771,7 +1771,7 @@ ValueObject::GetSyntheticArrayRangeChild (uint32_t from, uint32_t to, bool can_c
// 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();
SyntheticArrayView *view = new SyntheticArrayView(SyntheticChildren::Flags());
view->AddRange(from,to);
SyntheticChildrenSP view_sp(view);
synthetic_child = new ValueObjectSynthetic(*this, view_sp);
@ -3075,7 +3075,7 @@ ValueObject::DumpValueObject
std::string value_str;
const char *val_cstr = NULL;
const char *sum_cstr = NULL;
SummaryFormat* entry = valobj->GetSummaryFormat().get();
TypeSummaryImpl* entry = valobj->GetSummaryFormat().get();
if (omit_summary_depth > 0)
entry = NULL;

View File

@ -1140,7 +1140,7 @@ ScriptInterpreterPython::GenerateFunction(std::string& signature, StringList &in
// this implementation is identical to GenerateBreakpointCommandCallbackData (apart from the name
// given to generated functions, of course)
bool
ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, StringList &output)
ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, StringList &output, void* name_token)
{
static int num_created_functions = 0;
user_input.RemoveBlankLines ();
@ -1154,7 +1154,10 @@ ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, Str
// Take what the user wrote, wrap it all up inside one big auto-generated Python function, passing in the
// ValueObject as parameter to the function.
sstr.Printf ("lldb_autogen_python_type_print_func_%d", num_created_functions);
if (!name_token)
sstr.Printf ("lldb_autogen_python_type_print_func_%d", num_created_functions);
else
sstr.Printf ("lldb_gen_python_type_print_func_%p", name_token);
++num_created_functions;
std::string auto_generated_function_name = sstr.GetData();
@ -1267,7 +1270,7 @@ ScriptInterpreterPython::GenerateScriptAliasFunction (StringList &user_input, St
bool
ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringList &output)
ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringList &output, void* name_token)
{
static int num_created_classes = 0;
user_input.RemoveBlankLines ();
@ -1280,7 +1283,10 @@ ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringL
// Wrap all user input into a Python class
sstr.Printf ("lldb_autogen_python_type_synth_class_%d", num_created_classes);
if (!name_token)
sstr.Printf ("lldb_autogen_python_type_synth_class_%d", num_created_classes);
else
sstr.Printf ("lldb_gen_python_type_synth_class_%p", name_token);
++num_created_classes;
std::string auto_generated_class_name = sstr.GetData();
@ -1349,12 +1355,22 @@ ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name
}
bool
ScriptInterpreterPython::GenerateTypeScriptFunction (const char* oneliner, StringList &output)
ScriptInterpreterPython::GenerateTypeScriptFunction (const char* oneliner, StringList &output, void* name_token)
{
StringList input(oneliner);
return GenerateTypeScriptFunction(input, output);
StringList input;
input.SplitIntoLines(oneliner, strlen(oneliner));
return GenerateTypeScriptFunction(input, output, name_token);
}
bool
ScriptInterpreterPython::GenerateTypeSynthClass (const char* oneliner, StringList &output, void* name_token)
{
StringList input;
input.SplitIntoLines(oneliner, strlen(oneliner));
return GenerateTypeSynthClass(input, output, name_token);
}
bool
ScriptInterpreterPython::GenerateBreakpointCommandCallbackData (StringList &user_input, StringList &callback_data)
{
@ -1775,12 +1791,12 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
return false;
}
// call __lldb_module_init(debugger,dict)
// call __lldb_init_module(debugger,dict)
if (!g_swig_call_module_init (basename,
m_dictionary_name.c_str(),
debugger_sp))
{
error.SetErrorString("calling __lldb_module_init failed");
error.SetErrorString("calling __lldb_init_module failed");
return false;
}
return true;