[all-commits] [llvm/llvm-project] aa85b4: [Coroutines] Use dbg.declare for frame variables

Brian Gesiak via All-commits all-commits at lists.llvm.org
Tue Mar 3 14:13:53 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: aa85b437a970a12b74a8793cbd98dbb2f95afb6d
      https://github.com/llvm/llvm-project/commit/aa85b437a970a12b74a8793cbd98dbb2f95afb6d
  Author: Brian Gesiak <modocache at gmail.com>
  Date:   2020-03-03 (Tue, 03 Mar 2020)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Local.h
    M llvm/lib/Transforms/Coroutines/CoroFrame.cpp
    M llvm/lib/Transforms/Utils/Local.cpp
    A llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
    M llvm/test/Transforms/Coroutines/coro-debug.ll

  Log Message:
  -----------
  [Coroutines] Use dbg.declare for frame variables

Summary:
https://gist.github.com/modocache/ed7c62f6e570766c0f39b35dad675c2f
is an example of a small C++ program that uses C++20 coroutines that
is difficult to debug, due to the loss of debug info for variables that
"spill" across coroutine suspension boundaries. This patch addresses
that issue by inserting 'llvm.dbg.declare' intrinsics that point the
debugger to the variables' location at an offset to the coroutine frame.

With this patch, I confirmed that running the 'frame variable' commands in
https://gist.github.com/modocache/ed7c62f6e570766c0f39b35dad675c2f at
the specified breakpoints results in the correct values being printed
for coroutine frame variables 'i' and 'j' when using an lldb built from
trunk, as well as with gdb 8.3 (lldb 9.0.1, however, could not print the
values). The added test case also verifies this improved behavior.

The existing coro-debug.ll test case is also modified to reflect the
locations at which Clang actually places calls to 'dbg.declare', and
additional checks are added to ensure this patch works as intended in that
example as well.

Reviewers: vsk, jmorse, GorNishanov, lewissbaker, wenlei

Subscribers: EricWF, aprantl, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75338




More information about the All-commits mailing list