25 if (valobj_sp->GetNumChildren() != 1)
27 ValueObjectSP ptr_sp(valobj_sp->GetChildAtIndex(0,
true));
30 if (!ptr_sp->GetCompilerType().IsPointerType())
34 lldb::addr_t frame_ptr_addr = ptr_sp->GetPointerValue(&addr_type);
37 lldbassert(addr_type == AddressType::eAddressTypeLoad);
38 if (addr_type != AddressType::eAddressTypeLoad)
41 return frame_ptr_addr;
46 lldb::ProcessSP process_sp = target_sp->GetProcessSP();
47 auto ptr_size = process_sp->GetAddressByteSize();
50 auto destroy_func_ptr_addr = frame_ptr_addr + ptr_size;
52 process_sp->ReadPointerFromMemory(destroy_func_ptr_addr,
error);
57 if (!target_sp->ResolveLoadAddress(destroy_func_addr, destroy_func_address))
69 auto promise_var = variable_list->FindVariable(
ConstString(
"__promise"));
72 if (!promise_var->IsArtificial())
75 Type *promise_type = promise_var->GetType();
88 if (frame_ptr_addr == 0) {
91 stream.
Printf(
"coro frame = 0x%" PRIx64, frame_ptr_addr);
109 if (!m_resume_ptr_sp || !m_destroy_ptr_sp)
112 return m_promise_ptr_sp ? 3 : 2;
119 return m_resume_ptr_sp;
121 return m_destroy_ptr_sp;
123 return m_promise_ptr_sp;
125 return lldb::ValueObjectSP();
130 m_resume_ptr_sp.reset();
131 m_destroy_ptr_sp.reset();
132 m_promise_ptr_sp.reset();
134 ValueObjectSP valobj_sp = m_backend.GetNonSyntheticValue();
142 auto ts = valobj_sp->GetCompilerType().GetTypeSystem();
148 lldb::TargetSP target_sp = m_backend.GetTargetSP();
149 auto &exe_ctx = m_backend.GetExecutionContextRef();
150 lldb::ProcessSP process_sp = target_sp->GetProcessSP();
151 auto ptr_size = process_sp->GetAddressByteSize();
153 CompilerType coro_func_type = ast_ctx->CreateFunctionType(
154 void_type, &void_type, 1,
157 m_resume_ptr_sp = CreateValueObjectFromAddress(
158 "resume", frame_ptr_addr + 0 * ptr_size, exe_ctx, coro_func_ptr_type);
160 m_destroy_ptr_sp = CreateValueObjectFromAddress(
161 "destroy", frame_ptr_addr + 1 * ptr_size, exe_ctx, coro_func_ptr_type);
166 valobj_sp->GetCompilerType().GetTypeTemplateArgument(0));
175 promise_type = inferred_type;
190 lldb::ValueObjectSP promise = CreateValueObjectFromAddress(
191 "promise", frame_ptr_addr + 2 * ptr_size, exe_ctx, promise_type);
193 lldb::ValueObjectSP promisePtr = promise->AddressOf(
error);
195 m_promise_ptr_sp = promisePtr->Clone(
ConstString(
"promise"));
static llvm::raw_ostream & error(Stream &strm)
static Function * ExtractDestroyFunction(lldb::TargetSP target_sp, lldb::addr_t frame_ptr_addr)
static lldb::addr_t GetCoroFramePtrFromHandle(ValueObjectSP valobj_sp)
static CompilerType InferPromiseType(Function &destroy_func)
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 GetPointerType() const
Return a new CompilerType that is a pointer to this type.
A uniqued constant string class.
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.
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.