19#include "llvm/ADT/STLExtras.h"
78 "All formats must have a corresponding info entry.");
94 bool partial_match_ok,
Format &format) {
103 if (partial_match_ok) {
106 .starts_with_insensitive(format_name)) {
122 iter.second->GetFormatCache().Clear();
127 bool partial_match_ok,
129 bool success =
false;
130 if (format_cstr && format_cstr[0]) {
131 if (format_cstr[1] ==
'\0') {
163 iter.second->Enable();
172 iter.second->Disable();
183 valobj.
GetTargetSP()->GetDebugger().GetScriptInterpreter();
188 entries.push_back({bitfieldname, script_interpreter,
189 TypeImpl(compiler_type), current_flags});
193 entries.push_back({type_name, script_interpreter,
TypeImpl(compiler_type),
197 if (display_type_name != type_name)
198 entries.push_back({display_type_name, script_interpreter,
199 TypeImpl(compiler_type), current_flags});
202 for (
bool is_rvalue_ref =
true, j =
true;
203 j && compiler_type.
IsReferenceType(
nullptr, &is_rvalue_ref); j =
false) {
209 deffed_referenced_type =
214 valobj, deffed_referenced_type,
235 if (compiler_type.
IsArrayType(
nullptr, &array_size,
nullptr)) {
246 valobj, deffed_array_type,
255 language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
256 entries.push_back(candidate);
275 if (!unqual_compiler_ast_type.
IsValid())
280 entries, current_flags);
288 static_value_sp->GetCompilerType(), use_dynamic,
289 entries, current_flags,
true);
302 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
304 if (!category_sp->IsEnabled())
307 category_sp->GetFormatForType(type_sp);
308 if (format_current_sp &&
309 (format_chosen_sp.get() ==
nullptr ||
310 (prio_category > category_sp->GetEnabledPosition()))) {
311 prio_category = category_sp->GetEnabledPosition();
312 format_chosen_sp = format_current_sp;
315 return format_chosen_sp;
326 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
328 if (!category_sp->IsEnabled())
331 category_sp->GetSummaryForType(type_sp);
332 if (summary_current_sp &&
333 (summary_chosen_sp.get() ==
nullptr ||
334 (prio_category > category_sp->GetEnabledPosition()))) {
335 prio_category = category_sp->GetEnabledPosition();
336 summary_chosen_sp = summary_current_sp;
339 return summary_chosen_sp;
350 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
352 if (!category_sp->IsEnabled())
356 if (filter_current_sp &&
357 (filter_chosen_sp.get() ==
nullptr ||
358 (prio_category > category_sp->GetEnabledPosition()))) {
359 prio_category = category_sp->GetEnabledPosition();
360 filter_chosen_sp = filter_current_sp;
363 return filter_chosen_sp;
374 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
376 if (!category_sp->IsEnabled())
381 if (synth_current_sp &&
382 (synth_chosen_sp.get() ==
nullptr ||
383 (prio_category > category_sp->GetEnabledPosition()))) {
384 prio_category = category_sp->GetEnabledPosition();
385 synth_chosen_sp = synth_current_sp;
388 return synth_chosen_sp;
395 if (
auto category_sp = entry.second->GetCategory()) {
396 if (!callback(category_sp))
420 switch (vector_format) {
450 !valobj.
GetTargetSP()->GetDebugger().GetAutoOneLineSummaries())
475 size_t total_children_name_len = 0;
478 bool is_synth_val =
false;
485 CompilerType child_compiler_type(child_sp->GetCompilerType());
486 if (child_compiler_type.
IsValid()) {
500 if (child_sp->GetSyntheticChildren().get() !=
nullptr) {
506 if (!synth_sp->MightHaveChildren() &&
507 synth_sp->DoesProvideSyntheticValue())
513 total_children_name_len += child_sp->GetName().GetLength();
518 if (total_children_name_len > 50)
522 if (child_sp->GetSummaryFormat()) {
524 if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
529 if (child_sp->GetNumChildren()) {
535 if (!child_sp->GetSummaryFormat() && !is_synth_val)
549 if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
550 if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
551 return valobj_sp->GetQualifiedTypeName();
556std::vector<lldb::LanguageType>
571 llvm_unreachable(
"Fully covered switch");
580 return iter->second.get();
584 return lang_category;
587template <
typename ImplSP>
592 if (lang_category->GetHardcoded(*
this, match_data, retval_sp))
600template <
typename ImplSP>
const char *FormatterKind;
601template <>
const char *FormatterKind<lldb::TypeFormatImplSP> =
"format";
602template <>
const char *FormatterKind<lldb::TypeSummaryImplSP> =
"summary";
603template <>
const char *FormatterKind<lldb::SyntheticChildrenSP> =
"synthetic";
606#define FORMAT_LOG(Message) "[%s] " Message, FormatterKind<ImplSP>
608template <
typename ImplSP>
612 if (ImplSP retval_sp = GetCached<ImplSP>(match_data))
621 if (lang_category->Get(match_data, retval_sp))
630 return GetHardcoded<ImplSP>(match_data);
633template <
typename ImplSP>
643 LLDB_LOGV(log,
"Cache hits: {0} - Cache Misses: {1}",
653 if (match_data.
GetTypeForCache() && (!retval_sp || !retval_sp->NonCacheable())) {
655 static_cast<void *
>(retval_sp.get()),
659 LLDB_LOGV(log,
"Cache hits: {0} - Cache Misses: {1}",
685 : m_last_revision(0), m_format_cache(), m_language_categories_mutex(),
686 m_language_categories_map(), m_named_summaries_map(this),
687 m_categories_map(this), m_default_category_name(
ConstString(
"default")),
689 m_vectortypes_category_name(
ConstString(
"VectorTypes")) {
727 sys_category_sp->AddTypeSummary(R
"(^(unsigned )?char ?(\*|\[\])$)",
730 sys_category_sp->AddTypeSummary(R"(^((un)?signed )?char ?\[[0-9]+\]$)",
736 .SetSkipPointers(
true)
737 .SetSkipReferences(
true)
738 .SetDontShowChildren(
true)
739 .SetDontShowValue(
false)
740 .SetShowMembersOneLiner(
false)
741 .SetHideItemNames(
false),
768 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.
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()
size_t GetNumChildren(uint32_t max=UINT32_MAX)
CompilerType GetCompilerType()
lldb::LanguageType GetObjectRuntimeLanguage()
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create=true)
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