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();
193 llvm::StringRef bitfieldname(sstring.
GetString());
194 entries.push_back({bitfieldname.str(), script_interpreter,
195 TypeImpl(compiler_type), current_flags,
196 ptr_stripped_depth});
200 entries.push_back({type_name.str(), script_interpreter,
201 TypeImpl(compiler_type), current_flags,
202 ptr_stripped_depth});
204 llvm::StringRef display_type_name(compiler_type.
GetTypeName());
205 if (display_type_name != type_name)
206 entries.push_back({display_type_name.str(), script_interpreter,
207 TypeImpl(compiler_type), current_flags,
208 ptr_stripped_depth});
211 for (
bool is_rvalue_ref =
true, j =
true;
212 j && compiler_type.
IsReferenceType(
nullptr, &is_rvalue_ref); j =
false) {
219 deffed_referenced_type =
233 ptr_stripped_depth + 1);
240 ptr_stripped_depth + 1);
247 if (compiler_type.
IsArrayType(
nullptr, &array_size,
nullptr)) {
267 language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
268 entries.push_back(candidate);
288 if (!unqual_compiler_ast_type.
IsValid())
293 entries, current_flags, root_level,
302 static_value_sp->GetCompilerType(), use_dynamic,
303 entries, current_flags,
true, ptr_stripped_depth);
316 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
318 if (!category_sp->IsEnabled())
321 category_sp->GetFormatForType(type_sp);
322 if (format_current_sp &&
323 (format_chosen_sp.get() ==
nullptr ||
324 (prio_category > category_sp->GetEnabledPosition()))) {
325 prio_category = category_sp->GetEnabledPosition();
326 format_chosen_sp = format_current_sp;
329 return format_chosen_sp;
340 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
342 if (!category_sp->IsEnabled())
345 category_sp->GetSummaryForType(type_sp);
346 if (summary_current_sp &&
347 (summary_chosen_sp.get() ==
nullptr ||
348 (prio_category > category_sp->GetEnabledPosition()))) {
349 prio_category = category_sp->GetEnabledPosition();
350 summary_chosen_sp = summary_current_sp;
353 return summary_chosen_sp;
364 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
366 if (!category_sp->IsEnabled())
370 if (filter_current_sp &&
371 (filter_chosen_sp.get() ==
nullptr ||
372 (prio_category > category_sp->GetEnabledPosition()))) {
373 prio_category = category_sp->GetEnabledPosition();
374 filter_chosen_sp = filter_current_sp;
377 return filter_chosen_sp;
388 for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
390 if (!category_sp->IsEnabled())
392 auto synth_current_sp = category_sp->GetSyntheticForType(type_sp);
394 if (synth_current_sp && synth_current_sp->IsScripted() &&
395 (synth_chosen_sp.get() ==
nullptr ||
396 (prio_category > category_sp->GetEnabledPosition()))) {
397 prio_category = category_sp->GetEnabledPosition();
399 std::static_pointer_cast<ScriptedSyntheticChildren>(synth_current_sp);
402 return synth_chosen_sp;
409 if (
auto category_sp = entry.second->GetCategory()) {
410 if (!callback(category_sp))
418 if (category_name.empty())
428 this, category_name.str()));
433 switch (vector_format) {
463 if (target_sp && !target_sp->GetDebugger().GetAutoOneLineSummaries())
470 const size_t max_num_children =
472 .GetMaximumNumberOfChildrenToDisplay();
475 llvm::consumeError(num_children.takeError());
479 if (*num_children == 0)
496 size_t total_children_name_len = 0;
498 for (
size_t idx = 0; idx < *num_children; idx++) {
499 bool is_synth_val =
false;
506 CompilerType child_compiler_type(child_sp->GetCompilerType());
507 if (child_compiler_type.
IsValid()) {
521 if (child_sp->GetSyntheticChildren().get() !=
nullptr) {
527 if (!synth_sp->MightHaveChildren() &&
528 synth_sp->DoesProvideSyntheticValue())
531 else if (synth_sp->MightHaveChildren())
535 total_children_name_len += child_sp->GetName().GetLength();
540 if (total_children_name_len > 50)
544 if (child_sp->GetSummaryFormat()) {
546 if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
551 if (child_sp->HasChildren()) {
558 if (!child_sp->GetSummaryFormat() && !is_synth_val)
571 if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
572 if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
573 return valobj_sp->GetQualifiedTypeName();
575 return llvm::StringRef();
578std::vector<lldb::LanguageType>
593 llvm_unreachable(
"Fully covered switch");
602 return iter->second.get();
606 return lang_category;
609template <
typename ImplSP>
614 if (lang_category->GetHardcoded(*
this, match_data, retval_sp))
622template <
typename ImplSP>
const char *FormatterKind;
623template <>
const char *FormatterKind<lldb::TypeFormatImplSP> =
"format";
624template <>
const char *FormatterKind<lldb::TypeSummaryImplSP> =
"summary";
625template <>
const char *FormatterKind<lldb::SyntheticChildrenSP> =
"synthetic";
628#define FORMAT_LOG(Message) "[{0}] " Message, FormatterKind<ImplSP>
630template <
typename ImplSP>
643 if (lang_category->Get(match_data, retval_sp))
655template <
typename ImplSP>
660 if (!match_data_name.empty()) {
662 match_data_name.nonEmptyOr(
"<invalid>"));
674 if (!match_data_name.empty() && (!retval_sp || !retval_sp->NonCacheable())) {
676 static_cast<void *
>(retval_sp.get()),
677 match_data_name.nonEmptyOr(
"<invalid>"));
749 sys_category_sp->AddTypeSummary(R
"(^(unsigned )?char ?(\*|\[\])$)",
752 sys_category_sp->AddTypeSummary(R"(^((un)?signed )?char ?\[[0-9]+\]$)",
758 .SetSkipPointers(
true)
759 .SetSkipReferences(
true)
760 .SetDontShowChildren(
true)
761 .SetDontShowValue(
false)
762 .SetShowMembersOneLiner(
false)
763 .SetHideItemNames(
false),
790 AddStringSummary(vectors_category_sp,
"${var.uint128}",
"builtin_type_vec128",
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOG_VERBOSE(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
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
"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
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes 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)
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
CompilerType GetCompilerType()
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