20#include "llvm/ADT/STLExtras.h"
79 "All formats must have a corresponding info entry.");
106 .starts_with_insensitive(format_name)) {
121 iter.second->GetFormatCache().Clear();
127 bool success =
false;
128 if (format_cstr && format_cstr[0]) {
129 if (format_cstr[1] ==
'\0') {
161 iter.second->Enable();
170 iter.second->Disable();
187 target_sp->GetDebugger().GetScriptInterpreter();
192 entries.push_back({bitfieldname, script_interpreter,
193 TypeImpl(compiler_type), current_flags});
197 entries.push_back({type_name, script_interpreter,
TypeImpl(compiler_type),
201 if (display_type_name != type_name)
202 entries.push_back({display_type_name, script_interpreter,
203 TypeImpl(compiler_type), current_flags});
206 for (
bool is_rvalue_ref =
true, j =
true;
207 j && compiler_type.
IsReferenceType(
nullptr, &is_rvalue_ref); j =
false) {
213 deffed_referenced_type =
218 valobj, deffed_referenced_type,
239 if (compiler_type.
IsArrayType(
nullptr, &array_size,
nullptr)) {
250 valobj, deffed_array_type,
259 language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
260 entries.push_back(candidate);
279 if (!unqual_compiler_ast_type.
IsValid())
284 entries, current_flags);
292 static_value_sp->GetCompilerType(), use_dynamic,
293 entries, current_flags,
true);
306 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
308 if (!category_sp->IsEnabled())
311 category_sp->GetFormatForType(type_sp);
312 if (format_current_sp &&
313 (format_chosen_sp.get() ==
nullptr ||
314 (prio_category > category_sp->GetEnabledPosition()))) {
315 prio_category = category_sp->GetEnabledPosition();
316 format_chosen_sp = format_current_sp;
319 return format_chosen_sp;
330 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
332 if (!category_sp->IsEnabled())
335 category_sp->GetSummaryForType(type_sp);
336 if (summary_current_sp &&
337 (summary_chosen_sp.get() ==
nullptr ||
338 (prio_category > category_sp->GetEnabledPosition()))) {
339 prio_category = category_sp->GetEnabledPosition();
340 summary_chosen_sp = summary_current_sp;
343 return summary_chosen_sp;
354 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
356 if (!category_sp->IsEnabled())
360 if (filter_current_sp &&
361 (filter_chosen_sp.get() ==
nullptr ||
362 (prio_category > category_sp->GetEnabledPosition()))) {
363 prio_category = category_sp->GetEnabledPosition();
364 filter_chosen_sp = filter_current_sp;
367 return filter_chosen_sp;
378 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
380 if (!category_sp->IsEnabled())
385 if (synth_current_sp &&
386 (synth_chosen_sp.get() ==
nullptr ||
387 (prio_category > category_sp->GetEnabledPosition()))) {
388 prio_category = category_sp->GetEnabledPosition();
389 synth_chosen_sp = synth_current_sp;
392 return synth_chosen_sp;
399 if (
auto category_sp = entry.second->GetCategory()) {
400 if (!callback(category_sp))
424 switch (vector_format) {
454 if (target_sp && !target_sp->GetDebugger().GetAutoOneLineSummaries())
461 const size_t max_num_children =
463 .GetMaximumNumberOfChildrenToDisplay();
466 llvm::consumeError(num_children.takeError());
470 if (*num_children == 0)
487 size_t total_children_name_len = 0;
489 for (
size_t idx = 0; idx < *num_children; idx++) {
490 bool is_synth_val =
false;
497 CompilerType child_compiler_type(child_sp->GetCompilerType());
498 if (child_compiler_type.
IsValid()) {
512 if (child_sp->GetSyntheticChildren().get() !=
nullptr) {
518 if (!synth_sp->MightHaveChildren() &&
519 synth_sp->DoesProvideSyntheticValue())
525 total_children_name_len += child_sp->GetName().GetLength();
530 if (total_children_name_len > 50)
534 if (child_sp->GetSummaryFormat()) {
536 if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
541 if (child_sp->HasChildren()) {
547 if (!child_sp->GetSummaryFormat() && !is_synth_val)
561 if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
562 if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
563 return valobj_sp->GetQualifiedTypeName();
568std::vector<lldb::LanguageType>
583 llvm_unreachable(
"Fully covered switch");
592 return iter->second.get();
596 return lang_category;
599template <
typename ImplSP>
604 if (lang_category->GetHardcoded(*
this, match_data, retval_sp))
612template <
typename ImplSP>
const char *FormatterKind;
613template <>
const char *FormatterKind<lldb::TypeFormatImplSP> =
"format";
614template <>
const char *FormatterKind<lldb::TypeSummaryImplSP> =
"summary";
615template <>
const char *FormatterKind<lldb::SyntheticChildrenSP> =
"synthetic";
618#define FORMAT_LOG(Message) "[%s] " Message, FormatterKind<ImplSP>
620template <
typename ImplSP>
624 if (ImplSP retval_sp = GetCached<ImplSP>(match_data))
633 if (lang_category->Get(match_data, retval_sp))
642 return GetHardcoded<ImplSP>(match_data);
645template <
typename ImplSP>
655 LLDB_LOGV(log,
"Cache hits: {0} - Cache Misses: {1}",
665 if (match_data.
GetTypeForCache() && (!retval_sp || !retval_sp->NonCacheable())) {
667 static_cast<void *
>(retval_sp.get()),
671 LLDB_LOGV(log,
"Cache hits: {0} - Cache Misses: {1}",
697 : m_last_revision(0), m_format_cache(), m_language_categories_mutex(),
698 m_language_categories_map(), m_named_summaries_map(this),
699 m_categories_map(this), m_default_category_name(
ConstString(
"default")),
701 m_vectortypes_category_name(
ConstString(
"VectorTypes")) {
739 sys_category_sp->AddTypeSummary(R
"(^(unsigned )?char ?(\*|\[\])$)",
742 sys_category_sp->AddTypeSummary(R"(^((un)?signed )?char ?\[[0-9]+\]$)",
748 .SetSkipPointers(
true)
749 .SetSkipReferences(
true)
750 .SetDontShowChildren(
true)
751 .SetDontShowValue(
false)
752 .SetShowMembersOneLiner(
false)
753 .SetHideItemNames(
false),
780 AddStringSummary(vectors_category_sp,
"${var.uint128}",
"builtin_type_vec128",
#define LLDB_LOGF(log,...)
#define LLDB_LOGV(log,...)
Generic representation of a type in a programming language.
CompilerType GetTypeForFormatters() const
CompilerType GetArrayType(uint64_t size) const
bool IsArrayType(CompilerType *element_type=nullptr, uint64_t *size=nullptr, bool *is_incomplete=nullptr) const
CompilerType GetRValueReferenceType() const
Return a new CompilerType that is a R value reference to this type if this type is valid and the type...
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
CompilerType GetNonReferenceType() const
If this type is a reference to a type (L value or R value reference), return a new type with the refe...
bool IsMeaninglessWithoutDynamicResolution() const
ConstString GetTypeName(bool BaseOnly=false) const
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
bool IsReferenceType(CompilerType *pointee_type=nullptr, bool *is_rvalue=nullptr) const
CompilerType GetArrayElementType(ExecutionContextScope *exe_scope) const
Creating related types.
CompilerType GetFullyUnqualifiedType() const
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
bool IsTypedefType() const
LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const
bool IsPointerType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
std::unique_ptr< LanguageCategory > UniquePointer
static Language * FindPlugin(lldb::LanguageType language)
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
static TargetProperties & GetGlobalProperties()
std::shared_ptr< TypeCategoryImpl > SharedPointer
std::function< bool(const lldb::TypeCategoryImplSP &)> ForEachCallback
static const Position Last
void Add(KeyType name, const lldb::TypeCategoryImplSP &entry)
void DisableAllCategories()
void EnableAllCategories()
bool Get(KeyType name, lldb::TypeCategoryImplSP &entry)
void ForEach(ForEachCallback callback)
Flags & SetCascades(bool value=true)
Flags & SetSkipPointers(bool value=true)
Flags & SetHideItemNames(bool value=true)
Flags & SetDontShowChildren(bool value=true)
Flags & SetSkipReferences(bool value=true)
Flags & SetShowMembersOneLiner(bool value=true)
Flags & SetDontShowValue(bool value=true)
lldb::TypeSummaryImplSP GetSummaryFormat()
virtual uint32_t GetBitfieldBitSize()
virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx, bool can_create=true)
CompilerType GetCompilerType()
llvm::Expected< uint32_t > GetNumChildren(uint32_t max=UINT32_MAX)
lldb::LanguageType GetObjectRuntimeLanguage()
lldb::ValueObjectSP GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue, bool synthValue)
lldb::TargetSP GetTargetSP() const
virtual lldb::ValueObjectSP GetStaticValue()
virtual bool IsSynthetic()
const ExecutionContextRef & GetExecutionContextRef() const
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
template bool LanguageCategory::Get< lldb::TypeFormatImplSP >(FormattersMatchData &, lldb::TypeFormatImplSP &)
Explicit instantiations for the three types.
std::vector< FormattersMatchCandidate > FormattersMatchVector
template bool LanguageCategory::Get< lldb::SyntheticChildrenSP >(FormattersMatchData &, lldb::SyntheticChildrenSP &)
template bool LanguageCategory::Get< lldb::TypeSummaryImplSP >(FormattersMatchData &, lldb::TypeSummaryImplSP &)
std::shared_ptr< lldb_private::TypeSummaryImpl > TypeSummaryImplSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::TypeNameSpecifierImpl > TypeNameSpecifierImplSP
Format
Display format definitions.
@ eFormatCString
NULL terminated C strings.
@ eFormatCharArray
Print characters with no single quotes, used for character arrays that can contain non printable char...
@ eFormatInstruction
Disassemble an opcode.
@ eFormatVoid
Do not print this.
@ eFormatHexFloat
ISO C99 hex float string.
@ eFormatOSType
OS character codes encoded into an integer 'PICT' 'text' etc...
@ eFormatAddressInfo
Describe what an address points to (func + offset.
@ eFormatCharPrintable
Only printable characters, '.' if not printable.
@ eFormatComplexInteger
Integer complex type.
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus_14
ISO C++:2014.
@ eLanguageTypeC11
ISO C:2011.
@ eLanguageTypeC99
ISO C:1999.
@ eLanguageTypeC_plus_plus_03
ISO C++:2003.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeC_plus_plus_11
ISO C++:2011.
@ eLanguageTypeC89
ISO C:1989.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
std::shared_ptr< lldb_private::ScriptedSyntheticChildren > ScriptedSyntheticChildrenSP
std::shared_ptr< lldb_private::TypeFilterImpl > TypeFilterImplSP
std::shared_ptr< lldb_private::Target > TargetSP