89LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd(
102 TargetSP target_sp(valobj_sp->GetTargetSP());
107 bool is_64bit = (target_sp->GetArchitecture().GetAddressByteSize() == 8);
111 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
113 ValueObjectSP _M_node_sp(valobj_sp->GetChildMemberWithName(
"_M_node"));
117 m_pair_address = _M_node_sp->GetValueAsUnsigned(0);
118 if (m_pair_address == 0)
121 m_pair_address += (is_64bit ? 32 : 16);
124 if (my_type.GetNumTemplateArguments() >= 1) {
128 m_pair_type = pair_type;
135llvm::Expected<uint32_t>
136LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
141LibstdcppMapIteratorSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
142 if (m_pair_address != 0 && m_pair_type) {
144 m_pair_sp = CreateValueObjectFromAddress(
"pair", m_pair_address,
145 m_exe_ctx_ref, m_pair_type);
147 return m_pair_sp->GetChildAtIndex(idx);
152bool LibstdcppMapIteratorSyntheticFrontEnd::MightHaveChildren() {
return true; }
154size_t LibstdcppMapIteratorSyntheticFrontEnd::GetIndexOfChildWithName(
158 if (name ==
"second")
166 return (valobj_sp ?
new LibstdcppMapIteratorSyntheticFrontEnd(valobj_sp)
190 llvm::ArrayRef<ConstString> item_names)
192 m_item_names(item_names), m_item_sp() {
211 if (item_ptr->GetValueAsUnsigned(0) == 0)
217 item_ptr->GetCompilerType().GetPointeeType());
223llvm::Expected<uint32_t>
246 const bool scalar_is_load_addr =
true;
252 if (pointee_sp &&
error.Success())
253 addr_of_string = pointee_sp->GetAddressOf(scalar_is_load_addr, &addr_type);
267 process_sp->ReadPointerFromMemory(addr_of_string,
error);
268 if (
error.Fail() || addr_of_data == 0 ||
276 lldb::addr_t size_of_data = process_sp->ReadPointerFromMemory(
277 addr_of_string + process_sp->GetAddressByteSize(),
error);
284 StringPrinter::StringElementType::UTF8>(options)) {
285 stream.
Printf(
"Summary Unavailable");
302 const bool scalar_is_load_addr =
true;
316 if (!wchar_compiler_type)
320 std::optional<uint64_t> size = wchar_compiler_type.
GetBitSize(
nullptr);
323 const uint32_t wchar_size = *size;
328 process_sp->ReadPointerFromMemory(addr_of_string,
error);
329 if (
error.Fail() || addr_of_data == 0 ||
337 lldb::addr_t size_of_data = process_sp->ReadPointerFromMemory(
338 addr_of_string + process_sp->GetAddressByteSize(),
error);
345 switch (wchar_size) {
348 StringPrinter::StringElementType::UTF8>(options);
351 StringPrinter::StringElementType::UTF16>(options);
354 StringPrinter::StringElementType::UTF32>(options);
356 stream.
Printf(
"size for wchar_t is not valid");
371LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(
378llvm::Expected<uint32_t>
379LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
384LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
386 return m_ptr_obj->GetSP();
388 if (m_ptr_obj && !m_obj_obj) {
392 m_obj_obj = obj_obj->Clone(
ConstString(
"object")).get();
395 return m_obj_obj->GetSP();
401 auto backend = m_backend.GetSP();
405 auto valobj_sp = backend->GetNonSyntheticValue();
409 auto ptr_obj_sp = valobj_sp->GetChildMemberWithName(
"_M_ptr");
413 m_ptr_obj = ptr_obj_sp->Clone(
ConstString(
"pointer")).get();
419bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() {
return true; }
421size_t LibStdcppSharedPtrSyntheticFrontEnd::GetIndexOfChildWithName(
423 if (name ==
"pointer")
425 if (name ==
"object" || name ==
"$$dereference$$")
433 return (valobj_sp ?
new LibStdcppSharedPtrSyntheticFrontEnd(valobj_sp)
443 ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName(
"_M_ptr"));
448 valobj_sp->GetChildAtNamePath({
"_M_refcount",
"_M_pi",
"_M_use_count"}));
452 if (ptr_sp->GetValueAsUnsigned(0) == 0 ||
453 usecount_sp->GetValueAsUnsigned(0) == 0) {
460 if (pointee_sp &&
error.Success()) {
461 if (pointee_sp->DumpPrintableRepresentation(
470 stream.
Printf(
"ptr = 0x%" PRIx64, ptr_sp->GetValueAsUnsigned(0));
static llvm::raw_ostream & error(Stream &strm)
Generic representation of a type in a programming language.
CompilerType GetTypeTemplateArgument(size_t idx, bool expand_pack=false) const
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
std::optional< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
A uniqued constant string class.
Execution context objects refer to objects in the execution of the program that is being debugged.
bool Fail() const
Test for error condition.
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx)=0
virtual lldb::ChildCacheState Update()=0
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
virtual bool MightHaveChildren()=0
virtual size_t GetIndexOfChildWithName(ConstString name)=0
virtual llvm::Expected< uint32_t > CalculateNumChildren()=0
lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type)
CompilerType GetCompilerType()
lldb::ValueObjectSP GetSP()
lldb::ProcessSP GetProcessSP() const
virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr)
lldb::TargetSP GetTargetSP() const
virtual lldb::ValueObjectSP Dereference(Status &error)
virtual lldb::ValueObjectSP GetNonSyntheticValue()
@ eValueObjectRepresentationStyleSummary
bool IsPointerOrReferenceType()
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
@ eAddressTypeHost
Address is an address in the process that is running this code.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
@ eReuse
Children did not change and don't need to be recomputed; re-use what we computed the last time we cal...
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Target > TargetSP