https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110944

            Bug ID: 110944
           Summary: std::variant & optional GDB representation is too
                    verbose
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sebastian.redl at getdesigned dot at
  Target Milestone: ---

The key lines of the GDB visualizers for std::variant and std::optional look
like this:

return "%s [no contained value]" % self.typename

Note that this contains the full typename of the object.

We use lots of optionals of Boost.Units types, which have *huge* types. Here's
a small snippet of output when I attempt to print a value:

landing_mass_ =
std::optional<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::mass_base_dimension,
boost::units::static_rational<1, 1> >, boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::si::meter_base_unit,
boost::units::list<boost::units::scaled_base_unit<boost::units::cgs::gram_base_unit,
boost::units::scale<10, boost::units::static_rational<3, 1> > >,
boost::units::list<boost::units::si::second_base_unit,
boost::units::list<boost::units::si::ampere_base_unit,
boost::units::list<boost::units::si::kelvin_base_unit,
boost::units::list<boost::units::si::mole_base_unit,
boost::units::list<boost::units::si::candela_base_unit,
boost::units::list<boost::units::angle::radian_base_unit,
boost::units::list<boost::units::angle::steradian_base_unit,
boost::units::dimensionless_type> > > > > > > > > >, void>, double>> =
{[contained value] = 45359.237000000001}

Note that this is just one field of a struct with many fields (quite a few of
them optionals of unit types), and the value I'm printing is a vector of
multiple such structs, and the type is repeated for every single instance of an
optional.

It is, in short, not useful; in fact it makes the debug output completely
unusable.

Please just remove it. If I need to know the type of something, I can easily
look it up in the source code if I'm unsure about them. The debugger needs to
focus on runtime values, which I cannot look up.

Reply via email to