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

Ulrich Drepper <drepper.fsp+rhbz at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drepper.fsp+rhbz at gmail dot 
com

--- Comment #2 from Ulrich Drepper <drepper.fsp+rhbz at gmail dot com> ---
Let's go through the details.  I like the idea of a common format but there
also
shouldn't be any information lost.

Here's some test code, similar to what Martin has:

#include <tuple>
#include <array>
#include <vector>
#include <bitset>
#include <memory>

int main()
{
  std::tuple<> t1;
  std::tuple<int> t2;
  std::tuple<int,int> t3;
  std::vector<int> v1;
  std::vector<int> v2 { 0 };
  std::vector<int> v3 { 0, 0 };
  std::array<int,0> a1;
  std::array<int,1> a2 { 0 };
  std::array<int,2> a3 { 0, 0 };
  std::pair<int,int> p1;
  std::bitset<0> b1;
  std::bitset<1> b2("0");
  std::bitset<2> b3("00");
  return 0;
}


The output as of gcc-12.1.1 (and gdb-12.1, what a coincidence) is:

(gdb) info locals 
t1 = empty std::tuple
t2 = std::tuple containing = {[0] = 0}
t3 = std::tuple containing = {[0] = 0, [1] = 0}
v1 = std::vector of length 0, capacity 0
v2 = std::vector of length 1, capacity 1 = {0}
v3 = std::vector of length 2, capacity 2 = {0, 0}
a1 = {_M_elems = {<No data fields>}}
a2 = {_M_elems = {0}}
a3 = {_M_elems = {0, 0}}
p1 = {first = 0, second = 0}
b1 = std::bitset
b2 = std::bitset
b3 = std::bitset

This is just my opinion, but I would like to see the following output (NB, this
already uses the tuple pretty printer change I committed):

(gdb) info locals 
t1 = std::tuple<> = { }
t2 = std::tuple<int> = {[0] = 0}
t3 = std::tuple<int,int> = {[0] = 0, [1] = 0}
v1 = std::vector<int> of length 0, capacity 0
v2 = std::vector<int> of length 1, capacity 1 = {0}
v3 = std::vector<int> of length 2, capacity 2 = {0, 0}
a1 = std::array<int,0> = { }
a2 = std::array<int,1> = {0}
a3 = std::array<int,2> = {0, 0}
p1 = {first = 0, second = 0}
b1 = std::bitset<0> = { }
b2 = std::bitset<1> = {0}
b3 = std::bitset<2> = {0, 0}

This means several changes but it corrects the rather ad-hoc nature of the
current output to be more uniform.

Reply via email to