27std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
29 static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
33std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
35 static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>
104template <
typename D32,
typename D64>
151 struct DataDescriptor_32 {
158 struct DataDescriptor_64 {
170 struct DataDescriptor_32 {
179 struct DataDescriptor_64 {
191 template <
typename DD>
197 DD descriptor = DD();
198 process.
ReadMemory(start_of_descriptor, &descriptor,
sizeof(descriptor),
203 return descriptor._used;
219template <
bool cf_style>
222 static constexpr llvm::StringLiteral g_TypeHint(
"NSSet");
236 if (!descriptor || !descriptor->IsValid())
239 uint32_t ptr_size = process_sp->GetAddressByteSize();
240 bool is_64bit = (ptr_size == 8);
249 ConstString class_name(descriptor->GetClassName());
252 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
260 if (class_name == g_SetI || class_name == g_OrderedSetI) {
262 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
266 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
267 }
else if (class_name == g_SetM) {
269 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
274 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
276 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
280 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
283 if (!cfbh.
Update(valobj_addr, exe_ctx))
288 auto iter = map.find(class_name), end = map.end();
290 return iter->second(valobj, stream, options);
295 llvm::StringRef prefix, suffix;
297 std::tie(prefix, suffix) = language->GetFormatterPrefixSuffix(g_TypeHint);
300 stream.
Printf(
"%" PRIu64
" %s%s", value,
"element", value == 1 ?
"" :
"s");
316 Flags flags(valobj_type.GetTypeInfo());
318 if (flags.IsClear(eTypeIsPointer)) {
320 valobj_sp = valobj_sp->AddressOf(
error);
321 if (
error.Fail() || !valobj_sp)
328 if (!descriptor || !descriptor->IsValid())
331 ConstString class_name = descriptor->GetClassName();
334 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
342 if (class_name == g_SetI || class_name == g_OrderedSetI) {
344 }
else if (class_name == g_SetM) {
345 AppleObjCRuntime *apple_runtime =
346 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
357 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
358 return (
new NSCFSetSyntheticFrontEnd(valobj_sp));
361 auto iter = map.find(class_name), end = map.end();
363 return iter->second(synth, valobj_sp);
382llvm::Expected<uint32_t>
404 m_ptr_size = process_sp->GetAddressByteSize();
405 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
427 if (idx >= num_children)
439 uint32_t test_idx = 0;
441 while (tries < num_children) {
446 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
467 auto ptr_size = process_sp->GetAddressByteSize();
473 *
reinterpret_cast<uint32_t *
>(buffer.
GetBytes()) =
474 static_cast<uint32_t
>(set_item.
item_ptr);
477 *
reinterpret_cast<uint64_t *
>(buffer.
GetBytes()) =
478 static_cast<uint64_t
>(set_item.
item_ptr);
481 lldbassert(
false &&
"pointer size is not 4 nor 8");
484 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
487 process_sp->GetByteOrder(),
488 process_sp->GetAddressByteSize());
492 m_backend.GetCompilerType().GetBasicTypeFromAST(
503llvm::Expected<uint32_t>
522 m_ptr_size = process_sp->GetAddressByteSize();
523 m_order = process_sp->GetByteOrder();
536 if (idx >= num_children)
548 uint32_t test_idx = 0;
554 while (tries < num_children) {
555 val_at_idx = m_values_ptr + (test_idx *
m_ptr_size);
557 val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx,
error);
585 *
reinterpret_cast<uint32_t *
>(buffer_sp->GetBytes()) =
586 static_cast<uint32_t
>(set_item.
item_ptr);
589 *
reinterpret_cast<uint64_t *
>(buffer_sp->GetBytes()) =
590 static_cast<uint64_t
>(set_item.
item_ptr);
593 lldbassert(
false &&
"pointer size is not 4 nor 8");
596 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
602 m_backend.GetCompilerType().GetBasicTypeFromAST(
609template <
typename D32,
typename D64>
618template <
typename D32,
typename D64>
627template <
typename D32,
typename D64>
628llvm::Expected<uint32_t>
636template <
typename D32,
typename D64>
654 m_ptr_size = process_sp->GetAddressByteSize();
655 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
659 process_sp->ReadMemory(data_location,
m_data_32,
sizeof(D32),
663 process_sp->ReadMemory(data_location,
m_data_64,
sizeof(D64),
670template <
typename D32,
typename D64>
679 if (idx >= num_children)
691 uint32_t test_idx = 0;
693 while (tries < num_children) {
694 obj_at_idx = m_objs_addr + (test_idx *
m_ptr_size);
698 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
719 auto ptr_size = process_sp->GetAddressByteSize();
731 assert(
false &&
"pointer size is not 4 nor 8 - get out of here ASAP");
734 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
737 process_sp->GetByteOrder(),
738 process_sp->GetAddressByteSize());
742 m_backend.GetCompilerType().GetBasicTypeFromAST(
static llvm::raw_ostream & error(Stream &strm)
static std::optional< size_t > CalculateNumChildren(CompilerType container_elem_type, uint64_t num_elements, CompilerType element_type)
Calculates the number of elements stored in a container (with element type 'container_elem_type') as ...
uint32_t GetFoundationVersion()
bool Update(lldb::addr_t addr, ExecutionContextRef exe_ctx_rf)
Generic representation of a type in a programming language.
A uniqued constant string class.
bool IsEmpty() const
Test for empty string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
Execution context objects refer to objects in the execution of the program that is being debugged.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static Language * FindPlugin(lldb::LanguageType language)
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
static ObjCLanguageRuntime * Get(Process &process)
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
uint32_t GetAddressByteSize() const
llvm::StringRef GetString() const
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.
uint32_t CalculateNumChildrenIgnoringErrors(uint32_t max=UINT32_MAX)
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ValueObjectSP CreateChildValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
lldb::LanguageType GetLanguage() const
lldb::ProcessSP GetProcessSP() const
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
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
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP