public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Why does the prettyprint of std::tuple start with [1]?
@ 2021-06-13 13:49 Paul Smith
  2021-06-13 15:35 ` Paul Smith
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Smith @ 2021-06-13 13:49 UTC (permalink / raw)
  To: gdb

Am I the only one to be confused by the fact that the pretty-printer
for std::tuple values starts indexing at 1 instead of 0?

(gdb) p info
$1 = (const std::tuple<TestType, DataType> &) @0x7fffffffd550: {
  param = std::tuple containing = {
    [1] = TestType::OneTest,
    [2] = DataType::SomeData
  },
  index = 2
}

Why aren't the indexes on the left numbered [0] and [1], corresponding
to the values used with std::get(), instead of [1] and [2]?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why does the prettyprint of std::tuple start with [1]?
  2021-06-13 13:49 Why does the prettyprint of std::tuple start with [1]? Paul Smith
@ 2021-06-13 15:35 ` Paul Smith
  2021-06-13 15:43   ` David Blaikie
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Smith @ 2021-06-13 15:35 UTC (permalink / raw)
  To: gdb

On Sun, 2021-06-13 at 09:49 -0400, Paul Smith wrote:
> Am I the only one to be confused by the fact that the pretty-printer
> for std::tuple values starts indexing at 1 instead of 0?
> 
> (gdb) p info
> $1 = (const std::tuple<TestType, DataType> &) @0x7fffffffd550: {
>   param = std::tuple containing = {
>     [1] = TestType::OneTest,
>     [2] = DataType::SomeData
>   },
>   index = 2
> }
> 
> Why aren't the indexes on the left numbered [0] and [1],
> corresponding
> to the values used with std::get(), instead of [1] and [2]?

Hm, maybe this belongs on the GCC mailing list instead of here.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why does the prettyprint of std::tuple start with [1]?
  2021-06-13 15:35 ` Paul Smith
@ 2021-06-13 15:43   ` David Blaikie
  0 siblings, 0 replies; 3+ messages in thread
From: David Blaikie @ 2021-06-13 15:43 UTC (permalink / raw)
  To: paul; +Cc: gdb

Likely it does, yeah.

Probably a bug in libstdc++'s pretty printer:

https://github.com/gcc-mirror/gcc/blob/8a7d54b1e10b8f4fba1358260ed2e7056ed23cbd/libstdc%2B%2B-v3/python/libstdcxx/v6/printers.py#L528

https://github.com/gcc-mirror/gcc/blob/8a7d54b1e10b8f4fba1358260ed2e7056ed23cbd/libstdc%2B%2B-v3/python/libstdcxx/v6/printers.py#L563

Something related to those bits of code.

On Sun, Jun 13, 2021 at 8:37 AM Paul Smith <paul@mad-scientist.net> wrote:

> On Sun, 2021-06-13 at 09:49 -0400, Paul Smith wrote:
> > Am I the only one to be confused by the fact that the pretty-printer
> > for std::tuple values starts indexing at 1 instead of 0?
> >
> > (gdb) p info
> > $1 = (const std::tuple<TestType, DataType> &) @0x7fffffffd550: {
> >   param = std::tuple containing = {
> >     [1] = TestType::OneTest,
> >     [2] = DataType::SomeData
> >   },
> >   index = 2
> > }
> >
> > Why aren't the indexes on the left numbered [0] and [1],
> > corresponding
> > to the values used with std::get(), instead of [1] and [2]?
>
> Hm, maybe this belongs on the GCC mailing list instead of here.
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-13 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 13:49 Why does the prettyprint of std::tuple start with [1]? Paul Smith
2021-06-13 15:35 ` Paul Smith
2021-06-13 15:43   ` David Blaikie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).