[PATCH] D93497: Salvage debug info for function arguments in coro-split funclets.
Chuanqi Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 17 23:34:11 PST 2021
ChuanqiXu added a comment.
In D93497#2560170 <https://reviews.llvm.org/D93497#2560170>, @aprantl wrote:
> 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.
Hi, thanks for the reply. Now I made it in https://reviews.llvm.org/D96938. I am not familiar with the debug info system. And my patch deletes the paragraph about `if (auto Arg = dyn_cast_or_null<llvm::Argument>(Storage))` since it aimed at O2 <https://reviews.llvm.org/owners/package/2/>. But I am really not sure about the correctness. In my local tests for C++ programs, this patch could print `alloca` under O2 <https://reviews.llvm.org/owners/package/2/>. But I am not sure if it would obstruct the debugbility about the parameter of coroutine. Do you have any suggestion?
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