89LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd(
97bool LibstdcppMapIteratorSyntheticFrontEnd::Update() {
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;
135size_t LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren() {
140LibstdcppMapIteratorSyntheticFrontEnd::GetChildAtIndex(
size_t idx) {
141 if (m_pair_address != 0 && m_pair_type) {
143 m_pair_sp = CreateValueObjectFromAddress(
"pair", m_pair_address,
144 m_exe_ctx_ref, m_pair_type);
146 return m_pair_sp->GetChildAtIndex(idx);
151bool LibstdcppMapIteratorSyntheticFrontEnd::MightHaveChildren() {
return true; }
153size_t LibstdcppMapIteratorSyntheticFrontEnd::GetIndexOfChildWithName(
157 if (name ==
"second")
165 return (valobj_sp ?
new LibstdcppMapIteratorSyntheticFrontEnd(valobj_sp)
189 llvm::ArrayRef<ConstString> item_names)
191 m_item_names(item_names), m_item_sp() {
210 if (item_ptr->GetValueAsUnsigned(0) == 0)
216 item_ptr->GetCompilerType().GetPointeeType());
242 const bool scalar_is_load_addr =
true;
248 if (pointee_sp &&
error.Success())
249 addr_of_string = pointee_sp->GetAddressOf(scalar_is_load_addr, &addr_type);
263 process_sp->ReadPointerFromMemory(addr_of_string,
error);
264 if (
error.Fail() || addr_of_data == 0 ||
272 lldb::addr_t size_of_data = process_sp->ReadPointerFromMemory(
273 addr_of_string + process_sp->GetAddressByteSize(),
error);
280 StringPrinter::StringElementType::UTF8>(options)) {
281 stream.
Printf(
"Summary Unavailable");
298 const bool scalar_is_load_addr =
true;
312 if (!wchar_compiler_type)
316 std::optional<uint64_t> size = wchar_compiler_type.
GetBitSize(
nullptr);
319 const uint32_t wchar_size = *size;
324 process_sp->ReadPointerFromMemory(addr_of_string,
error);
325 if (
error.Fail() || addr_of_data == 0 ||
333 lldb::addr_t size_of_data = process_sp->ReadPointerFromMemory(
334 addr_of_string + process_sp->GetAddressByteSize(),
error);
341 switch (wchar_size) {
344 StringPrinter::StringElementType::UTF8>(options);
347 StringPrinter::StringElementType::UTF16>(options);
350 StringPrinter::StringElementType::UTF32>(options);
352 stream.
Printf(
"size for wchar_t is not valid");
367LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(
374size_t LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() {
return 1; }
377LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(
size_t idx) {
379 return m_ptr_obj->GetSP();
381 if (m_ptr_obj && !m_obj_obj) {
385 m_obj_obj = obj_obj->Clone(
ConstString(
"object")).get();
388 return m_obj_obj->GetSP();
393bool LibStdcppSharedPtrSyntheticFrontEnd::Update() {
394 auto backend = m_backend.GetSP();
398 auto valobj_sp = backend->GetNonSyntheticValue();
402 auto ptr_obj_sp = valobj_sp->GetChildMemberWithName(
"_M_ptr");
406 m_ptr_obj = ptr_obj_sp->Clone(
ConstString(
"pointer")).get();
412bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() {
return true; }
414size_t LibStdcppSharedPtrSyntheticFrontEnd::GetIndexOfChildWithName(
416 if (name ==
"pointer")
418 if (name ==
"object" || name ==
"$$dereference$$")
426 return (valobj_sp ?
new LibStdcppSharedPtrSyntheticFrontEnd(valobj_sp)
436 ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName(
"_M_ptr"));
441 valobj_sp->GetChildAtNamePath({
"_M_refcount",
"_M_pi",
"_M_use_count"}));
445 if (ptr_sp->GetValueAsUnsigned(0) == 0 ||
446 usecount_sp->GetValueAsUnsigned(0) == 0) {
453 if (pointee_sp &&
error.Success()) {
454 if (pointee_sp->DumpPrintableRepresentation(
463 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 size_t CalculateNumChildren()=0
virtual bool MightHaveChildren()=0
virtual size_t GetIndexOfChildWithName(ConstString name)=0
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx)=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.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Target > TargetSP