This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/RFA] print arrays with indexes
- From: Daniel Jacobowitz <drow at false dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Tue, 6 Sep 2005 16:57:10 -0400
- Subject: Re: [RFC/RFA] print arrays with indexes
- References: <20050906202018.GC1153@adacore.com>
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