This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: printing array in function
Dear Jan,
Le 03/09/2010 11:15, Jan Kratochvil a écrit :
> On Fri, 03 Sep 2010 11:06:02 +0200, Nicolas Sabouret wrote:
>> 1: void f(int tab[]) {
>> 2: tab[0] = 1;
>> 3: }
>> (gdb) p tab -> (int *) 0xbffff440
>
> I have only an idea by C++:
>
> void f(int (&tab)[2]) {
> (gdb) p tab
> $1 = (int (&)[2]) @0x7fffffffde50: {-1, -1}
Thanks for the quick answer. However, your solution requires :
1) to fix the array size in the function signature (this is something we
would prefer to avoid but why not)
2) to use a non-regular syntax in the function signature, which is
someting we cannot do (we want our students to lear the proper C-syntax).
Any other idea ?
--
Nicolas Sabouret
LIP6, BC169, 4 place Jussieu, 75005 Paris
http://www-poleia.lip6.fr/~sabouret