20#include "llvm/ADT/STLExtras.h"
80 "All formats must have a corresponding info entry.");
99 if (format_name.equals_insensitive(
g_format_infos[i].format_name)) {
107 .starts_with_insensitive(format_name)) {
122 iter.second->GetFormatCache().Clear();
128 bool success =
false;
129 if (format_cstr && format_cstr[0]) {
130 if (format_cstr[1] ==
'\0') {
162 iter.second->Enable();
171 iter.second->Disable();
179 uint32_t ptr_stripped_depth) {
189 target_sp->GetDebugger().GetScriptInterpreter();
194 entries.push_back({bitfieldname, script_interpreter,
195 TypeImpl(compiler_type), current_flags,
196 ptr_stripped_depth});
200 entries.push_back({type_name, script_interpreter,
TypeImpl(compiler_type),
201 current_flags, ptr_stripped_depth});
204 if (display_type_name != type_name)
205 entries.push_back({display_type_name, script_interpreter,
206 TypeImpl(compiler_type), current_flags,
207 ptr_stripped_depth});
210 for (
bool is_rvalue_ref =
true, j =
true;
211 j && compiler_type.
IsReferenceType(
nullptr, &is_rvalue_ref); j =
false) {
218 deffed_referenced_type =
232 ptr_stripped_depth + 1);
239 ptr_stripped_depth + 1);
246 if (compiler_type.
IsArrayType(
nullptr, &array_size,
nullptr)) {
266 language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
267 entries.push_back(candidate);
287 if (!unqual_compiler_ast_type.
IsValid())
292 entries, current_flags, root_level,
301 static_value_sp->GetCompilerType(), use_dynamic,
302 entries, current_flags,
true, ptr_stripped_depth);
315 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
317 if (!category_sp->IsEnabled())
320 category_sp->GetFormatForType(type_sp);
321 if (format_current_sp &&
322 (format_chosen_sp.get() ==
nullptr ||
323 (prio_category > category_sp->GetEnabledPosition()))) {
324 prio_category = category_sp->GetEnabledPosition();
325 format_chosen_sp = format_current_sp;
328 return format_chosen_sp;
339 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
341 if (!category_sp->IsEnabled())
344 category_sp->GetSummaryForType(type_sp);
345 if (summary_current_sp &&
346 (summary_chosen_sp.get() ==
nullptr ||
347 (prio_category > category_sp->GetEnabledPosition()))) {
348 prio_category = category_sp->GetEnabledPosition();
349 summary_chosen_sp = summary_current_sp;
352 return summary_chosen_sp;
363 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
365 if (!category_sp->IsEnabled())
369 if (filter_current_sp &&
370 (filter_chosen_sp.get() ==
nullptr ||
371 (prio_category > category_sp->GetEnabledPosition()))) {
372 prio_category = category_sp->GetEnabledPosition();
373 filter_chosen_sp = filter_current_sp;
376 return filter_chosen_sp;
387 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
389 if (!category_sp->IsEnabled())
394 if (synth_current_sp &&
395 (synth_chosen_sp.get() ==
nullptr ||
396 (prio_category > category_sp->GetEnabledPosition()))) {
397 prio_category = category_sp->GetEnabledPosition();
398 synth_chosen_sp = synth_current_sp;
401 return synth_chosen_sp;
408 if (
auto category_sp = entry.second->GetCategory()) {
409 if (!callback(category_sp))
427 std::make_shared<TypeCategoryImpl>(
this, category_name));
432 switch (vector_format) {
462 if (target_sp && !target_sp->GetDebugger().GetAutoOneLineSummaries())
469 const size_t max_num_children =
471 .GetMaximumNumberOfChildrenToDisplay();
474 llvm::consumeError(num_children.takeError());
478 if (*num_children == 0)
495 size_t total_children_name_len = 0;
497 for (
size_t idx = 0; idx < *num_children; idx++) {
498 bool is_synth_val =
false;
505 CompilerType child_compiler_type(child_sp->GetCompilerType());
506 if (child_compiler_type.
IsValid()) {
520 if (child_sp->GetSyntheticChildren().get() !=
nullptr) {
526 if (!synth_sp->MightHaveChildren() &&
527 synth_sp->DoesProvideSyntheticValue())
533 total_children_name_len += child_sp->GetName().GetLength();
538 if (total_children_name_len > 50)
542 if (child_sp->GetSummaryFormat()) {
544 if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
549 if (child_sp->HasChildren()) {
555 if (!child_sp->GetSummaryFormat() && !is_synth_val)
569 if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
570 if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
571 return valobj_sp->GetQualifiedTypeName();
576std::vector<lldb::LanguageType>
591 llvm_unreachable(
"Fully covered switch");
600 return iter->second.get();
604 return lang_category;
607template <
typename ImplSP>
612 if (lang_category->GetHardcoded(*
this, match_data, retval_sp))
620template <
typename ImplSP>
const char *FormatterKind;
621template <>
const char *FormatterKind<lldb::TypeFormatImplSP> =
"format";
622template <>
const char *FormatterKind<lldb::TypeSummaryImplSP> =
"summary";
623template <>
const char *FormatterKind<lldb::SyntheticChildrenSP> =
"synthetic";
626#define FORMAT_LOG(Message) "[%s] " Message, FormatterKind<ImplSP>
628template <
typename ImplSP>
641 if (lang_category->Get(match_data, retval_sp))
653template <
typename ImplSP>
663 LLDB_LOGV(log,
"Cache hits: {0} - Cache Misses: {1}",
673 if (match_data.
GetTypeForCache() && (!retval_sp || !retval_sp->NonCacheable())) {
675 static_cast<void *
>(retval_sp.get()),
679 LLDB_LOGV(log,
"Cache hits: {0} - Cache Misses: {1}",
747 sys_category_sp->AddTypeSummary(R
"(^(unsigned )?char ?(\*|\[\])$)",
750 sys_category_sp->AddTypeSummary(R"(^((un)?signed )?char ?\[[0-9]+\]$)",
756 .SetSkipPointers(
true)
757 .SetSkipReferences(
true)
758 .SetDontShowChildren(
true)
759 .SetDontShowValue(
false)
760 .SetShowMembersOneLiner(
false)
761 .SetHideItemNames(
false),
788 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
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 with file/line, symbol + offset,...
@ eFormatCharPrintable
Only printable characters, '.' if not printable.
@ eFormatComplexInteger
Integer complex type.
@ eFormatFloat128
Disambiguate between 128-bit long double (which uses eFormatFloat) and __float128 (which uses eFormat...
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