forked from OSchip/llvm-project
First round of code cleanups:
- all instances of "vobj" have been renamed to "valobj" - class Debugger::Formatting has been renamed to DataVisualization (defined in FormatManager.h/cpp) The interface to this class has not changed - FormatCategory now uses ConstString's as keys to the navigators instead of repeatedly casting from ConstString to const char* and back all the time Next step is making the same happen for categories themselves - category gnu-libstdc++ is defined in the constructor for a FormatManager The source code for it is defined in gnu_libstdcpp.py, drawn from examples/synthetic at compile time All references to previous 'osxcpp' name have been removed from both code and file names Functional changes: - the name of the option to use a summary string for 'type summary add' has changed from the previous --format-string to the new --summary-string. It is expected that the short option will change from -f to -s, and -s for --python-script will become -o llvm-svn: 137886
This commit is contained in:
parent
1a87fcb9ba
commit
c482a19294
|
@ -270,12 +270,6 @@ public:
|
|||
static void
|
||||
SettingsTerminate ();
|
||||
|
||||
static void
|
||||
FormatManagerInitialize();
|
||||
|
||||
static void
|
||||
FormatManagerTerminate();
|
||||
|
||||
static void
|
||||
Destroy (lldb::DebuggerSP &debugger_sp);
|
||||
|
||||
|
@ -422,7 +416,7 @@ public:
|
|||
const Address *addr,
|
||||
Stream &s,
|
||||
const char **end,
|
||||
ValueObject* vobj = NULL);
|
||||
ValueObject* valobj = NULL);
|
||||
|
||||
|
||||
void
|
||||
|
@ -478,117 +472,6 @@ private:
|
|||
|
||||
DISALLOW_COPY_AND_ASSIGN (Debugger);
|
||||
|
||||
public:
|
||||
|
||||
class Formatting
|
||||
{
|
||||
public:
|
||||
|
||||
// use this call to force the FM to consider itself updated even when there is no apparent reason for that
|
||||
static void
|
||||
ForceUpdate();
|
||||
|
||||
class ValueFormats
|
||||
{
|
||||
public:
|
||||
static bool
|
||||
Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry);
|
||||
|
||||
static void
|
||||
Add(const ConstString &type, const ValueFormat::SharedPointer &entry);
|
||||
|
||||
static bool
|
||||
Delete(const ConstString &type);
|
||||
|
||||
static void
|
||||
Clear();
|
||||
|
||||
static void
|
||||
LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton);
|
||||
|
||||
static uint32_t
|
||||
GetCurrentRevision();
|
||||
|
||||
static uint32_t
|
||||
GetCount();
|
||||
};
|
||||
|
||||
static bool
|
||||
GetSummaryFormat(ValueObject& vobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SummaryFormatSP& entry);
|
||||
static bool
|
||||
GetSyntheticChildren(ValueObject& vobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SyntheticChildrenSP& entry);
|
||||
|
||||
static bool
|
||||
AnyMatches(ConstString type_name,
|
||||
FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
|
||||
bool only_enabled = true,
|
||||
const char** matching_category = NULL,
|
||||
FormatCategory::FormatCategoryItems* matching_type = NULL);
|
||||
|
||||
class NamedSummaryFormats
|
||||
{
|
||||
public:
|
||||
static bool
|
||||
Get(const ConstString &type, SummaryFormat::SharedPointer &entry);
|
||||
|
||||
static void
|
||||
Add(const ConstString &type, const SummaryFormat::SharedPointer &entry);
|
||||
|
||||
static bool
|
||||
Delete(const ConstString &type);
|
||||
|
||||
static void
|
||||
Clear();
|
||||
|
||||
static void
|
||||
LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton);
|
||||
|
||||
static uint32_t
|
||||
GetCurrentRevision();
|
||||
|
||||
static uint32_t
|
||||
GetCount();
|
||||
};
|
||||
|
||||
class Categories
|
||||
{
|
||||
public:
|
||||
|
||||
static bool
|
||||
Get(const ConstString &category, lldb::FormatCategorySP &entry);
|
||||
|
||||
static void
|
||||
Add(const ConstString &category);
|
||||
|
||||
static bool
|
||||
Delete(const ConstString &category);
|
||||
|
||||
static void
|
||||
Clear();
|
||||
|
||||
static void
|
||||
Clear(ConstString &category);
|
||||
|
||||
static void
|
||||
Enable(ConstString& category);
|
||||
|
||||
static void
|
||||
Disable(ConstString& category);
|
||||
|
||||
static void
|
||||
LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton);
|
||||
|
||||
static uint32_t
|
||||
GetCurrentRevision();
|
||||
|
||||
static uint32_t
|
||||
GetCount();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
|
|
@ -57,7 +57,7 @@ struct ValueFormat
|
|||
}
|
||||
|
||||
typedef lldb::SharedPtr<ValueFormat>::Type SharedPointer;
|
||||
typedef bool(*ValueCallback)(void*, const char*, const ValueFormat::SharedPointer&);
|
||||
typedef bool(*ValueCallback)(void*, ConstString, const ValueFormat::SharedPointer&);
|
||||
|
||||
~ValueFormat()
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
GetFrontEnd(lldb::ValueObjectSP backend) = 0;
|
||||
|
||||
typedef lldb::SharedPtr<SyntheticChildren>::Type SharedPointer;
|
||||
typedef bool(*SyntheticChildrenCallback)(void*, const char*, const SyntheticChildren::SharedPointer&);
|
||||
typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
|
||||
|
||||
};
|
||||
|
||||
|
@ -453,7 +453,7 @@ struct SummaryFormat
|
|||
GetDescription() = 0;
|
||||
|
||||
typedef lldb::SharedPtr<SummaryFormat>::Type SharedPointer;
|
||||
typedef bool(*SummaryCallback)(void*, const char*, const SummaryFormat::SharedPointer&);
|
||||
typedef bool(*SummaryCallback)(void*, ConstString, const SummaryFormat::SharedPointer&);
|
||||
typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const SummaryFormat::SharedPointer&);
|
||||
|
||||
};
|
||||
|
|
|
@ -227,23 +227,23 @@ public:
|
|||
m_format_map.Add(type,entry);
|
||||
}
|
||||
|
||||
// using const char* instead of MapKeyType is necessary here
|
||||
// using ConstString instead of MapKeyType is necessary here
|
||||
// to make the partial template specializations below work
|
||||
bool
|
||||
Delete(const char *type)
|
||||
Delete(ConstString type)
|
||||
{
|
||||
return m_format_map.Delete(type);
|
||||
}
|
||||
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
MapValueType& entry,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
uint32_t* why = NULL)
|
||||
{
|
||||
uint32_t value = lldb::eFormatterChoiceCriterionDirectChoice;
|
||||
clang::QualType type = clang::QualType::getFromOpaquePtr(vobj.GetClangType());
|
||||
bool ret = Get(vobj, type, entry, use_dynamic, value);
|
||||
clang::QualType type = clang::QualType::getFromOpaquePtr(valobj.GetClangType());
|
||||
bool ret = Get(valobj, type, entry, use_dynamic, value);
|
||||
if (ret)
|
||||
entry = MapValueType(entry);
|
||||
else
|
||||
|
@ -277,15 +277,15 @@ private:
|
|||
|
||||
ConstString m_id_cs;
|
||||
|
||||
// using const char* instead of MapKeyType is necessary here
|
||||
// using ConstString instead of MapKeyType is necessary here
|
||||
// to make the partial template specializations below work
|
||||
bool
|
||||
Get(const char* type, MapValueType& entry)
|
||||
Get(ConstString type, MapValueType& entry)
|
||||
{
|
||||
return m_format_map.Get(type, entry);
|
||||
}
|
||||
|
||||
bool Get_ObjC(ValueObject& vobj,
|
||||
bool Get_ObjC(ValueObject& valobj,
|
||||
ObjCLanguageRuntime::ObjCISA isa,
|
||||
MapValueType& entry,
|
||||
uint32_t& reason)
|
||||
|
@ -293,7 +293,7 @@ private:
|
|||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
|
||||
if (log)
|
||||
log->Printf("going to an Objective-C dynamic scanning");
|
||||
Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
|
||||
Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
|
||||
ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
|
||||
if (runtime == NULL)
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ private:
|
|||
ConstString name = runtime->GetActualTypeName(isa);
|
||||
if (log)
|
||||
log->Printf("looking for formatter for %s", name.GetCString());
|
||||
if (Get(name.GetCString(), entry))
|
||||
if (Get(name, entry))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("direct match found, returning");
|
||||
|
@ -331,7 +331,7 @@ private:
|
|||
log->Printf("parent-child loop, bailing out");
|
||||
return false;
|
||||
}
|
||||
if (Get_ObjC(vobj, parent, entry, reason))
|
||||
if (Get_ObjC(valobj, parent, entry, reason))
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
|
||||
return true;
|
||||
|
@ -339,7 +339,7 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Get(ValueObject& vobj,
|
||||
bool Get(ValueObject& valobj,
|
||||
clang::QualType type,
|
||||
MapValueType& entry,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
|
@ -361,17 +361,16 @@ private:
|
|||
log->Printf("type is NULL, returning");
|
||||
return false;
|
||||
}
|
||||
ConstString name(ClangASTType::GetTypeNameForQualType(type).c_str());
|
||||
const char* typeName = name.GetCString();
|
||||
if (vobj.GetBitfieldBitSize() > 0)
|
||||
ConstString typeName(ClangASTType::GetTypeNameForQualType(type).c_str());
|
||||
if (valobj.GetBitfieldBitSize() > 0)
|
||||
{
|
||||
// for bitfields, append size to the typename so one can custom format them
|
||||
StreamString sstring;
|
||||
sstring.Printf("%s:%d",typeName,vobj.GetBitfieldBitSize());
|
||||
sstring.Printf("%s:%d",typeName.AsCString(),valobj.GetBitfieldBitSize());
|
||||
ConstString bitfieldname = ConstString(sstring.GetData());
|
||||
if (log)
|
||||
log->Printf("appended bitfield info, final result is %s", bitfieldname.GetCString());
|
||||
if (Get(bitfieldname.AsCString(), entry))
|
||||
if (Get(bitfieldname, entry))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("bitfield direct match found, returning");
|
||||
|
@ -387,8 +386,8 @@ private:
|
|||
if (log)
|
||||
log->Printf("trying to get %s for VO name %s of type %s",
|
||||
m_name.c_str(),
|
||||
vobj.GetName().AsCString(),
|
||||
typeName);
|
||||
valobj.GetName().AsCString(),
|
||||
typeName.AsCString());
|
||||
if (Get(typeName, entry))
|
||||
{
|
||||
if (log)
|
||||
|
@ -402,7 +401,7 @@ private:
|
|||
{
|
||||
if (log)
|
||||
log->Printf("stripping reference");
|
||||
if (Get(vobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
|
||||
if (Get(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
|
||||
return true;
|
||||
|
@ -410,11 +409,11 @@ private:
|
|||
}
|
||||
if (use_dynamic != lldb::eNoDynamicValues &&
|
||||
(/*strstr(typeName, "id") == typeName ||*/
|
||||
ClangASTType::GetMinimumLanguage(vobj.GetClangAST(), vobj.GetClangType()) == lldb::eLanguageTypeObjC))
|
||||
ClangASTType::GetMinimumLanguage(valobj.GetClangAST(), valobj.GetClangType()) == lldb::eLanguageTypeObjC))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("this is an ObjC 'id', let's do dynamic search");
|
||||
Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
|
||||
Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
|
||||
ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
|
||||
if (runtime == NULL)
|
||||
{
|
||||
|
@ -423,7 +422,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Get_ObjC(vobj, runtime->GetISA(vobj), entry, reason))
|
||||
if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
|
||||
return true;
|
||||
|
@ -433,7 +432,7 @@ private:
|
|||
else if (use_dynamic != lldb::eNoDynamicValues && log)
|
||||
{
|
||||
log->Printf("typename: %s, typePtr = %p, id = %p",
|
||||
name.AsCString(), typePtr, vobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
|
||||
typeName.AsCString(), typePtr, valobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
|
||||
}
|
||||
else if (log)
|
||||
{
|
||||
|
@ -444,7 +443,7 @@ private:
|
|||
if (log)
|
||||
log->Printf("stripping pointer");
|
||||
clang::QualType pointee = typePtr->getPointeeType();
|
||||
if (Get(vobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
|
||||
if (Get(valobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
|
||||
return true;
|
||||
|
@ -453,11 +452,11 @@ private:
|
|||
if (typePtr->isObjCObjectPointerType())
|
||||
{
|
||||
if (use_dynamic != lldb::eNoDynamicValues &&
|
||||
name.GetCString() == m_id_cs.GetCString())
|
||||
typeName == m_id_cs)
|
||||
{
|
||||
if (log)
|
||||
log->Printf("this is an ObjC 'id', let's do dynamic search");
|
||||
Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
|
||||
Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
|
||||
ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
|
||||
if (runtime == NULL)
|
||||
{
|
||||
|
@ -466,7 +465,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Get_ObjC(vobj, runtime->GetISA(vobj), entry, reason))
|
||||
if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
|
||||
return true;
|
||||
|
@ -482,7 +481,7 @@ private:
|
|||
// the VO refers to a pointer-to-@interface
|
||||
|
||||
Error error;
|
||||
ValueObject* target = vobj.Dereference(error).get();
|
||||
ValueObject* target = valobj.Dereference(error).get();
|
||||
if (error.Fail() || !target)
|
||||
return false;
|
||||
if (Get(*target, typePtr->getPointeeType(), entry, use_dynamic, reason) && !entry->m_skip_pointers)
|
||||
|
@ -496,8 +495,8 @@ private:
|
|||
{
|
||||
if (log)
|
||||
log->Printf("working with ObjC");
|
||||
clang::ASTContext *ast = vobj.GetClangAST();
|
||||
if (ClangASTContext::GetCompleteType(ast, vobj.GetClangType()) && !objc_class_type->isObjCId())
|
||||
clang::ASTContext *ast = valobj.GetClangAST();
|
||||
if (ClangASTContext::GetCompleteType(ast, valobj.GetClangType()) && !objc_class_type->isObjCId())
|
||||
{
|
||||
clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
|
||||
if (class_interface_decl)
|
||||
|
@ -510,7 +509,7 @@ private:
|
|||
if (log)
|
||||
log->Printf("got a parent class for this ObjC class");
|
||||
clang::QualType ivar_qual_type(ast->getObjCInterfaceType(superclass_interface_decl));
|
||||
if (Get(vobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
|
||||
if (Get(valobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
|
||||
return true;
|
||||
|
@ -528,7 +527,7 @@ private:
|
|||
if (record)
|
||||
{
|
||||
if (!record->hasDefinition())
|
||||
ClangASTContext::GetCompleteType(vobj.GetClangAST(), vobj.GetClangType());
|
||||
ClangASTContext::GetCompleteType(valobj.GetClangAST(), valobj.GetClangType());
|
||||
if (record->hasDefinition())
|
||||
{
|
||||
clang::CXXRecordDecl::base_class_iterator pos,end;
|
||||
|
@ -539,7 +538,7 @@ private:
|
|||
end = record->bases_end();
|
||||
for (pos = record->bases_begin(); pos != end; pos++)
|
||||
{
|
||||
if ((Get(vobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
|
||||
if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
|
||||
return true;
|
||||
|
@ -553,7 +552,7 @@ private:
|
|||
end = record->vbases_end();
|
||||
for (pos = record->vbases_begin(); pos != end; pos++)
|
||||
{
|
||||
if ((Get(vobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
|
||||
if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
|
||||
return true;
|
||||
|
@ -569,7 +568,7 @@ private:
|
|||
{
|
||||
if (log)
|
||||
log->Printf("stripping typedef");
|
||||
if ((Get(vobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
|
||||
if ((Get(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
|
||||
{
|
||||
reason |= lldb::eFormatterChoiceCriterionNavigatedTypedefs;
|
||||
return true;
|
||||
|
@ -581,27 +580,27 @@ private:
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key, SummaryFormat::SharedPointer& value);
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(ConstString key, SummaryFormat::SharedPointer& value);
|
||||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* type);
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(ConstString type);
|
||||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key, SyntheticFilter::SharedPointer& value);
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(ConstString key, SyntheticFilter::SharedPointer& value);
|
||||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char* type);
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(ConstString type);
|
||||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const char* key, SyntheticFilter::SharedPointer& value);
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(ConstString key, SyntheticFilter::SharedPointer& value);
|
||||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(const char* type);
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(ConstString type);
|
||||
|
||||
class CategoryMap;
|
||||
|
||||
|
@ -609,13 +608,13 @@ class FormatCategory
|
|||
{
|
||||
private:
|
||||
|
||||
typedef FormatNavigator<const char*, SummaryFormat> SummaryNavigator;
|
||||
typedef FormatNavigator<ConstString, SummaryFormat> SummaryNavigator;
|
||||
typedef FormatNavigator<lldb::RegularExpressionSP, SummaryFormat> RegexSummaryNavigator;
|
||||
|
||||
typedef FormatNavigator<const char*, SyntheticFilter> FilterNavigator;
|
||||
typedef FormatNavigator<ConstString, SyntheticFilter> FilterNavigator;
|
||||
typedef FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter> RegexFilterNavigator;
|
||||
|
||||
typedef FormatNavigator<const char*, SyntheticScriptProvider> SynthNavigator;
|
||||
typedef FormatNavigator<ConstString, SyntheticScriptProvider> SynthNavigator;
|
||||
typedef FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider> RegexSynthNavigator;
|
||||
|
||||
typedef SummaryNavigator::MapType SummaryMap;
|
||||
|
@ -657,13 +656,13 @@ private:
|
|||
|
||||
friend class CategoryMap;
|
||||
|
||||
friend class FormatNavigator<const char*, SummaryFormat>;
|
||||
friend class FormatNavigator<ConstString, SummaryFormat>;
|
||||
friend class FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>;
|
||||
|
||||
friend class FormatNavigator<const char*, SyntheticFilter>;
|
||||
friend class FormatNavigator<ConstString, SyntheticFilter>;
|
||||
friend class FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>;
|
||||
|
||||
friend class FormatNavigator<const char*, SyntheticScriptProvider>;
|
||||
friend class FormatNavigator<ConstString, SyntheticScriptProvider>;
|
||||
friend class FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>;
|
||||
|
||||
public:
|
||||
|
@ -745,23 +744,23 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
lldb::SummaryFormatSP& entry,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
uint32_t* reason = NULL)
|
||||
{
|
||||
if (!IsEnabled())
|
||||
return false;
|
||||
if (Summary()->Get(vobj, entry, use_dynamic, reason))
|
||||
if (Summary()->Get(valobj, entry, use_dynamic, reason))
|
||||
return true;
|
||||
bool regex = RegexSummary()->Get(vobj, entry, use_dynamic, reason);
|
||||
bool regex = RegexSummary()->Get(valobj, entry, use_dynamic, reason);
|
||||
if (regex && reason)
|
||||
*reason |= lldb::eFormatterChoiceCriterionRegularExpressionSummary;
|
||||
return regex;
|
||||
}
|
||||
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
lldb::SyntheticChildrenSP& entry,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
uint32_t* reason = NULL)
|
||||
|
@ -778,11 +777,11 @@ public:
|
|||
|
||||
// first find both Filter and Synth, and then check which is most recent
|
||||
|
||||
if (!Filter()->Get(vobj, filter, use_dynamic, &reason_filter))
|
||||
regex_filter = RegexFilter()->Get(vobj, filter, use_dynamic, &reason_filter);
|
||||
if (!Filter()->Get(valobj, filter, use_dynamic, &reason_filter))
|
||||
regex_filter = RegexFilter()->Get(valobj, filter, use_dynamic, &reason_filter);
|
||||
|
||||
if (!Synth()->Get(vobj, synth, use_dynamic, &reason_synth))
|
||||
regex_synth = RegexSynth()->Get(vobj, synth, use_dynamic, &reason_synth);
|
||||
if (!Synth()->Get(valobj, synth, use_dynamic, &reason_synth))
|
||||
regex_synth = RegexSynth()->Get(valobj, synth, use_dynamic, &reason_synth);
|
||||
|
||||
if (!filter.get() && !synth.get())
|
||||
return false;
|
||||
|
@ -826,7 +825,7 @@ public:
|
|||
|
||||
// just a shortcut for (Summary()->Delete(name) || RegexSummary()->Delete(name))
|
||||
bool
|
||||
DeleteSummaries(const char* name)
|
||||
DeleteSummaries(ConstString name)
|
||||
{
|
||||
return Delete(name, (eSummary | eRegexSummary));
|
||||
}
|
||||
|
@ -850,7 +849,7 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
Delete(const char* name,
|
||||
Delete(ConstString name,
|
||||
FormatCategoryItems items = ALL_ITEM_TYPES)
|
||||
{
|
||||
bool success = false;
|
||||
|
@ -910,7 +909,7 @@ public:
|
|||
|
||||
if ( (items & eSummary) == eSummary )
|
||||
{
|
||||
if (m_summary_nav->Get(type_name.AsCString(), summary))
|
||||
if (m_summary_nav->Get(type_name, summary))
|
||||
{
|
||||
if (matching_category)
|
||||
*matching_category = m_name.c_str();
|
||||
|
@ -921,7 +920,7 @@ public:
|
|||
}
|
||||
if ( (items & eRegexSummary) == eRegexSummary )
|
||||
{
|
||||
if (m_regex_summary_nav->Get(type_name.AsCString(), summary))
|
||||
if (m_regex_summary_nav->Get(type_name, summary))
|
||||
{
|
||||
if (matching_category)
|
||||
*matching_category = m_name.c_str();
|
||||
|
@ -932,7 +931,7 @@ public:
|
|||
}
|
||||
if ( (items & eFilter) == eFilter )
|
||||
{
|
||||
if (m_filter_nav->Get(type_name.AsCString(), filter))
|
||||
if (m_filter_nav->Get(type_name, filter))
|
||||
{
|
||||
if (matching_category)
|
||||
*matching_category = m_name.c_str();
|
||||
|
@ -943,7 +942,7 @@ public:
|
|||
}
|
||||
if ( (items & eRegexFilter) == eRegexFilter )
|
||||
{
|
||||
if (m_regex_filter_nav->Get(type_name.AsCString(), filter))
|
||||
if (m_regex_filter_nav->Get(type_name, filter))
|
||||
{
|
||||
if (matching_category)
|
||||
*matching_category = m_name.c_str();
|
||||
|
@ -954,7 +953,7 @@ public:
|
|||
}
|
||||
if ( (items & eSynth) == eSynth )
|
||||
{
|
||||
if (m_synth_nav->Get(type_name.AsCString(), synth))
|
||||
if (m_synth_nav->Get(type_name, synth))
|
||||
{
|
||||
if (matching_category)
|
||||
*matching_category = m_name.c_str();
|
||||
|
@ -965,7 +964,7 @@ public:
|
|||
}
|
||||
if ( (items & eRegexSynth) == eRegexSynth )
|
||||
{
|
||||
if (m_regex_synth_nav->Get(type_name.AsCString(), synth))
|
||||
if (m_regex_synth_nav->Get(type_name, synth))
|
||||
{
|
||||
if (matching_category)
|
||||
*matching_category = m_name.c_str();
|
||||
|
@ -1175,7 +1174,7 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
lldb::SummaryFormatSP& entry,
|
||||
lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
|
@ -1188,7 +1187,7 @@ public:
|
|||
{
|
||||
FormatCategory::SharedPointer category = *begin;
|
||||
lldb::SummaryFormatSP current_format;
|
||||
if (!category->Get(vobj, current_format, use_dynamic, &reason_why))
|
||||
if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
|
||||
continue;
|
||||
/*if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
|
||||
{
|
||||
|
@ -1207,7 +1206,7 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
lldb::SyntheticChildrenSP& entry,
|
||||
lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
|
@ -1221,7 +1220,7 @@ public:
|
|||
{
|
||||
FormatCategory::SharedPointer category = *begin;
|
||||
lldb::SyntheticChildrenSP current_format;
|
||||
if (!category->Get(vobj, current_format, use_dynamic, &reason_why))
|
||||
if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
|
||||
continue;
|
||||
/*if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
|
||||
{
|
||||
|
@ -1246,10 +1245,10 @@ class FormatManager : public IFormatChangeListener
|
|||
{
|
||||
private:
|
||||
|
||||
typedef FormatNavigator<const char*, ValueFormat> ValueNavigator;
|
||||
typedef FormatNavigator<ConstString, ValueFormat> ValueNavigator;
|
||||
|
||||
typedef ValueNavigator::MapType ValueMap;
|
||||
typedef FormatMap<const char*, SummaryFormat> NamedSummariesMap;
|
||||
typedef FormatMap<ConstString, SummaryFormat> NamedSummariesMap;
|
||||
|
||||
ValueNavigator m_value_nav;
|
||||
NamedSummariesMap m_named_summaries_map;
|
||||
|
@ -1258,68 +1257,19 @@ private:
|
|||
|
||||
const char* m_default_category_name;
|
||||
const char* m_system_category_name;
|
||||
const char* m_gnu_cpp_category_name;
|
||||
|
||||
typedef CategoryMap::MapType::iterator CategoryMapIterator;
|
||||
|
||||
ConstString m_default_cs;
|
||||
ConstString m_system_cs;
|
||||
ConstString m_charstar_cs;
|
||||
ConstString m_constcharstar_cs;
|
||||
ConstString m_gnu_stdcpp_cs;
|
||||
|
||||
public:
|
||||
|
||||
typedef bool (*CategoryCallback)(void*, const char*, const FormatCategory::SharedPointer&);
|
||||
|
||||
FormatManager() :
|
||||
m_value_nav("format",this),
|
||||
m_named_summaries_map(this),
|
||||
m_last_revision(0),
|
||||
m_categories_map(this),
|
||||
m_default_cs(ConstString("default")),
|
||||
m_system_cs(ConstString("system")),
|
||||
m_charstar_cs(ConstString("char *")),
|
||||
m_constcharstar_cs(ConstString("const char *"))
|
||||
{
|
||||
|
||||
// build default categories
|
||||
|
||||
m_default_category_name = m_default_cs.GetCString();
|
||||
m_system_category_name = m_system_cs.GetCString();
|
||||
|
||||
// add some default stuff
|
||||
// most formats, summaries, ... actually belong to the users' lldbinit file rather than here
|
||||
SummaryFormat::SharedPointer string_format(new StringSummaryFormat(false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
"${var%s}"));
|
||||
|
||||
|
||||
SummaryFormat::SharedPointer string_array_format(new StringSummaryFormat(false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"${var%s}"));
|
||||
|
||||
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
|
||||
|
||||
|
||||
Category(m_system_category_name)->Summary()->Add(m_charstar_cs.GetCString(), string_format);
|
||||
Category(m_system_category_name)->Summary()->Add(m_constcharstar_cs.GetCString(), string_format);
|
||||
Category(m_system_category_name)->RegexSummary()->Add(any_size_char_arr, string_array_format);
|
||||
|
||||
Category(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
|
||||
|
||||
// the order of these two calls IS important, if you invert it "system" summaries will prevail over the user's
|
||||
EnableCategory(m_system_category_name);
|
||||
EnableCategory(m_default_category_name);
|
||||
|
||||
}
|
||||
|
||||
FormatManager();
|
||||
|
||||
CategoryMap& Categories() { return m_categories_map; }
|
||||
ValueNavigator& Value() { return m_value_nav; }
|
||||
|
@ -1368,18 +1318,18 @@ public:
|
|||
}
|
||||
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
lldb::SummaryFormatSP& entry,
|
||||
lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
return m_categories_map.Get(vobj, entry, use_dynamic);
|
||||
return m_categories_map.Get(valobj, entry, use_dynamic);
|
||||
}
|
||||
bool
|
||||
Get(ValueObject& vobj,
|
||||
Get(ValueObject& valobj,
|
||||
lldb::SyntheticChildrenSP& entry,
|
||||
lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
return m_categories_map.Get(vobj, entry, use_dynamic);
|
||||
return m_categories_map.Get(valobj, entry, use_dynamic);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1430,6 +1380,117 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class DataVisualization
|
||||
{
|
||||
public:
|
||||
|
||||
// use this call to force the FM to consider itself updated even when there is no apparent reason for that
|
||||
static void
|
||||
ForceUpdate();
|
||||
|
||||
class ValueFormats
|
||||
{
|
||||
public:
|
||||
static bool
|
||||
Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry);
|
||||
|
||||
static void
|
||||
Add(const ConstString &type, const ValueFormat::SharedPointer &entry);
|
||||
|
||||
static bool
|
||||
Delete(const ConstString &type);
|
||||
|
||||
static void
|
||||
Clear();
|
||||
|
||||
static void
|
||||
LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton);
|
||||
|
||||
static uint32_t
|
||||
GetCurrentRevision();
|
||||
|
||||
static uint32_t
|
||||
GetCount();
|
||||
};
|
||||
|
||||
static bool
|
||||
GetSummaryFormat(ValueObject& valobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SummaryFormatSP& entry);
|
||||
static bool
|
||||
GetSyntheticChildren(ValueObject& valobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SyntheticChildrenSP& entry);
|
||||
|
||||
static bool
|
||||
AnyMatches(ConstString type_name,
|
||||
FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
|
||||
bool only_enabled = true,
|
||||
const char** matching_category = NULL,
|
||||
FormatCategory::FormatCategoryItems* matching_type = NULL);
|
||||
|
||||
class NamedSummaryFormats
|
||||
{
|
||||
public:
|
||||
static bool
|
||||
Get(const ConstString &type, lldb::SummaryFormatSP &entry);
|
||||
|
||||
static void
|
||||
Add(const ConstString &type, const lldb::SummaryFormatSP &entry);
|
||||
|
||||
static bool
|
||||
Delete(const ConstString &type);
|
||||
|
||||
static void
|
||||
Clear();
|
||||
|
||||
static void
|
||||
LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton);
|
||||
|
||||
static uint32_t
|
||||
GetCurrentRevision();
|
||||
|
||||
static uint32_t
|
||||
GetCount();
|
||||
};
|
||||
|
||||
class Categories
|
||||
{
|
||||
public:
|
||||
|
||||
static bool
|
||||
Get(const ConstString &category, lldb::FormatCategorySP &entry);
|
||||
|
||||
static void
|
||||
Add(const ConstString &category);
|
||||
|
||||
static bool
|
||||
Delete(const ConstString &category);
|
||||
|
||||
static void
|
||||
Clear();
|
||||
|
||||
static void
|
||||
Clear(ConstString &category);
|
||||
|
||||
static void
|
||||
Enable(ConstString& category);
|
||||
|
||||
static void
|
||||
Disable(ConstString& category);
|
||||
|
||||
static void
|
||||
LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton);
|
||||
|
||||
static uint32_t
|
||||
GetCurrentRevision();
|
||||
|
||||
static uint32_t
|
||||
GetCount();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // lldb_FormatManager_h_
|
||||
|
|
|
@ -165,18 +165,18 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# Copy the OSX C++ STL formatters over to the framework Python directory
|
||||
if [ -f "${SRC_ROOT}/source/osxcpp.py" ]
|
||||
# Copy the C++ STL formatters over to the framework Python directory
|
||||
if [ -f "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" ]
|
||||
then
|
||||
if [ $Debug == 1 ]
|
||||
then
|
||||
echo "Copying osxcpp.py to ${framework_python_dir}"
|
||||
echo "Copying gnu_libstdcpp.py to ${framework_python_dir}"
|
||||
fi
|
||||
cp "${SRC_ROOT}/source/osxcpp.py" "${framework_python_dir}"
|
||||
cp "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" "${framework_python_dir}"
|
||||
else
|
||||
if [ $Debug == 1 ]
|
||||
then
|
||||
echo "Unable to find ${SRC_ROOT}/source/osxcpp.py"
|
||||
echo "Unable to find ${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Debugger.h"
|
||||
#include "lldb/Core/FormatManager.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/StreamFile.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
|
@ -441,7 +442,7 @@ public:
|
|||
|
||||
SummaryFormatSP summary_format_sp;
|
||||
if (!m_option_variable.summary.empty())
|
||||
Debugger::Formatting::NamedSummaryFormats::Get(ConstString(m_option_variable.summary.c_str()), summary_format_sp);
|
||||
DataVisualization::NamedSummaryFormats::Get(ConstString(m_option_variable.summary.c_str()), summary_format_sp);
|
||||
|
||||
ValueObject::DumpValueObjectOptions options;
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ public:
|
|||
const char* typeA = command.GetArgumentAtIndex(i);
|
||||
ConstString typeCS(typeA);
|
||||
if (typeCS)
|
||||
Debugger::Formatting::ValueFormats::Add(typeCS, entry);
|
||||
DataVisualization::ValueFormats::Add(typeCS, entry);
|
||||
else
|
||||
{
|
||||
result.AppendError("empty typenames not allowed");
|
||||
|
@ -276,7 +276,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
if (Debugger::Formatting::ValueFormats::Delete(typeCS))
|
||||
if (DataVisualization::ValueFormats::Delete(typeCS))
|
||||
{
|
||||
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
||||
return result.Succeeded();
|
||||
|
@ -314,7 +314,7 @@ public:
|
|||
bool
|
||||
Execute (Args& command, CommandReturnObject &result)
|
||||
{
|
||||
Debugger::Formatting::ValueFormats::Clear();
|
||||
DataVisualization::ValueFormats::Clear();
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
return result.Succeeded();
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public:
|
|||
// CommandObjectTypeFormatList
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, const char* type, const ValueFormat::SharedPointer& entry);
|
||||
bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const ValueFormat::SharedPointer& entry);
|
||||
|
||||
class CommandObjectTypeFormatList;
|
||||
|
||||
|
@ -375,7 +375,7 @@ public:
|
|||
}
|
||||
else
|
||||
param = new CommandObjectTypeFormatList_LoopCallbackParam(this,&result);
|
||||
Debugger::Formatting::ValueFormats::LoopThrough(CommandObjectTypeFormatList_LoopCallback, param);
|
||||
DataVisualization::ValueFormats::LoopThrough(CommandObjectTypeFormatList_LoopCallback, param);
|
||||
delete param;
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
return result.Succeeded();
|
||||
|
@ -384,14 +384,14 @@ public:
|
|||
private:
|
||||
|
||||
bool
|
||||
LoopCallback (const char* type,
|
||||
LoopCallback (ConstString type,
|
||||
const ValueFormat::SharedPointer& entry,
|
||||
RegularExpression* regex,
|
||||
CommandReturnObject *result)
|
||||
{
|
||||
if (regex == NULL || regex->Execute(type))
|
||||
if (regex == NULL || regex->Execute(type.AsCString()))
|
||||
{
|
||||
result->GetOutputStream().Printf ("%s: %s%s%s%s\n", type,
|
||||
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)" : "",
|
||||
|
@ -400,14 +400,14 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
friend bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, const char* type, const ValueFormat::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const ValueFormat::SharedPointer& entry);
|
||||
|
||||
};
|
||||
|
||||
bool
|
||||
CommandObjectTypeFormatList_LoopCallback (
|
||||
void* pt2self,
|
||||
const char* type,
|
||||
ConstString type,
|
||||
const ValueFormat::SharedPointer& entry)
|
||||
{
|
||||
CommandObjectTypeFormatList_LoopCallbackParam* param = (CommandObjectTypeFormatList_LoopCallbackParam*)pt2self;
|
||||
|
@ -971,23 +971,23 @@ CommandObject (interpreter,
|
|||
"};\n"
|
||||
"AnotherDemo *another_object = new AnotherDemo('E',42,3.14);\n"
|
||||
"\n"
|
||||
"type summary add -f \"the answer is ${*var.ptr}\" JustADemo\n"
|
||||
"type summary add --summary-string \"the answer is ${*var.ptr}\" JustADemo\n"
|
||||
"when typing frame variable object you will get \"the answer is 42\"\n"
|
||||
"type summary add -f \"the answer is ${*var.ptr}, and the question is ${var.value}\" JustADemo\n"
|
||||
"type summary add --summary-string \"the answer is ${*var.ptr}, and the question is ${var.value}\" JustADemo\n"
|
||||
"when typing frame variable object you will get \"the answer is 42 and the question is 3.14\"\n"
|
||||
"\n"
|
||||
"Alternatively, you could also say\n"
|
||||
"type summary add -f \"${var%V} -> ${*var}\" \"int *\"\n"
|
||||
"type summary add --summary-string \"${var%V} -> ${*var}\" \"int *\"\n"
|
||||
"and replace the above summary string with\n"
|
||||
"type summary add -f \"the answer is ${var.ptr}, and the question is ${var.value}\" JustADemo\n"
|
||||
"type summary add --summary-string \"the answer is ${var.ptr}, and the question is ${var.value}\" JustADemo\n"
|
||||
"to obtain a similar result\n"
|
||||
"\n"
|
||||
"To add a summary valid for both JustADemo and AnotherDemo you can use the scoping operator, as in:\n"
|
||||
"type summary add -f \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes\n"
|
||||
"type summary add --summary-string \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes\n"
|
||||
"\n"
|
||||
"This will be used for both variables of type JustADemo and AnotherDemo. To prevent this, change the -C to read -C no\n"
|
||||
"If you do not want pointers to be shown using that summary, you can use the -p option, as in:\n"
|
||||
"type summary add -f \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes -p\n"
|
||||
"type summary add --summary-string \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes -p\n"
|
||||
"A similar option -r exists for references.\n"
|
||||
"\n"
|
||||
"If you simply want a one-line summary of the content of your variable, without typing an explicit string to that effect\n"
|
||||
|
@ -997,7 +997,7 @@ CommandObject (interpreter,
|
|||
"the output being similar to (ptr=0xsomeaddress, value=3.14)\n"
|
||||
"\n"
|
||||
"If you want to display some summary text, but also expand the structure of your object, you can add the -e option, as in:\n"
|
||||
"type summary add -e -f \"*ptr = ${*var.ptr}\" JustADemo\n"
|
||||
"type summary add -e --summary-string \"*ptr = ${*var.ptr}\" JustADemo\n"
|
||||
"Here the value of the int* is displayed, followed by the standard LLDB sequence of children objects, one per line.\n"
|
||||
"to get an output like:\n"
|
||||
"\n"
|
||||
|
@ -1006,9 +1006,6 @@ CommandObject (interpreter,
|
|||
" value = 3.14\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"A command you may definitely want to try if you're doing C++ debugging is:\n"
|
||||
"type summary add -f \"${var._M_dataplus._M_p}\" std::string\n"
|
||||
"\n"
|
||||
"You can also add Python summaries, in which case you will use lldb public API to gather information from your variables"
|
||||
"and elaborate them to a meaningful summary inside a script written in Python. The variable object will be passed to your"
|
||||
"script as an SBValue object. The following example might help you when starting to use the Python summaries feature:\n"
|
||||
|
@ -1040,7 +1037,7 @@ CommandObjectTypeSummaryAdd::AddSummary(const ConstString& type_name,
|
|||
Error* error)
|
||||
{
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(category_name.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
|
||||
|
||||
if (type == eRegexSummary)
|
||||
{
|
||||
|
@ -1052,7 +1049,7 @@ CommandObjectTypeSummaryAdd::AddSummary(const ConstString& type_name,
|
|||
return false;
|
||||
}
|
||||
|
||||
category->RegexSummary()->Delete(type_name.GetCString());
|
||||
category->RegexSummary()->Delete(type_name);
|
||||
category->RegexSummary()->Add(typeRX, entry);
|
||||
|
||||
return true;
|
||||
|
@ -1060,12 +1057,12 @@ CommandObjectTypeSummaryAdd::AddSummary(const ConstString& type_name,
|
|||
else if (type == eNamedSummary)
|
||||
{
|
||||
// system named summaries do not exist (yet?)
|
||||
Debugger::Formatting::NamedSummaryFormats::Add(type_name,entry);
|
||||
DataVisualization::NamedSummaryFormats::Add(type_name,entry);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
category->Summary()->Add(type_name.GetCString(), entry);
|
||||
category->Summary()->Add(type_name, entry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1080,7 +1077,7 @@ CommandObjectTypeSummaryAdd::CommandOptions::g_option_table[] =
|
|||
{ LLDB_OPT_SET_ALL, false, "skip-references", 'r', no_argument, NULL, 0, eArgTypeNone, "Don't use this format for references-to-type objects."},
|
||||
{ LLDB_OPT_SET_ALL, false, "regex", 'x', no_argument, NULL, 0, eArgTypeNone, "Type names are actually regular expressions."},
|
||||
{ LLDB_OPT_SET_1 , true, "inline-children", 'c', no_argument, NULL, 0, eArgTypeNone, "If true, inline all child values into summary string."},
|
||||
{ LLDB_OPT_SET_2 , true, "format-string", 'f', required_argument, NULL, 0, eArgTypeSummaryString, "Format string used to display text and object contents."},
|
||||
{ LLDB_OPT_SET_2 , true, "summary-string", 'f', required_argument, NULL, 0, eArgTypeSummaryString, "Summary string used to display text and object contents."},
|
||||
{ LLDB_OPT_SET_3, false, "python-script", 's', required_argument, NULL, 0, eArgTypeName, "Give a one-liner Python script as part of the command."},
|
||||
{ LLDB_OPT_SET_3, false, "python-function", 'F', required_argument, NULL, 0, eArgTypeName, "Give the name of a Python function to use for this type."},
|
||||
{ LLDB_OPT_SET_3, false, "input-python", 'P', no_argument, NULL, 0, eArgTypeNone, "Input Python code to use for this type manually."},
|
||||
|
@ -1168,8 +1165,8 @@ private:
|
|||
const char* cate_name,
|
||||
const FormatCategory::SharedPointer& cate)
|
||||
{
|
||||
const char* name = (const char*)param;
|
||||
cate->Delete(name, FormatCategory::eSummary | FormatCategory::eRegexSummary);
|
||||
ConstString *name = (ConstString*)param;
|
||||
cate->Delete(*name, FormatCategory::eSummary | FormatCategory::eRegexSummary);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1220,16 +1217,16 @@ public:
|
|||
|
||||
if (m_options.m_delete_all)
|
||||
{
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
|
||||
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
||||
return result.Succeeded();
|
||||
}
|
||||
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
|
||||
bool delete_category = category->DeleteSummaries(typeCS.GetCString());
|
||||
bool delete_named = Debugger::Formatting::NamedSummaryFormats::Delete(typeCS);
|
||||
bool delete_category = category->DeleteSummaries(typeCS);
|
||||
bool delete_named = DataVisualization::NamedSummaryFormats::Delete(typeCS);
|
||||
|
||||
if (delete_category || delete_named)
|
||||
{
|
||||
|
@ -1348,7 +1345,7 @@ public:
|
|||
{
|
||||
|
||||
if (m_options.m_delete_all)
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, NULL);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
|
||||
|
||||
else
|
||||
{
|
||||
|
@ -1357,14 +1354,14 @@ public:
|
|||
{
|
||||
const char* cat_name = command.GetArgumentAtIndex(0);
|
||||
ConstString cat_nameCS(cat_name);
|
||||
Debugger::Formatting::Categories::Get(cat_nameCS, category);
|
||||
DataVisualization::Categories::Get(cat_nameCS, category);
|
||||
}
|
||||
else
|
||||
Debugger::Formatting::Categories::Get(ConstString(NULL), category);
|
||||
DataVisualization::Categories::Get(ConstString(NULL), category);
|
||||
category->ClearSummaries();
|
||||
}
|
||||
|
||||
Debugger::Formatting::NamedSummaryFormats::Clear();
|
||||
DataVisualization::NamedSummaryFormats::Clear();
|
||||
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
return result.Succeeded();
|
||||
|
@ -1383,7 +1380,7 @@ CommandObjectTypeSummaryClear::CommandOptions::g_option_table[] =
|
|||
// CommandObjectTypeSummaryList
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, const char* type, const StringSummaryFormat::SharedPointer& entry);
|
||||
bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, ConstString type, const StringSummaryFormat::SharedPointer& entry);
|
||||
bool CommandObjectTypeRXSummaryList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const StringSummaryFormat::SharedPointer& entry);
|
||||
|
||||
class CommandObjectTypeSummaryList;
|
||||
|
@ -1502,9 +1499,9 @@ public:
|
|||
else
|
||||
param = new CommandObjectTypeSummaryList_LoopCallbackParam(this,&result,NULL,cate_regex);
|
||||
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback,param);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback,param);
|
||||
|
||||
if (Debugger::Formatting::NamedSummaryFormats::GetCount() > 0)
|
||||
if (DataVisualization::NamedSummaryFormats::GetCount() > 0)
|
||||
{
|
||||
result.GetOutputStream().Printf("Named summaries:\n");
|
||||
if (argc == 1) {
|
||||
|
@ -1514,7 +1511,7 @@ public:
|
|||
}
|
||||
else
|
||||
param = new CommandObjectTypeSummaryList_LoopCallbackParam(this,&result);
|
||||
Debugger::Formatting::NamedSummaryFormats::LoopThrough(CommandObjectTypeSummaryList_LoopCallback, param);
|
||||
DataVisualization::NamedSummaryFormats::LoopThrough(CommandObjectTypeSummaryList_LoopCallback, param);
|
||||
delete param;
|
||||
}
|
||||
|
||||
|
@ -1558,6 +1555,7 @@ private:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
LoopCallback (const char* type,
|
||||
|
@ -1570,18 +1568,18 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
friend bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, const char* type, const SummaryFormat::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, ConstString type, const SummaryFormat::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeRXSummaryList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SummaryFormat::SharedPointer& entry);
|
||||
};
|
||||
|
||||
bool
|
||||
CommandObjectTypeSummaryList_LoopCallback (
|
||||
void* pt2self,
|
||||
const char* type,
|
||||
ConstString type,
|
||||
const SummaryFormat::SharedPointer& entry)
|
||||
{
|
||||
CommandObjectTypeSummaryList_LoopCallbackParam* param = (CommandObjectTypeSummaryList_LoopCallbackParam*)pt2self;
|
||||
return param->self->LoopCallback(type, entry, param->regex, param->result);
|
||||
return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1653,7 +1651,7 @@ public:
|
|||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
Debugger::Formatting::Categories::Enable(typeCS);
|
||||
DataVisualization::Categories::Enable(typeCS);
|
||||
}
|
||||
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
|
@ -1717,7 +1715,7 @@ public:
|
|||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
if (!Debugger::Formatting::Categories::Delete(typeCS))
|
||||
if (!DataVisualization::Categories::Delete(typeCS))
|
||||
success = false; // keep deleting even if we hit an error
|
||||
}
|
||||
if (success)
|
||||
|
@ -1787,7 +1785,7 @@ public:
|
|||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
Debugger::Formatting::Categories::Disable(typeCS);
|
||||
DataVisualization::Categories::Disable(typeCS);
|
||||
}
|
||||
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
|
@ -1876,7 +1874,7 @@ public:
|
|||
CommandObjectTypeCategoryList_CallbackParam param(&result,
|
||||
regex);
|
||||
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, ¶m);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, ¶m);
|
||||
|
||||
if (regex)
|
||||
delete regex;
|
||||
|
@ -1891,7 +1889,7 @@ public:
|
|||
// CommandObjectTypeFilterList
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
|
||||
bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
|
||||
bool CommandObjectTypeFilterRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
|
||||
|
||||
class CommandObjectTypeFilterList;
|
||||
|
@ -2010,7 +2008,7 @@ public:
|
|||
else
|
||||
param = new CommandObjectTypeFilterList_LoopCallbackParam(this,&result,NULL,cate_regex);
|
||||
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback,param);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback,param);
|
||||
|
||||
if (cate_regex)
|
||||
delete cate_regex;
|
||||
|
@ -2065,17 +2063,17 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
friend bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeFilterRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
|
||||
};
|
||||
|
||||
bool
|
||||
CommandObjectTypeFilterList_LoopCallback (void* pt2self,
|
||||
const char* type,
|
||||
ConstString type,
|
||||
const SyntheticChildren::SharedPointer& entry)
|
||||
{
|
||||
CommandObjectTypeFilterList_LoopCallbackParam* param = (CommandObjectTypeFilterList_LoopCallbackParam*)pt2self;
|
||||
return param->self->LoopCallback(type, entry, param->regex, param->result);
|
||||
return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2099,7 +2097,7 @@ CommandObjectTypeFilterList::CommandOptions::g_option_table[] =
|
|||
// CommandObjectTypeSynthList
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
|
||||
bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
|
||||
bool CommandObjectTypeSynthRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
|
||||
|
||||
class CommandObjectTypeSynthList;
|
||||
|
@ -2218,7 +2216,7 @@ public:
|
|||
else
|
||||
param = new CommandObjectTypeSynthList_LoopCallbackParam(this,&result,NULL,cate_regex);
|
||||
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback,param);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback,param);
|
||||
|
||||
if (cate_regex)
|
||||
delete cate_regex;
|
||||
|
@ -2273,17 +2271,17 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
friend bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
|
||||
friend bool CommandObjectTypeSynthRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
|
||||
};
|
||||
|
||||
bool
|
||||
CommandObjectTypeSynthList_LoopCallback (void* pt2self,
|
||||
const char* type,
|
||||
ConstString type,
|
||||
const SyntheticChildren::SharedPointer& entry)
|
||||
{
|
||||
CommandObjectTypeSynthList_LoopCallbackParam* param = (CommandObjectTypeSynthList_LoopCallbackParam*)pt2self;
|
||||
return param->self->LoopCallback(type, entry, param->regex, param->result);
|
||||
return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -2381,8 +2379,8 @@ private:
|
|||
const char* cate_name,
|
||||
const FormatCategory::SharedPointer& cate)
|
||||
{
|
||||
const char* name = (const char*)param;
|
||||
return cate->Delete(name, FormatCategory::eFilter | FormatCategory::eRegexFilter);
|
||||
ConstString *name = (ConstString*)param;
|
||||
return cate->Delete(*name, FormatCategory::eFilter | FormatCategory::eRegexFilter);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -2432,16 +2430,16 @@ public:
|
|||
|
||||
if (m_options.m_delete_all)
|
||||
{
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, (void*)&typeCS);
|
||||
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
||||
return result.Succeeded();
|
||||
}
|
||||
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
|
||||
bool delete_category = category->Filter()->Delete(typeCS.GetCString());
|
||||
delete_category = category->RegexFilter()->Delete(typeCS.GetCString()) || delete_category;
|
||||
bool delete_category = category->Filter()->Delete(typeCS);
|
||||
delete_category = category->RegexFilter()->Delete(typeCS) || delete_category;
|
||||
|
||||
if (delete_category)
|
||||
{
|
||||
|
@ -2544,8 +2542,8 @@ private:
|
|||
const char* cate_name,
|
||||
const FormatCategory::SharedPointer& cate)
|
||||
{
|
||||
const char* name = (const char*)param;
|
||||
return cate->Delete(name, FormatCategory::eSynth | FormatCategory::eRegexSynth);
|
||||
ConstString* name = (ConstString*)param;
|
||||
return cate->Delete(*name, FormatCategory::eSynth | FormatCategory::eRegexSynth);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -2595,16 +2593,16 @@ public:
|
|||
|
||||
if (m_options.m_delete_all)
|
||||
{
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, (void*)&typeCS);
|
||||
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
||||
return result.Succeeded();
|
||||
}
|
||||
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
|
||||
bool delete_category = category->Synth()->Delete(typeCS.GetCString());
|
||||
delete_category = category->RegexSynth()->Delete(typeCS.GetCString()) || delete_category;
|
||||
bool delete_category = category->Synth()->Delete(typeCS);
|
||||
delete_category = category->RegexSynth()->Delete(typeCS) || delete_category;
|
||||
|
||||
if (delete_category)
|
||||
{
|
||||
|
@ -2726,7 +2724,7 @@ public:
|
|||
{
|
||||
|
||||
if (m_options.m_delete_all)
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, NULL);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
|
||||
|
||||
else
|
||||
{
|
||||
|
@ -2735,10 +2733,10 @@ public:
|
|||
{
|
||||
const char* cat_name = command.GetArgumentAtIndex(0);
|
||||
ConstString cat_nameCS(cat_name);
|
||||
Debugger::Formatting::Categories::Get(cat_nameCS, category);
|
||||
DataVisualization::Categories::Get(cat_nameCS, category);
|
||||
}
|
||||
else
|
||||
Debugger::Formatting::Categories::Get(ConstString(NULL), category);
|
||||
DataVisualization::Categories::Get(ConstString(NULL), category);
|
||||
category->Filter()->Clear();
|
||||
category->RegexFilter()->Clear();
|
||||
}
|
||||
|
@ -2853,7 +2851,7 @@ public:
|
|||
{
|
||||
|
||||
if (m_options.m_delete_all)
|
||||
Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, NULL);
|
||||
DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
|
||||
|
||||
else
|
||||
{
|
||||
|
@ -2862,10 +2860,10 @@ public:
|
|||
{
|
||||
const char* cat_name = command.GetArgumentAtIndex(0);
|
||||
ConstString cat_nameCS(cat_name);
|
||||
Debugger::Formatting::Categories::Get(cat_nameCS, category);
|
||||
DataVisualization::Categories::Get(cat_nameCS, category);
|
||||
}
|
||||
else
|
||||
Debugger::Formatting::Categories::Get(ConstString(NULL), category);
|
||||
DataVisualization::Categories::Get(ConstString(NULL), category);
|
||||
category->Synth()->Clear();
|
||||
category->RegexSynth()->Clear();
|
||||
}
|
||||
|
@ -3016,7 +3014,7 @@ public:
|
|||
|
||||
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(options->m_category.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(options->m_category.c_str()), category);
|
||||
|
||||
Error error;
|
||||
|
||||
|
@ -3133,7 +3131,7 @@ CommandObjectTypeSynthAdd::Execute_PythonClass (Args& command, CommandReturnObje
|
|||
// now I have a valid provider, let's add it to every type
|
||||
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
|
||||
Error error;
|
||||
|
||||
|
@ -3191,7 +3189,7 @@ CommandObjectTypeSynthAdd::AddSynth(const ConstString& type_name,
|
|||
Error* error)
|
||||
{
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(category_name.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
|
||||
|
||||
if (category->AnyMatches(type_name,
|
||||
FormatCategory::eFilter | FormatCategory::eRegexFilter,
|
||||
|
@ -3212,14 +3210,14 @@ CommandObjectTypeSynthAdd::AddSynth(const ConstString& type_name,
|
|||
return false;
|
||||
}
|
||||
|
||||
category->RegexSynth()->Delete(type_name.GetCString());
|
||||
category->RegexSynth()->Delete(type_name);
|
||||
category->RegexSynth()->Add(typeRX, entry);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
category->Synth()->Add(type_name.GetCString(), entry);
|
||||
category->Synth()->Add(type_name, entry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3368,7 +3366,7 @@ private:
|
|||
Error* error)
|
||||
{
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(category_name.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
|
||||
|
||||
if (category->AnyMatches(type_name,
|
||||
FormatCategory::eSynth | FormatCategory::eRegexSynth,
|
||||
|
@ -3389,14 +3387,14 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
category->RegexFilter()->Delete(type_name.GetCString());
|
||||
category->RegexFilter()->Delete(type_name);
|
||||
category->RegexFilter()->Add(typeRX, entry);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
category->Filter()->Add(type_name.GetCString(), entry);
|
||||
category->Filter()->Add(type_name, entry);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3464,7 +3462,7 @@ public:
|
|||
// now I have a valid provider, let's add it to every type
|
||||
|
||||
lldb::FormatCategorySP category;
|
||||
Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
|
||||
|
||||
Error error;
|
||||
|
||||
|
|
|
@ -82,7 +82,6 @@ Debugger::Initialize ()
|
|||
if (g_shared_debugger_refcount == 0)
|
||||
{
|
||||
lldb_private::Initialize();
|
||||
Debugger::FormatManagerInitialize();
|
||||
}
|
||||
g_shared_debugger_refcount++;
|
||||
|
||||
|
@ -96,7 +95,6 @@ Debugger::Terminate ()
|
|||
g_shared_debugger_refcount--;
|
||||
if (g_shared_debugger_refcount == 0)
|
||||
{
|
||||
Debugger::FormatManagerTerminate();
|
||||
lldb_private::WillTerminate();
|
||||
lldb_private::Terminate();
|
||||
|
||||
|
@ -829,7 +827,7 @@ ScanBracketedRange(const char* var_name_begin,
|
|||
|
||||
|
||||
static ValueObjectSP
|
||||
ExpandExpressionPath(ValueObject* vobj,
|
||||
ExpandExpressionPath(ValueObject* valobj,
|
||||
StackFrame* frame,
|
||||
bool* do_deref_pointer,
|
||||
const char* var_name_begin,
|
||||
|
@ -846,7 +844,7 @@ ExpandExpressionPath(ValueObject* vobj,
|
|||
log->Printf("been told to deref_pointer by caller");
|
||||
sstring.PutChar('*');
|
||||
}
|
||||
else if (vobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(vobj->GetParent()->GetClangType()) && !vobj->IsArrayItemForPointer())
|
||||
else if (valobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(valobj->GetParent()->GetClangType()) && !valobj->IsArrayItemForPointer())
|
||||
{
|
||||
if (log)
|
||||
log->Printf("decided to deref_pointer myself");
|
||||
|
@ -854,7 +852,7 @@ ExpandExpressionPath(ValueObject* vobj,
|
|||
*do_deref_pointer = true;
|
||||
}
|
||||
|
||||
vobj->GetExpressionPath(sstring, true, ValueObject::eHonorPointers);
|
||||
valobj->GetExpressionPath(sstring, true, ValueObject::eHonorPointers);
|
||||
if (log)
|
||||
log->Printf("expression path to expand in phase 0: %s",sstring.GetData());
|
||||
sstring.PutRawBytes(var_name_begin+3, var_name_final-var_name_begin-3);
|
||||
|
@ -870,7 +868,7 @@ ExpandExpressionPath(ValueObject* vobj,
|
|||
}
|
||||
|
||||
static ValueObjectSP
|
||||
ExpandIndexedExpression(ValueObject* vobj,
|
||||
ExpandIndexedExpression(ValueObject* valobj,
|
||||
uint32_t index,
|
||||
StackFrame* frame,
|
||||
bool deref_pointer)
|
||||
|
@ -886,7 +884,7 @@ ExpandIndexedExpression(ValueObject* vobj,
|
|||
ValueObject::ExpressionPathEndResultType final_value_type;
|
||||
ValueObject::ExpressionPathScanEndReason reason_to_stop;
|
||||
ValueObject::ExpressionPathAftermath what_next = (deref_pointer ? ValueObject::eDereference : ValueObject::eNothing);
|
||||
ValueObjectSP item = vobj->GetValueForExpressionPath (ptr_deref_buffer.get(),
|
||||
ValueObjectSP item = valobj->GetValueForExpressionPath (ptr_deref_buffer.get(),
|
||||
&first_unparsed,
|
||||
&reason_to_stop,
|
||||
&final_value_type,
|
||||
|
@ -918,19 +916,19 @@ Debugger::FormatPrompt
|
|||
const Address *addr,
|
||||
Stream &s,
|
||||
const char **end,
|
||||
ValueObject* vobj
|
||||
ValueObject* valobj
|
||||
)
|
||||
{
|
||||
ValueObject* realvobj = NULL; // makes it super-easy to parse pointers
|
||||
ValueObject* realvalobj = NULL; // makes it super-easy to parse pointers
|
||||
bool success = true;
|
||||
const char *p;
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
|
||||
for (p = format; *p != '\0'; ++p)
|
||||
{
|
||||
if (realvobj)
|
||||
if (realvalobj)
|
||||
{
|
||||
vobj = realvobj;
|
||||
realvobj = NULL;
|
||||
valobj = realvalobj;
|
||||
realvalobj = NULL;
|
||||
}
|
||||
size_t non_special_chars = ::strcspn (p, "${}\\");
|
||||
if (non_special_chars > 0)
|
||||
|
@ -959,7 +957,7 @@ Debugger::FormatPrompt
|
|||
|
||||
++p; // Skip the '{'
|
||||
|
||||
if (FormatPrompt (p, sc, exe_ctx, addr, sub_strm, &p, vobj))
|
||||
if (FormatPrompt (p, sc, exe_ctx, addr, sub_strm, &p, valobj))
|
||||
{
|
||||
// The stream had all it needed
|
||||
s.Write(sub_strm.GetData(), sub_strm.GetSize());
|
||||
|
@ -1011,7 +1009,7 @@ Debugger::FormatPrompt
|
|||
case 'v':
|
||||
case 's':
|
||||
{
|
||||
if (!vobj)
|
||||
if (!valobj)
|
||||
break;
|
||||
|
||||
if (log)
|
||||
|
@ -1029,7 +1027,7 @@ Debugger::FormatPrompt
|
|||
|
||||
if (*var_name_begin == 's')
|
||||
{
|
||||
vobj = vobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
|
||||
valobj = valobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
|
||||
var_name_begin++;
|
||||
}
|
||||
|
||||
|
@ -1058,18 +1056,18 @@ Debugger::FormatPrompt
|
|||
bool is_array_range = false;
|
||||
const char* first_unparsed;
|
||||
|
||||
if (!vobj) break;
|
||||
// simplest case ${var}, just print vobj's value
|
||||
if (!valobj) break;
|
||||
// simplest case ${var}, just print valobj's value
|
||||
if (::strncmp (var_name_begin, "var}", strlen("var}")) == 0)
|
||||
{
|
||||
target = vobj;
|
||||
target = valobj;
|
||||
val_obj_display = ValueObject::eDisplayValue;
|
||||
}
|
||||
else if (::strncmp(var_name_begin,"var%",strlen("var%")) == 0)
|
||||
{
|
||||
// this is a variable with some custom format applied to it
|
||||
const char* percent_position;
|
||||
target = vobj;
|
||||
target = valobj;
|
||||
val_obj_display = ValueObject::eDisplayValue;
|
||||
ScanFormatDescriptor (var_name_begin,
|
||||
var_name_end,
|
||||
|
@ -1111,7 +1109,7 @@ Debugger::FormatPrompt
|
|||
if (log)
|
||||
log->Printf("symbol to expand: %s",expr_path.get());
|
||||
|
||||
target = vobj->GetValueForExpressionPath(expr_path.get(),
|
||||
target = valobj->GetValueForExpressionPath(expr_path.get(),
|
||||
&first_unparsed,
|
||||
&reason_to_stop,
|
||||
&final_value_type,
|
||||
|
@ -1200,7 +1198,7 @@ Debugger::FormatPrompt
|
|||
var_success = true;
|
||||
|
||||
if (index_higher < 0)
|
||||
index_higher = vobj->GetNumChildren() - 1;
|
||||
index_higher = valobj->GetNumChildren() - 1;
|
||||
|
||||
uint32_t max_num_children = target->GetUpdatePoint().GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
|
||||
|
||||
|
@ -1776,267 +1774,6 @@ Debugger::FormatPrompt
|
|||
return success;
|
||||
}
|
||||
|
||||
|
||||
static FormatManager&
|
||||
GetFormatManager() {
|
||||
static FormatManager g_format_manager;
|
||||
return g_format_manager;
|
||||
}
|
||||
|
||||
// The platform should be responsible for initializing its own formatters
|
||||
// (e.g. to handle versioning, different runtime libraries, ...)
|
||||
// Currently, basic formatters for std:: objects as implemented by
|
||||
// the GNU libstdc++ are defined regardless, and enabled by default
|
||||
// This is going to be moved to some platform-dependent location
|
||||
// (in the meanwhile, these formatters should work for Mac OS X & Linux)
|
||||
void
|
||||
Debugger::FormatManagerInitialize()
|
||||
{
|
||||
static bool g_initialized = false;
|
||||
|
||||
if (!g_initialized)
|
||||
{
|
||||
g_initialized = true;
|
||||
ConstString gnulib("gnu-libstdc++");
|
||||
FormatManager& format_mgr = GetFormatManager();
|
||||
lldb::FormatCategorySP osxcpp = format_mgr.Category(gnulib.AsCString());
|
||||
osxcpp->Summary()->Add(ConstString("std::string").AsCString(),
|
||||
SummaryFormatSP(new StringSummaryFormat(true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
"${var._M_dataplus._M_p}")));
|
||||
osxcpp->Summary()->Add(ConstString("std::basic_string<char>").AsCString(),
|
||||
SummaryFormatSP(new StringSummaryFormat(true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
"${var._M_dataplus._M_p}")));
|
||||
osxcpp->Summary()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >").AsCString(),
|
||||
SummaryFormatSP(new StringSummaryFormat(true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
"${var._M_dataplus._M_p}")));
|
||||
osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::vector<")),
|
||||
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
||||
false,
|
||||
false,
|
||||
"StdVectorSynthProvider")));
|
||||
osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::map<")),
|
||||
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
||||
false,
|
||||
false,
|
||||
"StdMapSynthProvider")));
|
||||
osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::list<")),
|
||||
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
||||
false,
|
||||
false,
|
||||
"StdListSynthProvider")));
|
||||
|
||||
format_mgr.EnableCategory(gnulib.AsCString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::FormatManagerTerminate()
|
||||
{}
|
||||
|
||||
void
|
||||
Debugger::Formatting::ForceUpdate()
|
||||
{
|
||||
GetFormatManager().Changed();
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::ValueFormats::Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
|
||||
{
|
||||
return GetFormatManager().Value().Get(vobj,entry, use_dynamic);
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::ValueFormats::Add(const ConstString &type, const ValueFormat::SharedPointer &entry)
|
||||
{
|
||||
GetFormatManager().Value().Add(type.AsCString(),entry);
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::ValueFormats::Delete(const ConstString &type)
|
||||
{
|
||||
return GetFormatManager().Value().Delete(type.AsCString());
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::ValueFormats::Clear()
|
||||
{
|
||||
GetFormatManager().Value().Clear();
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().Value().LoopThrough(callback, callback_baton);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Debugger::Formatting::ValueFormats::GetCurrentRevision()
|
||||
{
|
||||
return GetFormatManager().GetCurrentRevision();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Debugger::Formatting::ValueFormats::GetCount()
|
||||
{
|
||||
return GetFormatManager().Value().GetCount();
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::GetSummaryFormat(ValueObject& vobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SummaryFormatSP& entry)
|
||||
{
|
||||
return GetFormatManager().Get(vobj, entry, use_dynamic);
|
||||
}
|
||||
bool
|
||||
Debugger::Formatting::GetSyntheticChildren(ValueObject& vobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SyntheticChildrenSP& entry)
|
||||
{
|
||||
return GetFormatManager().Get(vobj, entry, use_dynamic);
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::AnyMatches(ConstString type_name,
|
||||
FormatCategory::FormatCategoryItems items,
|
||||
bool only_enabled,
|
||||
const char** matching_category,
|
||||
FormatCategory::FormatCategoryItems* matching_type)
|
||||
{
|
||||
return GetFormatManager().AnyMatches(type_name,
|
||||
items,
|
||||
only_enabled,
|
||||
matching_category,
|
||||
matching_type);
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
|
||||
{
|
||||
entry = GetFormatManager().Category(category.GetCString());
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::Categories::Add(const ConstString &category)
|
||||
{
|
||||
GetFormatManager().Category(category.GetCString());
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::Categories::Delete(const ConstString &category)
|
||||
{
|
||||
GetFormatManager().DisableCategory(category.GetCString());
|
||||
return GetFormatManager().Categories().Delete(category.GetCString());
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::Categories::Clear()
|
||||
{
|
||||
GetFormatManager().Categories().Clear();
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::Categories::Clear(ConstString &category)
|
||||
{
|
||||
GetFormatManager().Category(category.GetCString())->ClearSummaries();
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::Categories::Enable(ConstString& category)
|
||||
{
|
||||
if (GetFormatManager().Category(category.GetCString())->IsEnabled() == false)
|
||||
GetFormatManager().EnableCategory(category.GetCString());
|
||||
else
|
||||
{
|
||||
GetFormatManager().DisableCategory(category.GetCString());
|
||||
GetFormatManager().EnableCategory(category.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::Categories::Disable(ConstString& category)
|
||||
{
|
||||
if (GetFormatManager().Category(category.GetCString())->IsEnabled() == true)
|
||||
GetFormatManager().DisableCategory(category.GetCString());
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().LoopThroughCategories(callback, callback_baton);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Debugger::Formatting::Categories::GetCurrentRevision()
|
||||
{
|
||||
return GetFormatManager().GetCurrentRevision();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Debugger::Formatting::Categories::GetCount()
|
||||
{
|
||||
return GetFormatManager().Categories().GetCount();
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::NamedSummaryFormats::Get(const ConstString &type, SummaryFormat::SharedPointer &entry)
|
||||
{
|
||||
return GetFormatManager().NamedSummary().Get(type.AsCString(),entry);
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::NamedSummaryFormats::Add(const ConstString &type, const SummaryFormat::SharedPointer &entry)
|
||||
{
|
||||
GetFormatManager().NamedSummary().Add(type.AsCString(),entry);
|
||||
}
|
||||
|
||||
bool
|
||||
Debugger::Formatting::NamedSummaryFormats::Delete(const ConstString &type)
|
||||
{
|
||||
return GetFormatManager().NamedSummary().Delete(type.AsCString());
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::NamedSummaryFormats::Clear()
|
||||
{
|
||||
GetFormatManager().NamedSummary().Clear();
|
||||
}
|
||||
|
||||
void
|
||||
Debugger::Formatting::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Debugger::Formatting::NamedSummaryFormats::GetCurrentRevision()
|
||||
{
|
||||
return GetFormatManager().GetCurrentRevision();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Debugger::Formatting::NamedSummaryFormats::GetCount()
|
||||
{
|
||||
return GetFormatManager().NamedSummary().GetCount();
|
||||
}
|
||||
|
||||
#pragma mark Debugger::SettingsController
|
||||
|
||||
//--------------------------------------------------
|
||||
|
|
|
@ -69,15 +69,15 @@ StringSummaryFormat::FormatObject(lldb::ValueObjectSP object)
|
|||
|
||||
if (m_show_members_oneliner)
|
||||
{
|
||||
ValueObjectSP synth_vobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
|
||||
const uint32_t num_children = synth_vobj->GetNumChildren();
|
||||
ValueObjectSP synth_valobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
|
||||
const uint32_t num_children = synth_valobj->GetNumChildren();
|
||||
if (num_children)
|
||||
{
|
||||
s.PutChar('(');
|
||||
|
||||
for (uint32_t idx=0; idx<num_children; ++idx)
|
||||
{
|
||||
lldb::ValueObjectSP child_sp(synth_vobj->GetChildAtIndex(idx, true));
|
||||
lldb::ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
|
||||
if (child_sp.get())
|
||||
{
|
||||
if (idx)
|
||||
|
|
|
@ -156,14 +156,14 @@ FormatManager::GetFormatAsCString (Format format)
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key, SummaryFormat::SharedPointer& value)
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(ConstString key, SummaryFormat::SharedPointer& value)
|
||||
{
|
||||
Mutex::Locker(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (regex->Execute(key))
|
||||
if (regex->Execute(key.AsCString()))
|
||||
{
|
||||
value = pos->second;
|
||||
return true;
|
||||
|
@ -174,14 +174,14 @@ FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key,
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* type)
|
||||
FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(ConstString type)
|
||||
{
|
||||
Mutex::Locker(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if ( ::strcmp(type,regex->GetText()) == 0)
|
||||
if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
|
||||
{
|
||||
m_format_map.map().erase(pos);
|
||||
if (m_format_map.listener)
|
||||
|
@ -194,14 +194,14 @@ FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* ty
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key, SyntheticFilter::SharedPointer& value)
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(ConstString key, SyntheticFilter::SharedPointer& value)
|
||||
{
|
||||
Mutex::Locker(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (regex->Execute(key))
|
||||
if (regex->Execute(key.AsCString()))
|
||||
{
|
||||
value = pos->second;
|
||||
return true;
|
||||
|
@ -212,14 +212,14 @@ FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char* type)
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(ConstString type)
|
||||
{
|
||||
Mutex::Locker(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if ( ::strcmp(type,regex->GetText()) == 0)
|
||||
if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
|
||||
{
|
||||
m_format_map.map().erase(pos);
|
||||
if (m_format_map.listener)
|
||||
|
@ -232,14 +232,14 @@ FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char*
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const char* key, SyntheticFilter::SharedPointer& value)
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(ConstString key, SyntheticFilter::SharedPointer& value)
|
||||
{
|
||||
Mutex::Locker(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (regex->Execute(key))
|
||||
if (regex->Execute(key.AsCString()))
|
||||
{
|
||||
value = pos->second;
|
||||
return true;
|
||||
|
@ -250,14 +250,14 @@ FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const c
|
|||
|
||||
template<>
|
||||
bool
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(const char* type)
|
||||
FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(ConstString type)
|
||||
{
|
||||
Mutex::Locker(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++)
|
||||
{
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if ( ::strcmp(type,regex->GetText()) == 0)
|
||||
if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
|
||||
{
|
||||
m_format_map.map().erase(pos);
|
||||
if (m_format_map.listener)
|
||||
|
@ -297,3 +297,286 @@ FormatManager::GetSingleItemFormat(lldb::Format vector_format)
|
|||
return lldb::eFormatInvalid;
|
||||
}
|
||||
}
|
||||
|
||||
FormatManager::FormatManager() :
|
||||
m_value_nav("format",this),
|
||||
m_named_summaries_map(this),
|
||||
m_last_revision(0),
|
||||
m_categories_map(this),
|
||||
m_default_cs(ConstString("default")),
|
||||
m_system_cs(ConstString("system")),
|
||||
m_gnu_stdcpp_cs(ConstString("gnu-libstdc++"))
|
||||
{
|
||||
|
||||
// build default categories
|
||||
|
||||
m_default_category_name = m_default_cs.GetCString();
|
||||
m_system_category_name = m_system_cs.GetCString();
|
||||
m_gnu_cpp_category_name = m_gnu_stdcpp_cs.AsCString();
|
||||
|
||||
// add some default stuff
|
||||
// most formats, summaries, ... actually belong to the users' lldbinit file rather than here
|
||||
SummaryFormat::SharedPointer string_format(new StringSummaryFormat(false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
"${var%s}"));
|
||||
|
||||
|
||||
SummaryFormat::SharedPointer string_array_format(new StringSummaryFormat(false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
"${var%s}"));
|
||||
|
||||
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
|
||||
|
||||
|
||||
Category(m_system_category_name)->Summary()->Add(ConstString("char *"), string_format);
|
||||
Category(m_system_category_name)->Summary()->Add(ConstString("const char *"), string_format);
|
||||
Category(m_system_category_name)->RegexSummary()->Add(any_size_char_arr, string_array_format);
|
||||
|
||||
Category(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
|
||||
|
||||
// WARNING: temporary code!!
|
||||
// The platform should be responsible for initializing its own formatters
|
||||
// (e.g. to handle versioning, different runtime libraries, ...)
|
||||
// Currently, basic formatters for std:: objects as implemented by
|
||||
// the GNU libstdc++ are defined regardless, and enabled by default
|
||||
// This is going to be moved to some platform-dependent location
|
||||
// (in the meanwhile, these formatters should work for Mac OS X & Linux)
|
||||
lldb::SummaryFormatSP std_string_summary_sp(new StringSummaryFormat(true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
"${var._M_dataplus._M_p}"));
|
||||
Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::string"),
|
||||
std_string_summary_sp);
|
||||
Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::basic_string<char>"),
|
||||
std_string_summary_sp);
|
||||
Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
|
||||
std_string_summary_sp);
|
||||
|
||||
Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::vector<")),
|
||||
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
||||
false,
|
||||
false,
|
||||
"StdVectorSynthProvider")));
|
||||
Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::map<")),
|
||||
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
||||
false,
|
||||
false,
|
||||
"StdMapSynthProvider")));
|
||||
Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::list<")),
|
||||
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
||||
false,
|
||||
false,
|
||||
"StdListSynthProvider")));
|
||||
|
||||
// DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
|
||||
EnableCategory(m_system_category_name);
|
||||
EnableCategory(m_gnu_cpp_category_name);
|
||||
EnableCategory(m_default_category_name);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static FormatManager&
|
||||
GetFormatManager() {
|
||||
static FormatManager g_format_manager;
|
||||
return g_format_manager;
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::ForceUpdate()
|
||||
{
|
||||
GetFormatManager().Changed();
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
|
||||
{
|
||||
return GetFormatManager().Value().Get(valobj,entry, use_dynamic);
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::ValueFormats::Add(const ConstString &type, const ValueFormat::SharedPointer &entry)
|
||||
{
|
||||
GetFormatManager().Value().Add(type,entry);
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::ValueFormats::Delete(const ConstString &type)
|
||||
{
|
||||
return GetFormatManager().Value().Delete(type);
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::ValueFormats::Clear()
|
||||
{
|
||||
GetFormatManager().Value().Clear();
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().Value().LoopThrough(callback, callback_baton);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DataVisualization::ValueFormats::GetCurrentRevision()
|
||||
{
|
||||
return GetFormatManager().GetCurrentRevision();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DataVisualization::ValueFormats::GetCount()
|
||||
{
|
||||
return GetFormatManager().Value().GetCount();
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::GetSummaryFormat(ValueObject& valobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SummaryFormatSP& entry)
|
||||
{
|
||||
return GetFormatManager().Get(valobj, entry, use_dynamic);
|
||||
}
|
||||
bool
|
||||
DataVisualization::GetSyntheticChildren(ValueObject& valobj,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
lldb::SyntheticChildrenSP& entry)
|
||||
{
|
||||
return GetFormatManager().Get(valobj, entry, use_dynamic);
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::AnyMatches(ConstString type_name,
|
||||
FormatCategory::FormatCategoryItems items,
|
||||
bool only_enabled,
|
||||
const char** matching_category,
|
||||
FormatCategory::FormatCategoryItems* matching_type)
|
||||
{
|
||||
return GetFormatManager().AnyMatches(type_name,
|
||||
items,
|
||||
only_enabled,
|
||||
matching_category,
|
||||
matching_type);
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
|
||||
{
|
||||
entry = GetFormatManager().Category(category.GetCString());
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::Add(const ConstString &category)
|
||||
{
|
||||
GetFormatManager().Category(category.GetCString());
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::Categories::Delete(const ConstString &category)
|
||||
{
|
||||
GetFormatManager().DisableCategory(category.GetCString());
|
||||
return GetFormatManager().Categories().Delete(category.GetCString());
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::Clear()
|
||||
{
|
||||
GetFormatManager().Categories().Clear();
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::Clear(ConstString &category)
|
||||
{
|
||||
GetFormatManager().Category(category.GetCString())->ClearSummaries();
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::Enable(ConstString& category)
|
||||
{
|
||||
if (GetFormatManager().Category(category.GetCString())->IsEnabled() == false)
|
||||
GetFormatManager().EnableCategory(category.GetCString());
|
||||
else
|
||||
{
|
||||
GetFormatManager().DisableCategory(category.GetCString());
|
||||
GetFormatManager().EnableCategory(category.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::Disable(ConstString& category)
|
||||
{
|
||||
if (GetFormatManager().Category(category.GetCString())->IsEnabled() == true)
|
||||
GetFormatManager().DisableCategory(category.GetCString());
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().LoopThroughCategories(callback, callback_baton);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DataVisualization::Categories::GetCurrentRevision()
|
||||
{
|
||||
return GetFormatManager().GetCurrentRevision();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DataVisualization::Categories::GetCount()
|
||||
{
|
||||
return GetFormatManager().Categories().GetCount();
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::NamedSummaryFormats::Get(const ConstString &type, SummaryFormat::SharedPointer &entry)
|
||||
{
|
||||
return GetFormatManager().NamedSummary().Get(type,entry);
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::NamedSummaryFormats::Add(const ConstString &type, const SummaryFormat::SharedPointer &entry)
|
||||
{
|
||||
GetFormatManager().NamedSummary().Add(type,entry);
|
||||
}
|
||||
|
||||
bool
|
||||
DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
|
||||
{
|
||||
return GetFormatManager().NamedSummary().Delete(type);
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::NamedSummaryFormats::Clear()
|
||||
{
|
||||
GetFormatManager().NamedSummary().Clear();
|
||||
}
|
||||
|
||||
void
|
||||
DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
|
||||
{
|
||||
GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DataVisualization::NamedSummaryFormats::GetCurrentRevision()
|
||||
{
|
||||
return GetFormatManager().GetCurrentRevision();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DataVisualization::NamedSummaryFormats::GetCount()
|
||||
{
|
||||
return GetFormatManager().NamedSummary().GetCount();
|
||||
}
|
|
@ -20,6 +20,7 @@
|
|||
// Project includes
|
||||
#include "lldb/Core/DataBufferHeap.h"
|
||||
#include "lldb/Core/Debugger.h"
|
||||
#include "lldb/Core/FormatManager.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Core/ValueObjectChild.h"
|
||||
|
@ -223,13 +224,13 @@ ValueObject::UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic)
|
|||
log->Printf("checking for FormatManager revisions. VO named %s is at revision %d, while the format manager is at revision %d",
|
||||
GetName().GetCString(),
|
||||
m_last_format_mgr_revision,
|
||||
Debugger::Formatting::ValueFormats::GetCurrentRevision());
|
||||
DataVisualization::ValueFormats::GetCurrentRevision());
|
||||
if (HasCustomSummaryFormat() && m_update_point.GetModID() != m_user_id_of_forced_summary)
|
||||
{
|
||||
ClearCustomSummaryFormat();
|
||||
m_summary_str.clear();
|
||||
}
|
||||
if ( (m_last_format_mgr_revision != Debugger::Formatting::ValueFormats::GetCurrentRevision()) ||
|
||||
if ( (m_last_format_mgr_revision != DataVisualization::ValueFormats::GetCurrentRevision()) ||
|
||||
m_last_format_mgr_dynamic != use_dynamic)
|
||||
{
|
||||
if (m_last_summary_format.get())
|
||||
|
@ -241,11 +242,11 @@ ValueObject::UpdateFormatsIfNeeded(lldb::DynamicValueType use_dynamic)
|
|||
|
||||
m_synthetic_value = NULL;
|
||||
|
||||
Debugger::Formatting::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
|
||||
Debugger::Formatting::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
|
||||
Debugger::Formatting::GetSyntheticChildren(*this, use_dynamic, m_last_synthetic_filter);
|
||||
DataVisualization::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
|
||||
DataVisualization::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
|
||||
DataVisualization::GetSyntheticChildren(*this, use_dynamic, m_last_synthetic_filter);
|
||||
|
||||
m_last_format_mgr_revision = Debugger::Formatting::ValueFormats::GetCurrentRevision();
|
||||
m_last_format_mgr_revision = DataVisualization::ValueFormats::GetCurrentRevision();
|
||||
m_last_format_mgr_dynamic = use_dynamic;
|
||||
|
||||
ClearUserVisibleData();
|
||||
|
@ -2852,10 +2853,10 @@ ValueObject::DumpValueObject
|
|||
|
||||
if (print_children && (!entry || entry->DoesPrintChildren() || !sum_cstr))
|
||||
{
|
||||
ValueObjectSP synth_vobj = valobj->GetSyntheticValue(use_synth ?
|
||||
ValueObjectSP synth_valobj = valobj->GetSyntheticValue(use_synth ?
|
||||
lldb::eUseSyntheticFilter :
|
||||
lldb::eNoSyntheticFilter);
|
||||
uint32_t num_children = synth_vobj->GetNumChildren();
|
||||
uint32_t num_children = synth_valobj->GetNumChildren();
|
||||
bool print_dotdotdot = false;
|
||||
if (num_children)
|
||||
{
|
||||
|
@ -2881,7 +2882,7 @@ ValueObject::DumpValueObject
|
|||
|
||||
for (uint32_t idx=0; idx<num_children; ++idx)
|
||||
{
|
||||
ValueObjectSP child_sp(synth_vobj->GetChildAtIndex(idx, true));
|
||||
ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
|
||||
if (child_sp.get())
|
||||
{
|
||||
DumpValueObject (s,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// Project includes
|
||||
|
||||
#include "lldb/Core/Debugger.h"
|
||||
|
||||
#include "lldb/Core/FormatManager.h"
|
||||
#include "lldb/Interpreter/Args.h"
|
||||
|
||||
#include "lldb/Interpreter/CommandReturnObject.h"
|
||||
|
@ -57,7 +57,7 @@ CommandObjectScript::ExecuteRawCommandString
|
|||
result.SetStatus (eReturnStatusFailed);
|
||||
}
|
||||
|
||||
Debugger::Formatting::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it
|
||||
DataVisualization::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it
|
||||
|
||||
if (command == NULL || command[0] == '\0') {
|
||||
script_interpreter->ExecuteInterpreterLoop ();
|
||||
|
|
|
@ -174,7 +174,7 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
|
|||
PyRun_SimpleString (run_string.GetData());
|
||||
|
||||
run_string.Clear();
|
||||
run_string.Printf ("run_one_line (%s, 'from osxcpp import *')", m_dictionary_name.c_str(),
|
||||
run_string.Printf ("run_one_line (%s, 'from gnu_libstdcpp import *')", m_dictionary_name.c_str(),
|
||||
interpreter.GetDebugger().GetID());
|
||||
PyRun_SimpleString (run_string.GetData());
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class DataFormatterTestCase(TestBase):
|
|||
self.addTearDownHook(cleanup)
|
||||
|
||||
# Setup the summaries for this scenario
|
||||
self.runCmd("type summary add -f \"${var._M_dataplus._M_p}\" std::string") # This works fine on OSX 10.6.8, if it differs on your implementation, submit a patch to adapt it to your C++ stdlib
|
||||
#self.runCmd("type summary add -f \"${var._M_dataplus._M_p}\" std::string")
|
||||
self.runCmd("type summary add -f \"Level 1\" \"DeepData_1\"")
|
||||
self.runCmd("type summary add -f \"Level 2\" \"DeepData_2\" -e")
|
||||
self.runCmd("type summary add -f \"Level 3\" \"DeepData_3\"")
|
||||
|
|
Loading…
Reference in New Issue