[Lldb-commits] [PATCH] D74310: [lldb] Don't model std::atomic as a transparent data structure in the data formatter

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 10 04:35:40 PST 2020


teemperor created this revision.
teemperor added reviewers: JDevlieghere, jingham.
Herald added subscribers: lldb-commits, abidh, jfb, christof.
Herald added a project: LLDB.

Currently the data formatter is treating `std::atomic` variables as transparent wrappers
around their underlying value type. This causes that when printing `std::atomic<A *>`, the data
formatter will forward all requests for the children of the atomic variable to the `A *` pointer type
which will then return the respective members of `A`. If `A` in turn has a member that contains
the original atomic variable, this causes LLDB to infinitely recurse when printing an object with
such a `std::atomic` pointer member.

We could implement a workaround similar to whatever we do for pointer values but this patch
just implements the `std::atomic` formatter in the same way as we already implement other
formatters (e.g. smart pointers or `std::optional`) that just model the contents of the  as a child
"Value". This way LLDB knows when it actually prints a pointer and can just use its normal
workaround if "Value" is a recursive pointer.

Fixes rdar://59189235


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74310

Files:
  lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
  lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74310.243508.patch
Type: text/x-patch
Size: 4431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200210/1fdc2de1/attachment-0001.bin>


More information about the lldb-commits mailing list