GDB question: Pretty-Printing a 2D Array?

Viewed 15268

I have a 2d array matrix[10][10] that I'd like to inspect at debug time.

I understand that I can do this in GDB using

p *matrix@10

But it outputs this in one line, making it difficult to read.

Is there a way to have this output formatted in any way, lets say as a matrix?

5 Answers

You can also use try p (float[n][m])Array to print a 2d array in gdb.
For example, p (float[3][3])*C

Related