This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/RFA] print arrays with indexes


On Tue, Sep 06, 2005 at 01:20:18PM -0700, Joel Brobecker wrote:
> So, the idea would be for GDB to print the above array as:
> 
>         (gdb) p array
>         $2 = {0 => 1, 1 => 2, 2 => 3, 3 => 4}

> For the moment, the patch I am submitting here is using the Ada notation,
> because C/C++/ObjC don't provide this way of "qualifying" each element.
> Not sure about Fortran or Pascal. We can certainly make this a language
> method, with a default method.

In fact, C99 allows:
  int A[3] = { [1] = 2 };

GNU C has supported it for a while, I think.  I don't think it works
for C++.

So, yes, a language method would be good.

>         (gdb) set/show print array-indexes
> 
> With a default of "off", to preserve the current behavior.

I suppose we've got to :-)  I'd turn it on, that's for sure.

Afraid I haven't time to look at the patch just now.  I'll be back.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]