[PATCH] D127623: [Debug] [Coroutine] Adjust the scope and name for coroutine frame
Pedro Alves via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 17 08:22:02 PDT 2022
palves added a comment.
In D127623#3591462 <https://reviews.llvm.org/D127623#3591462>, @ChuanqiXu wrote:
> In D127623#3591432 <https://reviews.llvm.org/D127623#3591432>, @avogelsgesang wrote:
>
>> Can we somehow achieve that for the source code
>>
>> std::lazy<int> my_coro_task_function(int x) {
>> while (--x) {
>> co_await do_something();
>> }
>> co_return;
>> }
>>
>> I can use
>>
>> (gdb) # 0x418eb0 is the address of a coroutine frame
>> (gdb )p (my_coro_task_function::__coro_frame_ty)*0x418eb0
>>
>> in the debugger?
>>
>> As a user of clang/gdb, I do not want to deal with linkage names at all.
>> I would prefer if I could use the non-mangled function name and simply append `::__coro_frame_ty` to it.
>> In my mental model, the coroutine frame type is a coroutine-function-local type. As such, writing it as a type nested inside the function scope feels pretty natural to me...
>
> We must not be able to achieve it due to the overloading problem. Long story short, the syntax above is ambiguous if there is another coroutine function with signature ` my_coro_task_function(double x)`.
I don't see where the problem is. This seems very much the same as printing a local static variable, when you have overloads. E.g., with:
int func (int)
{
static int local = 1;
return local;
}
int func (long)
{
static int local = 2;
return local;
}
int main () {}
You can disambiguate (again) with single quotes. Vis:
(gdb) p 'func(int)'::local
$1 = 1
(gdb) p 'func(long)'::local
$2 = 2
(gdb)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127623/new/
https://reviews.llvm.org/D127623
More information about the llvm-commits
mailing list