This is the mail archive of the gdb@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]

gdb - Printing multiple arrays or arrays of arrays


Hello,

   I know that having a:

int *vec = malloc( 10 * sizeof(int));

   I would print the values of the 10 ints in gdb with:

(gdb)p vec@10

   But what if I have:

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?

   Further, how would I print other such complex things? Like arrays of
structures with an array inside the last.


   Thank you,

Dedeco


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