This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb - Printing multiple arrays or arrays of arrays
- From: Daniel Jacobowitz <drow at false dot org>
- To: Dedeco <dedeco at ufmg dot br>, gdb at sourceware dot org
- Date: Fri, 30 Jun 2006 15:05:07 -0400
- Subject: Re: gdb - Printing multiple arrays or arrays of arrays
- References: <44A57082.3090703@ufmg.br>
On Fri, Jun 30, 2006 at 03:42:10PM -0300, Dedeco wrote:
> int **vec = malloc( 9 * sizeof(int*));
> for (i=0; i<10; i++)
> vec[i] = malloc(10 *sizeof(int*));
>
> How to print the 90 values I have?
GDB doesn't have a handy syntax for this. However you can write a user
defined command:
define pa
set $i = 0
while $i < 9
p $1[$i]@10
end
$i++
end
pa vec
--
Daniel Jacobowitz
CodeSourcery