I’m by no means a GDB expert. I know the basics, but I just learned this gem today. Say you have a C array with five items created with something like this:
int *array = malloc(5 * sizeof(int));
And you want to print it out in the debugger quickly. You can’t just print the pointer because GDB doesn’t know to print it as an array, but this will:
p *array@5
Output:
$1 = {0, 0, 0, 0, 0, 1}
To use this the left hand side, before the ‘@’ should be an array, and the right hand side needs to be the length of the array. Very handy.

