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());
250 llvm::StringRef class_name_ref(class_name.
GetStringRef());
252 static constexpr llvm::StringLiteral g_SetI(
"__NSSetI");
253 static constexpr llvm::StringLiteral g_OrderedSetI(
"__NSOrderedSetI");
254 static constexpr llvm::StringLiteral g_SetM(
"__NSSetM");
255 static constexpr llvm::StringLiteral g_SetCF(
"__NSCFSet");
256 static constexpr llvm::StringLiteral g_SetCFRef(
"CFSetRef");
258 if (class_name_ref.empty())
261 if (class_name_ref == g_SetI || class_name_ref == g_OrderedSetI) {
263 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
267 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
268 }
else if (class_name_ref == g_SetM) {
270 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
275 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
277 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
281 }
else if (class_name_ref == g_SetCF || class_name_ref == g_SetCFRef) {
284 if (!cfbh.
Update(valobj_addr, exe_ctx))
289 auto iter = map.find(class_name), end = map.end();
291 return iter->second(valobj, stream, options);
296 llvm::StringRef prefix, suffix;
298 std::tie(prefix, suffix) = language->GetFormatterPrefixSuffix(g_TypeHint);
301 stream.
Printf(
"%" PRIu64
" %s%s", value,
"element", value == 1 ?
"" :
"s");
317 Flags flags(valobj_type.GetTypeInfo());
319 if (flags.IsClear(eTypeIsPointer)) {
321 valobj_sp = valobj_sp->AddressOf(
error);
322 if (
error.Fail() || !valobj_sp)
329 if (!descriptor || !descriptor->IsValid())
332 ConstString class_name = descriptor->GetClassName();
333 llvm::StringRef class_name_ref(class_name.
GetStringRef());
335 static constexpr llvm::StringLiteral g_SetI(
"__NSSetI");
336 static constexpr llvm::StringLiteral g_OrderedSetI(
"__NSOrderedSetI");
337 static constexpr llvm::StringLiteral g_SetM(
"__NSSetM");
338 static constexpr llvm::StringLiteral g_SetCF(
"__NSCFSet");
339 static constexpr llvm::StringLiteral g_SetCFRef(
"CFSetRef");
341 if (class_name_ref.empty())
344 if (class_name_ref == g_SetI || class_name_ref == g_OrderedSetI) {
346 }
else if (class_name_ref == g_SetM) {
347 AppleObjCRuntime *apple_runtime =
348 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
359 }
else if (class_name_ref == g_SetCF || class_name_ref == g_SetCFRef) {
360 return (
new NSCFSetSyntheticFrontEnd(valobj_sp));
363 auto iter = map.find(class_name), end = map.end();
365 return iter->second(synth, valobj_sp);
384llvm::Expected<uint32_t>
406 m_ptr_size = process_sp->GetAddressByteSize();
407 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
429 if (idx >= num_children)
441 uint32_t test_idx = 0;
443 while (tries < num_children) {
448 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
469 auto ptr_size = process_sp->GetAddressByteSize();
475 *
reinterpret_cast<uint32_t *
>(buffer.
GetBytes()) =
476 static_cast<uint32_t
>(set_item.
item_ptr);
479 *
reinterpret_cast<uint64_t *
>(buffer.
GetBytes()) =
480 static_cast<uint64_t
>(set_item.
item_ptr);
483 lldbassert(
false &&
"pointer size is not 4 nor 8");
486 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
489 process_sp->GetByteOrder(),
490 process_sp->GetAddressByteSize());
494 m_backend.GetCompilerType().GetBasicTypeFromAST(
505llvm::Expected<uint32_t>
524 m_ptr_size = process_sp->GetAddressByteSize();
525 m_order = process_sp->GetByteOrder();
538 if (idx >= num_children)
550 uint32_t test_idx = 0;
556 while (tries < num_children) {
557 val_at_idx = m_values_ptr + (test_idx *
m_ptr_size);
559 val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx,
error);
587 *
reinterpret_cast<uint32_t *
>(buffer_sp->GetBytes()) =
588 static_cast<uint32_t
>(set_item.
item_ptr);
591 *
reinterpret_cast<uint64_t *
>(buffer_sp->GetBytes()) =
592 static_cast<uint64_t
>(set_item.
item_ptr);
595 lldbassert(
false &&
"pointer size is not 4 nor 8");
598 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
604 m_backend.GetCompilerType().GetBasicTypeFromAST(
611template <
typename D32,
typename D64>
620template <
typename D32,
typename D64>
629template <
typename D32,
typename D64>
630llvm::Expected<uint32_t>
638template <
typename D32,
typename D64>
656 m_ptr_size = process_sp->GetAddressByteSize();
657 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
661 process_sp->ReadMemory(data_location,
m_data_32,
sizeof(D32),
665 process_sp->ReadMemory(data_location,
m_data_64,
sizeof(D64),
672template <
typename D32,
typename D64>
681 if (idx >= num_children)
693 uint32_t test_idx = 0;
695 while (tries < num_children) {
696 obj_at_idx = m_objs_addr + (test_idx *
m_ptr_size);
700 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
721 auto ptr_size = process_sp->GetAddressByteSize();
733 assert(
false &&
"pointer size is not 4 nor 8 - get out of here ASAP");
736 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
739 process_sp->GetByteOrder(),
740 process_sp->GetAddressByteSize());
744 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.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
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