21#include "llvm/ADT/STLExtras.h"
22#include "llvm/Support/Error.h"
23#include "llvm/Support/ErrorExtras.h"
46 return m_backend.GetIndexOfChildWithName(name);
66 if (
m_parent->GetCompilerType().IsCompleteType())
82 return m_parent->GetQualifiedTypeName();
89 return m_parent->GetDisplayTypeName();
92llvm::Expected<uint32_t>
103 "[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
104 "{0} and type {1}, the filter returned {2} child values",
109 if (!num_children_or_err) {
111 return num_children_or_err;
115 "[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
116 "{0} and type {1}, the filter returned {2} child values",
128 return m_parent->GetDynamicValue(valueType);
154 valobj_for_frontend = deref_sp.get();
168 if (!
m_parent->UpdateValueIfNeeded(
false)) {
181 "[ValueObjectSynthetic::UpdateValue] name={0}, type changed "
182 "from {1} to {2}, recomputing synthetic filter",
191 "[ValueObjectSynthetic::UpdateValue] name={0}, synthetic "
192 "filter said caches are stale - clearing",
204 m_flags.m_children_count_valid =
false;
213 "[ValueObjectSynthetic::UpdateValue] name={0}, synthetic "
214 "filter said caches are still valid",
222 if (synth_val && synth_val->CanProvideValue()) {
224 "[ValueObjectSynthetic::UpdateValue] name={0}, synthetic "
225 "filter said it can provide a value",
232 "[ValueObjectSynthetic::UpdateValue] name={0}, synthetic "
233 "filter said it will not provide a value",
238 if (
m_parent->GetCompilerType().IsCompleteType())
251 "[ValueObjectSynthetic::GetChildAtIndex] name={0}, retrieving "
252 "child at index {1}",
258 bool child_is_cached;
264 valobj = cached_child_it->second;
267 if (!child_is_cached) {
270 "[ValueObjectSynthetic::GetChildAtIndex] name={0}, child at "
271 "index {1} not cached and will be created",
278 "[ValueObjectSynthetic::GetChildAtIndex] name={0}, child at index "
279 "{1} created as {2} (is "
281 GetName(), idx,
static_cast<void *
>(synth_guy.get()),
283 ? (synth_guy->IsSyntheticChildrenGenerated() ?
"yes" :
"no")
291 if (synth_guy->IsSyntheticChildrenGenerated())
295 synth_guy->SetPreferredDisplayLanguageIfNeeded(
300 "[ValueObjectSynthetic::GetChildAtIndex] name={0}, child at "
301 "index {1} not cached and cannot "
302 "be created (can_create = {2}, synth_filter = {3})",
303 GetName(), idx, can_create ?
"yes" :
"no",
310 "[ValueObjectSynthetic::GetChildAtIndex] name={0}, child at "
311 "index {1} cached as {2}",
312 GetName(), idx,
static_cast<void *
>(valobj));
314 return valobj->
GetSP();
326 llvm::consumeError(index_or_err.takeError());
333llvm::Expected<size_t>
339 std::optional<uint32_t> found_index = std::nullopt;
344 found_index = name_to_index->second;
348 size_t index = SIZE_MAX;
350 index = *index_or_err;
351 }
else if (!
m_synth_sp->CustomSubscripting()) {
356 return index_or_err.takeError();
359 llvm::consumeError(index_or_err.takeError());
360 index = *maybe_index;
363 uint32_t max = index + 1;
365 if (index >= num_children)
366 return llvm::createStringErrorV(
"subscript index out of range: {0}",
373 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
374 }
else if (found_index)
377 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
420 m_parent->SetPreferredDisplayLanguage(lang);
426 return m_parent->GetPreferredDisplayLanguage();
434 return m_parent->IsSyntheticChildrenGenerated();
440 m_parent->SetSyntheticChildrenGenerated(b);
446 return m_parent->GetDeclaration(decl);
453 return m_parent->GetLanguageFlags();
474 return raw_value->GetExpressionPath(stream, epformat);
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
llvm::Expected< uint32_t > CalculateNumChildren() override
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
Determine the index of a named child.
bool MightHaveChildren() override
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
DummySyntheticFrontEnd(ValueObject &backend)
Generic representation of a type in a programming language.
bool IsPointerOrReferenceType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
A class that describes the declaration location of a lldb object.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A stream class that can stream formatted output to a file.
SyntheticChildrenFrontEnd(ValueObject &backend)
virtual lldb::DynamicValueType GetDynamicValueType()
bool CanProvideValue() override
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx, bool can_create=true) override
bool SetValueFromCString(const char *value_str, Status &error) override
uint32_t m_synthetic_children_count
bool UpdateValue() override
lldb::ValueType GetValueType() const override
LazyBool m_provides_value
bool IsSyntheticChildrenGenerated() override
lldb::LanguageType GetPreferredDisplayLanguage() override
ConstString GetTypeName() override
bool IsSynthetic() override
void GetExpressionPath(Stream &stream, GetExpressionPathFormat epformat=eGetExpressionPathFormatDereferencePointers) override
void SetFormat(lldb::Format format) override
void CopyValueData(ValueObject *source)
NameToIndexMap m_name_toindex
Guarded by m_child_mutex;.
ByIndexMap m_children_byindex
Guarded by m_child_mutex;.
std::unique_ptr< SyntheticChildrenFrontEnd > m_synth_filter_up
lldb::SyntheticChildrenSP m_synth_sp
lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType) override
void SetSyntheticChildrenGenerated(bool b) override
void SetPreferredDisplayLanguage(lldb::LanguageType)
ConstString GetDisplayTypeName() override
~ValueObjectSynthetic() override
lldb::ValueObjectSP GetNonSyntheticValue() override
SyntheticChildrenCache m_synthetic_children_cache
Guarded by m_child_mutex;.
llvm::Expected< size_t > GetIndexOfChildWithName(llvm::StringRef name) override
ConstString m_parent_type_name
bool IsDynamic() override
bool GetDeclaration(Declaration &decl) override
bool MightHaveChildren() override
Find out if a ValueObject might have children.
virtual void CreateSynthFilter()
lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name, bool can_create=true) override
ConstString GetQualifiedTypeName() override
llvm::Expected< uint64_t > GetByteSize() override
uint64_t GetLanguageFlags() override
LazyBool m_might_have_children
ValueObjectSynthetic(ValueObject &parent, lldb::SyntheticChildrenSP filter)
CompilerType GetCompilerTypeImpl() override
void SetLanguageFlags(uint64_t flags) override
bool IsInScope() override
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
void SetValueIsValid(bool valid)
void ClearUserVisibleData(uint32_t items=ValueObject::eClearUserVisibleDataItemsAllStrings)
void SetPreferredDisplayLanguage(lldb::LanguageType lt)
struct lldb_private::ValueObject::Bitflags m_flags
lldb::ValueObjectSP GetSP()
virtual void SetLanguageFlags(uint64_t flags)
Status m_error
An error object that can describe any errors that occur when updating values.
virtual uint64_t GetLanguageFlags()
virtual void SetSyntheticChildrenGenerated(bool b)
DataExtractor m_data
A data extractor that can be used to extract the value.
virtual void GetExpressionPath(Stream &s, GetExpressionPathFormat=eGetExpressionPathFormatDereferencePointers)
@ eClearUserVisibleDataItemsAll
virtual lldb::ModuleSP GetModule()
Return the module associated with this value object in case the value is from an executable file and ...
lldb::LanguageType m_preferred_display_language
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
virtual bool GetDeclaration(Declaration &decl)
bool UpdateValueIfNeeded(bool update_format=true)
void SetName(ConstString name)
Change the name of the current ValueObject.
ConstString GetName() const
virtual void SetFormat(lldb::Format format)
const ExecutionContextRef & GetExecutionContextRef() const
uint32_t GetNumChildrenIgnoringErrors(uint32_t max=UINT32_MAX)
Like GetNumChildren but returns 0 on error.
const Value & GetValue() 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.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
@ eValueTypeRegister
stack frame register value
@ eValueTypeRegisterSet
A collection of stack frame register values.