[PATCH] D96938: [RFC] [Coroutine] [Debug] Insert dbg.declare to entry.resume to print alloca in the coroutine frame under O2

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 23:27:13 PST 2021


ChuanqiXu created this revision.
ChuanqiXu added reviewers: aprantl, bruno, dongAxis1944, junparser, lxfind.
Herald added a subscriber: hiraditya.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Try to insert dbg.declare to `entry.resume` basic block in resume function. In this way, we could print `alloca` such as `__promise` in gdb/lldb under O2 <https://reviews.llvm.org/owners/package/2/>, which would be beneficial to debug coroutine program.

I am not sure whether this change is correct. I only test it by C++ programs locally. I would update the test case if needed. It could print `__promise` in all of the C++ coroutines I tested.

By the way, I think it is very beneficial to print the coroutine frame by keywords like `__coro_frame`. But I find it seems a little hard to implement.

Test-Plan: check-llvm


https://reviews.llvm.org/D96938

Files:
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
  llvm/test/Transforms/Coroutines/coro-debug.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96938.324535.patch
Type: text/x-patch
Size: 7005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/6770f320/attachment.bin>


More information about the llvm-commits mailing list