This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Recognize `std::noop_coroutine()` in `std::coroutine_handle` pretty printer
AcceptedPublic

Authored by avogelsgesang on Aug 26 2022, 5:48 AM.

Details

Summary

With this commit, the std::coroutine_handle pretty printer now
recognizes std::noop_coroutine() handles. For noop coroutine handles,
we identify use the summary string noop_coroutine and we don't print
children

Instead of

(std::coroutine_handle<void>) $3 = coro frame = 0x555555559058 {
  resume = 0x00005555555564f0 (a.out`std::__1::coroutine_handle<std::__1::noop_coroutine_promise>::__noop_coroutine_frame_ty_::__dummy_resume_destroy_func() at noop_coroutine_handle.h:79)
  destroy = 0x00005555555564f0 (a.out`std::__1::coroutine_handle<std::__1::noop_coroutine_promise>::__noop_coroutine_frame_ty_::__dummy_resume_destroy_func() at noop_coroutine_handle.h:79)
}

we now print

(std::coroutine_handle<void>) $3 = noop_coroutine

Diff Detail

Event Timeline

avogelsgesang created this revision.Aug 26 2022, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2022, 5:48 AM
avogelsgesang requested review of this revision.Aug 26 2022, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2022, 5:48 AM

Exclude unsupported compilers from test case

fix test case

The summary looks good to me.

lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
83

Maybe IsNoopCoro or something else looks better?

avogelsgesang marked an inline comment as done.

rename IsNoopResumeDestroy -> IsNoopCoroFunction

aprantl accepted this revision.Sep 22 2022, 3:15 PM
This revision is now accepted and ready to land.Sep 22 2022, 3:15 PM
This revision was landed with ongoing or failed builds.Nov 20 2022, 11:19 AM
This revision was automatically updated to reflect the committed changes.

As discussed via email, the reason for the test failures on green dragon is, that green dragon seems to be using some compiler which passes the test

if not (is_clang and self.expectedCompilerVersion(["<", "16"])):

but does not actually provide the expected debug informations. @jasonmolenda Do you know which exact compiler is used on green-dragon?

As discussed via email, the reason for the test failures on green dragon is, that green dragon seems to be using some compiler which passes the test

if not (is_clang and self.expectedCompilerVersion(["<", "16"])):

but does not actually provide the expected debug informations. @jasonmolenda Do you know which exact compiler is used on green-dragon?

The lldb incremental bot uses the last good build from the https://green.lab.llvm.org/green/job/clang-stage1-RA/ bot as the clang compiler.

avogelsgesang reopened this revision.Dec 17 2022, 4:26 AM
This revision is now accepted and ready to land.Dec 17 2022, 4:26 AM

I reapplied this patch locally on top of the latest main and tried to reproduce the issue on my Mac using

cmake -B build -G Ninja -C lldb/cmake/caches/Apple-lldb-macOS.cmake -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DLLVM_ENABLE_PROJECTS="clang;lldb" llvm
ninja check-lldb

This gives me 10 failing tests, but none of them are related to the coroutine_handle pretty printer.

If I run

./bin/llvm-lit ../lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle

I get

UNSUPPORTED: lldb-api :: functionalities/data-formatter/data-formatter-stl/generic/coroutine_handle/TestCoroutineHandle.py (1 of 1)

No idea why this test is marked as unsupportd.
Any idea how I can run this test case locally on my mac?