This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Ignore libcxx std::ranges global variables in frame var
ClosedPublic

Authored by Michael137 on Mar 3 2023, 7:04 AM.

Details

Summary

The motivation is to avoid cluttering LLDB's global variable view for
std::ranges users.

Before:

(lldb) frame var -g
...
(const std::ranges::__end::__fn) std::__1::ranges::__cpo::end = {}
(const std::ranges::views::__all::__fn) std::__1::ranges::views::__cpo::all = {}
(const std::ranges::__begin::__fn) std::__1::ranges::__cpo::begin = {}
(const std::ranges::views::__take::__fn) std::__1::ranges::views::__cpo::take = {}
(const std::ranges::__max_element::__fn) std::__1::ranges::__cpo::max_element = {}
(const std::ranges::__size::__fn) std::__1::ranges::__cpo::size = {}
(const std::ranges::__data::__fn) std::__1::ranges::__cpo::data = {}

After this patch none of these __cpo variables would show up.

Diff Detail

Event Timeline

Michael137 created this revision.Mar 3 2023, 7:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 7:04 AM
Michael137 requested review of this revision.Mar 3 2023, 7:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 7:04 AM

Alternative to https://reviews.llvm.org/D142993

The other option would be introducing a new clang attribute that indicates "we don't want the debugger to display this but still keep the debug-info". This is what artificial does for inline-functions. So we could extend the attribute to handle variable declarations.

Alternative to https://reviews.llvm.org/D142993

The other option would be introducing a new clang attribute that indicates "we don't want the debugger to display this but still keep the debug-info". This is what artificial does for inline-functions. So we could extend the attribute to handle variable declarations.

Michael137 updated this revision to Diff 502126.Mar 3 2023, 7:15 AM
  • Remove leftover debug code
aprantl accepted this revision.Mar 3 2023, 8:34 AM

I think this is fine. It's concise, adds useful plugin functionality and we're already hardcoding all sorts of special knowledge about libc++.

lldb/include/lldb/Target/LanguageRuntime.h
154

Can you add a doxygen comment about the effects here?

This revision is now accepted and ready to land.Mar 3 2023, 8:34 AM
Michael137 updated this revision to Diff 502164.Mar 3 2023, 9:36 AM
  • Fix typo
  • Add doxygen comment
This revision was landed with ongoing or failed builds.Mar 3 2023, 9:37 AM
This revision was automatically updated to reflect the committed changes.

Whoops, last second variable name change broke the build bot. Fixed in 4d909c556e2caa8e150b892384fe8d42e774f8b0