Node:Complex vars, Next:, Previous:Bool vars, Up:Debugging

12.9 Debugging the complex data type

Q: I cannot display in GDB the values of my variables of type __complex__....

A: Current versions of GDB don't support __complex__ variables. A work-around is to manually cast them to a pair of numbers. For example, to access the real and imaginary part of a variable foo declared __complex__ double, do this:

 (gdb) print *(double *)&foo
 $1 = 4
 (gdb) print *((double *)&foo + 1)
 $2 = 6