<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69309>69309</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb] No pretty print for the coroutine frame type.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb,
coroutines
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hokein
</td>
</tr>
</table>
<pre>
The lldb doesn't seem to know about the coroutine frame type (the structure type [`<function_name>.coro_frame_ty`](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Coroutines/CoroFrame.cpp#L1134) emitting in the clang middle-end). See the poor print results below.
```
$ ./bin/clang++ -std=c++20 -g /tmp/t.cpp -o debugging-example
$ lldb debugging-example
...
(lldb) r
...
Process 1790445 stopped
* thread #1, name = 'debugging-examp', stop reason = signal SIGTRAP
frame #0: 0x00005555555555fc debugging-example`coro_task(v=1) at t.cpp:46:3
43 task coro_task(int v) {
44 int a = v;
45 __builtin_debugtrap();
-> 46 co_return;
47 }
48
49 int main() {
(lldb) p __coro_frame
(_Z9coro_taski.coro_frame_ty) {}
```
The gdb gives better results on printing the `__coro_frame`:
```
(gdb) p __coro_frame
$1 = {__resume_fn = 0x555555555bf0 <detail::chain_fn<0>()>, __destroy_fn = 0x555555555d90 <detail::chain_fn<0>()>, __promise = {continuation = {_M_fr_ptr = 0x555555574440}, result = 0},
struct_task__promise_type__FinalSuspend_0 = {struct_std____n4861__coroutine_handle_0 = {PointerType = 0x0}}, __coro_index = 0 '\000', struct_std____n4861__suspend_always_1 = {__int_8 = 0 '\000'}}
```
```
// tmp/t.cpp
#include <coroutine>
struct task{
struct promise_type {
task get_return_object() { return std::coroutine_handle<promise_type>::from_promise(*this); }
std::suspend_always initial_suspend() { return {}; }
std::suspend_always final_suspend() noexcept { return {}; }
void return_void() noexcept {}
void unhandled_exception() noexcept {}
int count = 0;
};
void resume() noexcept {
handle.resume();
}
task(std::coroutine_handle<promise_type> hdl) : handle(hdl) {}
~task() {
if (handle)
handle.destroy();
}
std::coroutine_handle<> handle;
};
task coro_task(int v) {
int a = v;
__builtin_debugtrap();
co_return;
}
int main() {
auto k = coro_task(1);
k.resume();
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUV09v4ygU_zTk8hQLgxPHhxzSpFmttLsa7fS0F4Rt7LC1wQLcaS_72VdgO3HStDMdjdwCj9_7vb-8cmtlrYTYotUDWh0WvHcnbbYn_SykWuS6fNs-nQQ0TZlDqYVViKQOrBAtOA3PSv8AnuvegTsJKLTRvZNKQGV4K8C9dQIQ2fgz60xfuN5Mu6sHtMaI7qteFU5qxRRvBaKPkQdh4T5zb15mdUBkc3Kus4juEDkicqylO_V5VOgWkWPTvEw_lp3R_4rCIXLMG50jcmy5VDMZ6feeDFe20qa1iBz3E-dpcfSqo6LrEKF_xDFNEMlAtNI5qWqQarC04aqGVpZlI5ZClYhkEXwXIhx2WhvojFQOjLB94yzkotE_IoQPCO_G7xqP_4clSSDytAPdAI_IAyIPsLSuRPRQDEuCYVkDIkfXdv7ricJSQynyvq6lqpfilbddI-CCOwTvA4EommiRjRf01pqbo29GF8JaiNMMJ8kKrNNdJ8rp3g7cyQheAiI0RmQPPpSA6AEQSW_0IpJ6CY8ARnCrVRD0Scgb-P77b09_774NwAAw5hEiFCO6A_yKMcar87-qeG8WWuOQQY7bZ0Q2L4geYm8TdxCcheguWSO6o2clCfWavDzMb_rwvfibKH24yCZeFvwZD8RfEJ2drsIpY3kvGycVC-yc4R0iG0Sys-wS0UdI1lBoZoTrjbpCSQEApYfLxgbgsshG_UNmb64YzmLYAWOXUjofs3-ys5HyptZIBgFqUn2bouHru0Fd5lDLF-Hz2jlhzmmu1ZD3vlJ8JaA1vmLhK373aRVs6s_oJ_GQVukDY15nK1g1JBB-PWdFXmFAdF8Kx2Xj9dFdceJSsUohuseIPk7RePSpyFgprDP67Q5UmX0RqjO6lVZMLAvt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