{
int n = 100;
char *foo = malloc(n);
...;
bar();
}
(gdb) break bar
(gdb) r
(gdb) up
(gdb) p/x *(char (*)[100]) foo
Printing malloc'd arrays can be a pain. Using the "pointer to array of type" typecast, you can force gdb to tell you everything at once.