[Lldb-commits] [PATCH] D154128: [lldb] Add log indicating which kind of data formatter

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 29 12:59:37 PDT 2023


kastiglione added a comment.

I just test gave `__PRETTY_FUNCTION__` a test drive, and it's a bit verbose/noisy: For example:

  [ImplSP lldb_private::FormatManager::Get(lldb_private::ValueObject &, lldb::DynamicValueType) [ImplSP = std::shared_ptr<lldb_private::SyntheticChildren>]] Begin synthetic lookup.

Here's an example of the formatter logs with my change. Note that these logs are output in "blocks", that is the first line is prefixed with two newlines (`\n\n`):

  [Get] Begin summary lookup.
   [GetCached] Looking into cache for type Swift.Optional<main.Item>
   [GetCached] Cache search failed. Going normal route
   [Get] candidate match = Swift.Optional<main.Item> no-strip-pointers no-strip-reference no-strip-typedef
   [Get] candidate match = main.Item? no-strip-pointers no-strip-reference no-strip-typedef
   [Get] candidate match = Swift.Optional<main.Item> no-strip-pointers no-strip-reference no-strip-typedef
   [Get] candidate match = Swift.Optional<main.Item> no-strip-pointers no-strip-reference no-strip-typedef
   [Get] candidate match = main.Item? no-strip-pointers no-strip-reference no-strip-typedef
   [Get] candidate match = Swift.Optional<main.Item> no-strip-pointers no-strip-reference no-strip-typedef
   [Get] Trying to use category default
   [Get] Trying to use category llvm
   [Get] Trying to use category VectorTypes
   [Get] Trying to use category runtime-synthetics
   [Get] Trying to use category system
   [Get] nothing found - returning empty SP
   [GetCached] Caching 0x0 for type Swift.Optional<main.Item>
   [Get] Search failed. Giving language a chance.
   [Get] Language search success. Returning.

At the beginning of the lines, those names in square brackets are the `__FUNCTION__` macro. If they were replaced with `__PRETTY_FUNCTION__`, I think it would be too noisy.

> someone reading the logs might have to jump back and forth to understand what kind of formatter they're dealing with

I agree that this isn't ideal, As mentioned above, there are two newlines used to group and separate related log statements. This is why I put the new log at the top. Someone reading these logs can look at the first line in the block to know what kind of formatter is active. It's hard to strike a balance: if every line says the formatter kind, it's both convenient but also redundant/noisy.

In summary:

- I think `__PRETTY_FUNCTION__` is too noisy to be useful
- If we want each log statement to include the formatter kind, I am ok with that (but personally I can work with having it be mentioned at the top of each block)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154128



More information about the lldb-commits mailing list