Re: [RFC/RFA] print arrays with indexes

Joel Brobecker
2005-09-07T21:41:45Z

> > I've got no strong opinions on this either way. Thresholds seem
> > complicated as a UI.
>
> The printing code seems to have a few thresholds --- 'show print
> repeats', 'show print elements', maybe others. It's a waste of time
> when they hide or obscure information I need, and I have to go in and
> change them. But I don't see this one having that effect; both the
> labeled and unlabeled forms show all the information there is. It's
> just a question of whether it's worth avoiding stuff like:
>
> (gdb) print pipe
> $2 = { [0] = 6, [1] = 7 }
> (gdb)
>
> in favor of:
>
> (gdb) print pipe
> $2 = { 6, 7 }
> (gdb)

Speaking for my personal usage, I find that the labeled form is pretty
hard to read. So I will use it occasionally when there are too many
elements in the array for me to count. The rest of the time, I will
have that feature turned off.

How about we enhance a bit the approach, and have:

set print array-indexes on/off/auto

If set to auto, then we use the threshold?

(I'm so glad I haven't started writing the doc and the testcases yet :-).
--
Joel