25 if (valobj_sp->GetNumChildrenIgnoringErrors() != 1)
30 if (!ptr_sp->GetCompilerType().IsPointerType())
33 auto [frame_ptr_addr, addr_type] = ptr_sp->GetPointerValue();
40 return frame_ptr_addr;
46 auto ptr_size = process_sp->GetAddressByteSize();
49 auto destroy_func_ptr_addr = frame_ptr_addr + ptr_size;
51 process_sp->ReadPointerFromMemory(destroy_func_ptr_addr,
error);
56 if (!target_sp->ResolveLoadAddress(destroy_func_addr, destroy_func_address))
72 auto var = variable_list->FindVariable(var_name);
75 if (!var->IsArtificial())
78 Type *promise_type = var->GetType();
91 if (frame_ptr_addr == 0) {
94 stream.
Printf(
"coro frame = 0x%" PRIx64, frame_ptr_addr);
133 auto &exe_ctx =
m_backend.GetExecutionContextRef();
135 auto ptr_size = process_sp->GetAddressByteSize();
136 auto ast_ctx = valobj_sp->GetCompilerType().GetTypeSystem<
TypeSystemClang>();
148 promise_type = std::move(template_arg);
154 promise_type = inferred_type;
160 if (!coro_frame_type)
161 coro_frame_type = void_type;
164 std::array<CompilerType, 1> args{coro_frame_type};
165 CompilerType coro_func_type = ast_ctx->CreateFunctionType(
170 "resume", frame_ptr_addr + 0 * ptr_size, exe_ctx, coro_func_ptr_type);
171 assert(resume_ptr_sp);
172 m_children.push_back(std::move(resume_ptr_sp));
174 "destroy", frame_ptr_addr + 1 * ptr_size, exe_ctx, coro_func_ptr_type);
175 assert(destroy_ptr_sp);
176 m_children.push_back(std::move(destroy_ptr_sp));
185 "promise", frame_ptr_addr + 2 * ptr_size, exe_ctx,
187 m_children.push_back(std::move(promise_ptr_sp));
189 "coro_frame", frame_ptr_addr, exe_ctx, coro_frame_type.
GetPointerType(),
191 m_children.push_back(std::move(coroframe_ptr_sp));
196llvm::Expected<size_t>
199 for (
const auto &[idx, child_sp] : llvm::enumerate(
m_children)) {
200 if (child_sp->GetName() == name)
204 return llvm::createStringError(
"Type has no child named '%s'",
static llvm::raw_ostream & error(Stream &strm)
static CompilerType InferArtificialCoroType(Function *destroy_func, ConstString var_name)
static Function * ExtractDestroyFunction(lldb::TargetSP target_sp, lldb::addr_t frame_ptr_addr)
static lldb::addr_t GetCoroFramePtrFromHandle(ValueObjectSP valobj_sp)
A section + offset based address class.
Function * CalculateSymbolContextFunction() const
A class that describes a single lexical block.
lldb::VariableListSP GetBlockVariableList(bool can_create)
Get the variable list for this block only.
Generic representation of a type in a programming language.
CompilerType GetTypeTemplateArgument(size_t idx, bool expand_pack=false) const
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
A class that describes a function.
Block & GetBlock(bool can_create)
Get accessor for the block list.
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.
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type, bool do_deref=true)
A TypeSystem implementation based on Clang.
CompilerType GetForwardCompilerType()
virtual lldb::ValueObjectSP GetNonSyntheticValue()
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
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
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Target > TargetSP