[PATCH v2][PR gdb/17320] Fix array pretty formatter

Hannes Domani ssbssa@yahoo.de
Wed Apr 29 10:59:57 GMT 2020


 Am Dienstag, 28. April 2020, 17:17:29 MESZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-04-27 8:59 a.m., Hannes Domani via Gdb-patches wrote:
>
> > Currently, printing with array pretty formatting makes the output actually
> > less readable than without:
> >
> > (gdb) p -array on -- {{1,2,3},{4,5,6}}
> > $1 =  {    {1,
> >    2,
> >    3},
> >      {4,
> >    5,
> >    6}}
> > (gdb) p -array on -array-indexes on -- {{1,2,3},{4,5,6}}
> > $2 =  {[0] =    {[0] = 1,
> >    [1] = 2,
> >    [2] = 3},
> >  [1] =    {[0] = 4,
> >    [1] = 5,
> >    [2] = 6}}
> >
> > These changes now also put the first element and the array end bracket on a new
> > line, similar to the structure pretty formatter:
> >
> > (gdb) p -array on -- {{1,2,3},{4,5,6}}
> > $1 = {
> >  {
> >    1,
> >    2,
> >    3
> >  },
> >  {
> >    4,
> >    5,
> >    6
> >  }
> > }
> > (gdb) p -array on -array-indexes on -- {{1,2,3},{4,5,6}}
> > $2 = {
> >  [0] = {
> >    [0] = 1,
> >    [1] = 2,
> >    [2] = 3
> >  },
> >  [1] = {
> >    [0] = 4,
> >    [1] = 5,
> >    [2] = 6
>
> >  }
> > }
>
> Thanks for providing a test case, this is ok.

Pushed, thanks.


Hannes


More information about the Gdb-patches mailing list