[PATCH] D93497: Salvage debug info for function arguments in coro-split funclets.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 09:02:37 PST 2021


aprantl added a comment.

In D93497#2541578 <https://reviews.llvm.org/D93497#2541578>, @ChuanqiXu wrote:

> Hi all, I want to ask some question about the debug information in coroutine. I wonder this patch may be a suitable place.
> I know this patch intentionally to solve problems under O0. 
> And  I want to enable the ability to debug coroutine program with optimization.
> Now I create following instruction with '-O2 -emit-llvm':
>
>   %local.reload.addr = getelementptr %FramePtrTy, %FramePtrTy %Frame, ...
>   call void @llvm.dbg.declare(metadata %"struct_type"* %a.reload.addr, metadata !1, metadata !DIExpression()), !dbg !2
>   ; ...
>   !1 = !DILocalVariable(name: "a", ... );
>
> But I find I can't print the value of a in debugger. To my understanding, `%a.reload.addr` marks the address of `a`. So gdb should know the address of `a` and print its value.
> What's going wrong?

Does that dbg.declare actually make it into DWARF? If you run llvm-dwarfdump on the resulting binary, does the variable have a `DW_AT_location` attribute? If not, some pass in LLVM is dropping the info — which happens a lot in optimized code. I would recommend dumping the output of `clang -mllvm -print-after-all` into a file and searching for the place the debug info disappears.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93497/new/

https://reviews.llvm.org/D93497



More information about the llvm-commits mailing list